Skip ptr-to-ptr bitcasts when counting in another case.
authorDale Johannesen <dalej@apple.com>
Wed, 4 Mar 2009 02:06:53 +0000 (02:06 +0000)
committerDale Johannesen <dalej@apple.com>
Wed, 4 Mar 2009 02:06:53 +0000 (02:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66000 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/BasicBlockUtils.cpp

index fd7b7da76fbe135ac3fc42e0c6960ee7b6dbe991..97460bf1add465e3c6c6452e5118f64b306b38e7 100644 (file)
@@ -477,10 +477,10 @@ Value *llvm::FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB,
     Instruction *Inst = --ScanFrom;
     if (isa<DbgInfoIntrinsic>(Inst))
       continue;
-    // Likewise, we skip bitcasts that feed into a llvm.dbg.declare; these are
-    // not present when debugging is off.
-    if (isa<BitCastInst>(Inst) && Inst->hasOneUse() &&
-        isa<DbgDeclareInst>(Inst->use_begin()))
+    // We skip pointer-to-pointer bitcasts, which are NOPs.
+    // It is necessary for correctness to skip those that feed into a
+    // llvm.dbg.declare, as these are not present when debugging is off.
+    if (isa<BitCastInst>(Inst) && isa<PointerType>(Inst->getType()))
       continue;
 
     // Restore ScanFrom to expected value in case next test succeeds