summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-23 05:06:28 +0000
committerChris Lattner <sabre@nondot.org>2008-07-23 05:06:28 +0000
commit8a8fb908dcf4ec1fd85e4a91333bc90d40cf4918 (patch)
tree378ed623f97ee2ad5703f4a707289c94bc79f480 /llvm/lib
parente754764aa96fdb0266da0b13244e50f39c126c7b (diff)
downloadbcm5719-llvm-8a8fb908dcf4ec1fd85e4a91333bc90d40cf4918.tar.gz
bcm5719-llvm-8a8fb908dcf4ec1fd85e4a91333bc90d40cf4918.zip
"Allow LICM to sink or lift loads from constant memory. Also add a test
case for this. This allows instructions like loads from global variables declared to be constant to be moved out of loops." Patch by Stefanus Du Toit! llvm-svn: 53945
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index f7afaf44da5..13440c13b65 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -370,6 +370,11 @@ bool LICM::canSinkOrHoistInst(Instruction &I) {
if (LI->isVolatile())
return false; // Don't hoist volatile loads!
+ // Loads from constant memory are always safe to move, even if they end up
+ // in the same alias set as something that ends up being modified.
+ if (AA->pointsToConstantMemory(LI->getOperand(0)))
+ return true;
+
// Don't hoist loads which have may-aliased stores in loop.
unsigned Size = 0;
if (LI->getType()->isSized())
OpenPOWER on IntegriCloud