[llvm-commits] [llvm] r99699 - /llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
Eric Christopher
echristo at apple.com
Fri Mar 26 18:54:01 PDT 2010
Author: echristo
Date: Fri Mar 26 20:54:00 2010
New Revision: 99699
URL: http://llvm.org/viewvc/llvm-project?rev=99699&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=99699&r1=99698&r2=99699&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Fri Mar 26 20:54:00 2010
@@ -687,7 +687,11 @@
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());
}
}
More information about the llvm-commits
mailing list