aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-03-16 18:20:54 +0000
committerBill Wendling <isanbard@gmail.com>2012-03-16 18:20:54 +0000
commit0ccae0b1f6b95e4500adb45649472389a1f111a7 (patch)
tree8a4ce8829c9c0fedc764c33181a033f567d4c595 /lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
parenta82d526b31cd9825684fdee5c3372bf55dad4f57 (diff)
Revert r152907.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152935 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index fa68000df5..7446a51a4d 100644
--- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -379,22 +379,10 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
unsigned EffectiveStoreAlign = StoreAlign != 0 ? StoreAlign :
TD->getABITypeAlignment(Val->getType());
- if (KnownAlign > EffectiveStoreAlign) {
+ if (KnownAlign > EffectiveStoreAlign)
SI.setAlignment(KnownAlign);
- } else if (StoreAlign == 0) {
- unsigned PtrAlign = 0;
- if (GlobalValue *GV = dyn_cast<GlobalValue>(Ptr->stripPointerCasts()))
- PtrAlign = GV->getAlignment();
-
- if (PtrAlign != 0 && PtrAlign < EffectiveStoreAlign)
- // The pointer alignment may be less than the effective store
- // alignment. If so, then we don't want to increase the alignment here,
- // since that could lead to code-gen using instructions which require a
- // higher alignment than the pointer guarantees.
- SI.setAlignment(PtrAlign);
- else
- SI.setAlignment(EffectiveStoreAlign);
- }
+ else if (StoreAlign == 0)
+ SI.setAlignment(EffectiveStoreAlign);
}
// Don't hack volatile/atomic stores.