diff options
| author | Dale Johannesen <dalej@apple.com> | 2009-03-03 22:36:47 +0000 | 
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2009-03-03 22:36:47 +0000 | 
| commit | 09c3e8ec00d23f43a01df9069d050036a743e74b (patch) | |
| tree | 59ec375a62c4a19b63f3c9ae5450a6ee404c871c /llvm/lib/Transforms | |
| parent | 8720a0b9a75d23417a8a625ce057492114f3e1ac (diff) | |
| download | bcm5719-llvm-09c3e8ec00d23f43a01df9069d050036a743e74b.tar.gz bcm5719-llvm-09c3e8ec00d23f43a01df9069d050036a743e74b.zip  | |
Instruction counters must skip the bitcasts that
feed into llvm.dbg.declare nodes, as well as
the debug directives themselves.
llvm-svn: 65976
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 6 | 
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 64dd1031db9..8f094b747c1 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -11484,7 +11484,11 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {    for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts;         --ScanInsts) {      // Don't count debug info directives, lest they affect codegen. -    if (isa<DbgInfoIntrinsic>(BBI)) { +    // Likewise, we skip bitcasts that feed into a llvm.dbg.declare; these are +    // not present when debugging is off. +    if (isa<DbgInfoIntrinsic>(BBI) || +        (isa<BitCastInst>(BBI) && BBI->hasOneUse() && +         isa<DbgDeclareInst>(BBI->use_begin()))) {        ScanInsts++;        --BBI;        continue; diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 2887bdc46b5..fd7b7da76fb 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -477,6 +477,12 @@ 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())) +      continue; +      // Restore ScanFrom to expected value in case next test succeeds      ScanFrom++;  | 

