summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-01 20:12:04 +0000
committerChris Lattner <sabre@nondot.org>2011-01-01 20:12:04 +0000
commita3514441e0461c09a721447975d1c938218f0c88 (patch)
treeb8de5c8919f9207239b4b77d2e8f2e8ec55f2cc2 /llvm/lib
parent772749aea18b0a3b9ca376c1f1f96fed386d2a93 (diff)
downloadbcm5719-llvm-a3514441e0461c09a721447975d1c938218f0c88.tar.gz
bcm5719-llvm-a3514441e0461c09a721447975d1c938218f0c88.zip
add a validity check that was missed, fixing a crash on the
new testcase. llvm-svn: 122662
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 9878a2e4e83..8c788039d6b 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -234,6 +234,11 @@ bool LoopIdiomRecognize::
processLoopStoreOfSplatValue(StoreInst *SI, unsigned StoreSize,
Value *SplatValue,
const SCEVAddRecExpr *Ev, const SCEV *BECount) {
+ // Verify that the stored value is loop invariant. If not, we can't promote
+ // the memset.
+ if (!CurLoop->isLoopInvariant(SplatValue))
+ return false;
+
// Temporarily remove the store from the loop, to avoid the mod/ref query from
// seeing it.
Instruction *InstAfterStore = ++BasicBlock::iterator(SI);
OpenPOWER on IntegriCloud