summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-05 02:06:48 +0000
committerDale Johannesen <dalej@apple.com>2009-03-05 02:06:48 +0000
commit78ab3380247882485fc7be86f5764647ba072529 (patch)
treefb6fe02695577ec8a80220ba4b9f5d2bb56c577d
parente268b406bab611c738bfa0fa215324960dce23fa (diff)
downloadbcm5719-llvm-78ab3380247882485fc7be86f5764647ba072529.tar.gz
bcm5719-llvm-78ab3380247882485fc7be86f5764647ba072529.zip
Fix another case where debug info was affecting
codegen. I convinced myself it was OK to skip all pointer bitcasts here too. llvm-svn: 66122
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 1679b9f4bca..86f3256a6ee 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11565,9 +11565,15 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
return Res;
- // If this store is the last instruction in the basic block, and if the block
- // ends with an unconditional branch, try to move it to the successor block.
- BBI = &SI; ++BBI;
+ // If this store is the last instruction in the basic block (possibly
+ // excepting debug info instructions and the pointer bitcasts that feed
+ // into them), and if the block ends with an unconditional branch, try
+ // to move it to the successor block.
+ BBI = &SI;
+ do {
+ ++BBI;
+ } while (isa<DbgInfoIntrinsic>(BBI) ||
+ (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType())));
if (BranchInst *BI = dyn_cast<BranchInst>(BBI))
if (BI->isUnconditional())
if (SimplifyStoreAtEndOfBlock(SI))
@@ -11625,8 +11631,15 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
// else' case. there is an instruction before the branch.
StoreInst *OtherStore = 0;
if (OtherBr->isUnconditional()) {
- // If this isn't a store, or isn't a store to the same location, bail out.
--BBI;
+ // Skip over debugging info.
+ while (isa<DbgInfoIntrinsic>(BBI) ||
+ (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
+ if (BBI==OtherBB->begin())
+ return false;
+ --BBI;
+ }
+ // If this isn't a store, or isn't a store to the same location, bail out.
OtherStore = dyn_cast<StoreInst>(BBI);
if (!OtherStore || OtherStore->getOperand(1) != SI.getOperand(1))
return false;
OpenPOWER on IntegriCloud