aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp6
-rw-r--r--lib/Transforms/Utils/BasicBlockUtils.cpp6
2 files changed, 11 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;
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<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++;