From 4ded40a44da9d67355a103cc8da68c2c1ab40bfd Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 3 Mar 2009 22:36:47 +0000 Subject: Instruction counters must skip the bitcasts that feed into llvm.dbg.declare nodes, as well as the debug directives themselves. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65976 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/BasicBlockUtils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Transforms/Utils/BasicBlockUtils.cpp') diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index 2887bdc46b..fd7b7da76f 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -477,6 +477,12 @@ Value *llvm::FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB, Instruction *Inst = --ScanFrom; if (isa(Inst)) continue; + // Likewise, we skip bitcasts that feed into a llvm.dbg.declare; these are + // not present when debugging is off. + if (isa(Inst) && Inst->hasOneUse() && + isa(Inst->use_begin())) + continue; + // Restore ScanFrom to expected value in case next test succeeds ScanFrom++; -- cgit v1.2.3-18-g5258