diff options
| author | Eric Christopher <echristo@apple.com> | 2010-03-27 01:54:00 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2010-03-27 01:54:00 +0000 |
| commit | 26d0f3ff37857fef3b3074a1321fa9cde40bb819 (patch) | |
| tree | a7b5e12e2821e3cb348dc6a6740c4a760c38619d /lib/Transforms/IPO | |
| parent | 7012a49c6957952e247b43516739d57daf28ad30 (diff) | |
| download | external_llvm-26d0f3ff37857fef3b3074a1321fa9cde40bb819.zip external_llvm-26d0f3ff37857fef3b3074a1321fa9cde40bb819.tar.gz external_llvm-26d0f3ff37857fef3b3074a1321fa9cde40bb819.tar.bz2 | |
When we promote a load of an argument make sure to take the alignment
of the previous load - it's usually important. For example, we don't want
to blindly turn an unaligned load into an aligned one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
| -rw-r--r-- | lib/Transforms/IPO/ArgumentPromotion.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index 00b147e..40a87e8 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -687,7 +687,11 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F, Ops.clear(); AA.copyValue(OrigLoad->getOperand(0), V); } - Args.push_back(new LoadInst(V, V->getName()+".val", Call)); + // Since we're replacing a load make sure we take the alignment + // of the previous load. + LoadInst *newLoad = new LoadInst(V, V->getName()+".val", Call); + newLoad->setAlignment(OrigLoad->getAlignment()); + Args.push_back(newLoad); AA.copyValue(OrigLoad, Args.back()); } } |
