diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-09-25 22:46:21 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-09-25 22:46:21 +0000 |
commit | 051a318e67ae601c46b4fc7ceb5c5b0b605a296d (patch) | |
tree | 059ad472fc8b4edee48adf0dd4cea534eb43b547 /lib/Transforms | |
parent | 289b5d7f02a442cb849d3762a78796d3355b02fc (diff) |
Don't drop the alignment on a memcpy intrinsic when producing a store. This is
only a missed optimization opportunity if the store is over-aligned, but a
miscompile if the store's new type has a higher natural alignment than the
memcpy did. Fixes PR13920!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/SROA.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp index 1b3e8f9baf..04e350c25f 100644 --- a/lib/Transforms/Scalar/SROA.cpp +++ b/lib/Transforms/Scalar/SROA.cpp @@ -2272,8 +2272,9 @@ private: getName(".insert")); } - Value *Store = IRB.CreateStore(Src, DstPtr, II.isVolatile()); - (void)Store; + StoreInst *Store = cast<StoreInst>(IRB.CreateStore(Src, DstPtr, + II.isVolatile())); + Store->setAlignment(II.getAlignment()); DEBUG(dbgs() << " to: " << *Store << "\n"); return !II.isVolatile(); } |