aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-03 22:36:47 +0000
committerDale Johannesen <dalej@apple.com>2009-03-03 22:36:47 +0000
commit4ded40a44da9d67355a103cc8da68c2c1ab40bfd (patch)
treeb86cefecfbe7695c02a88377c013ce80f411f554 /lib/Transforms/Scalar/InstructionCombining.cpp
parent70b5e04d85b5b43f9ece8a2acc161a9b47820027 (diff)
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
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 64dd1031db..8f094b747c 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/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;