summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-09-25 22:46:21 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-09-25 22:46:21 +0000
commitd9f7910671958cf9f3ef727ceec2076abb4c6023 (patch)
tree55924c4e81146ca65e659c77870014139ecd456e /llvm/lib
parent7b104007096a7abbb760f3ab520fbd2bef7980c4 (diff)
downloadbcm5719-llvm-d9f7910671958cf9f3ef727ceec2076abb4c6023.tar.gz
bcm5719-llvm-d9f7910671958cf9f3ef727ceec2076abb4c6023.zip
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! llvm-svn: 164641
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 1b3e8f9baf4..04e350c25fc 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/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();
}
OpenPOWER on IntegriCloud