summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-02 02:06:37 +0000
committerChris Lattner <sabre@nondot.org>2009-11-02 02:06:37 +0000
commit3cd6a61b275f49df4f2aaa273efbf4cf8e0a6511 (patch)
treea6bff97c438ca9104eda68fc619c77a138e0ecc4 /llvm/lib
parentdb3311edc7ed4e6171f268a1f1967f0f65aac457 (diff)
downloadbcm5719-llvm-3cd6a61b275f49df4f2aaa273efbf4cf8e0a6511.tar.gz
bcm5719-llvm-3cd6a61b275f49df4f2aaa273efbf4cf8e0a6511.zip
fix instcombine to only do store sinking when the alignments
of the two loads agree. Propagate that onto the new store. llvm-svn: 85772
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 07681d15d87..ba899bf15bb 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11943,9 +11943,11 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
return false;
--BBI;
}
- // If this isn't a store, or isn't a store to the same location, bail out.
+ // If this isn't a store, isn't a store to the same location, or if the
+ // alignments differ, bail out.
OtherStore = dyn_cast<StoreInst>(BBI);
- if (!OtherStore || OtherStore->getOperand(1) != SI.getOperand(1))
+ if (!OtherStore || OtherStore->getOperand(1) != SI.getOperand(1) ||
+ OtherStore->getAlignment() != SI.getAlignment())
return false;
} else {
// Otherwise, the other block ended with a conditional branch. If one of the
@@ -11960,7 +11962,8 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
for (;; --BBI) {
// Check to see if we find the matching store.
if ((OtherStore = dyn_cast<StoreInst>(BBI))) {
- if (OtherStore->getOperand(1) != SI.getOperand(1))
+ if (OtherStore->getOperand(1) != SI.getOperand(1) ||
+ OtherStore->getAlignment() != SI.getAlignment())
return false;
break;
}
@@ -11995,7 +11998,8 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
// insert it.
BBI = DestBB->getFirstNonPHI();
InsertNewInstBefore(new StoreInst(MergedVal, SI.getOperand(1),
- OtherStore->isVolatile()), *BBI);
+ OtherStore->isVolatile(),
+ SI.getAlignment()), *BBI);
// Nuke the old stores.
EraseInstFromFunction(SI);
OpenPOWER on IntegriCloud