summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-10-03 08:26:28 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-10-03 08:26:28 +0000
commit08e5f49f90a82ab2aacb2fe096a239625eb17e84 (patch)
treef2cfa4a77bee2ae49d5b8a8f5732ca772a43e666 /llvm/lib
parent4b2b38d3982c115906ecc81fa9be3cf5d0330a3d (diff)
downloadbcm5719-llvm-08e5f49f90a82ab2aacb2fe096a239625eb17e84.tar.gz
bcm5719-llvm-08e5f49f90a82ab2aacb2fe096a239625eb17e84.zip
Fix an issue where we failed to adjust the alignment constraint on
a memcpy to reflect that '0' has a different meaning when applied to a load or store. Now we correctly use underaligned loads and stores for the test case added. llvm-svn: 165101
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 58bae0971e3..f4fd8575d3a 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -2585,6 +2585,12 @@ private:
return false;
}
+ // Note that we clamp the alignment to 1 here as a 0 alignment for a memcpy
+ // is equivalent to 1, but that isn't true if we end up rewriting this as
+ // a load or store.
+ if (!Align)
+ Align = 1;
+
Value *SrcPtr = OtherPtr;
Value *DstPtr = &NewAI;
if (!IsDest)
OpenPOWER on IntegriCloud