summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPekka Jaaskelainen <pekka.jaaskelainen@tut.fi>2013-04-23 08:08:51 +0000
committerPekka Jaaskelainen <pekka.jaaskelainen@tut.fi>2013-04-23 08:08:51 +0000
commita8958769ea5583d58ae51931d8b1271c23fd20ea (patch)
treee39cb88d32ea74647b1108b92729709ce501b199 /lib
parent3e56b43ac8789da3799069bfca456494c07df872 (diff)
downloadllvm-a8958769ea5583d58ae51931d8b1271c23fd20ea.tar.gz
llvm-a8958769ea5583d58ae51931d8b1271c23fd20ea.tar.bz2
llvm-a8958769ea5583d58ae51931d8b1271c23fd20ea.tar.xz
Refuse to (even try to) vectorize loops which have uniform writes,
even if erroneously annotated with the parallel loop metadata. Fixes Bug 15794: "Loop Vectorizer: Crashes with the use of llvm.loop.parallel metadata" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180081 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 0c88ba7835..2e42585e35 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2548,13 +2548,6 @@ LoopVectorizationLegality::hasPossibleGlobalWriteReorder(
bool LoopVectorizationLegality::canVectorizeMemory() {
- if (TheLoop->isAnnotatedParallel()) {
- DEBUG(dbgs()
- << "LV: A loop annotated parallel, ignore memory dependency "
- << "checks.\n");
- return true;
- }
-
typedef SmallVector<Value*, 16> ValueVector;
typedef SmallPtrSet<Value*, 16> ValueSet;
// Holds the Load and Store *instructions*.
@@ -2577,7 +2570,7 @@ bool LoopVectorizationLegality::canVectorizeMemory() {
if (it->mayReadFromMemory()) {
LoadInst *Ld = dyn_cast<LoadInst>(it);
if (!Ld) return false;
- if (!Ld->isSimple()) {
+ if (!Ld->isSimple() && !TheLoop->isAnnotatedParallel()) {
DEBUG(dbgs() << "LV: Found a non-simple load.\n");
return false;
}
@@ -2589,7 +2582,7 @@ bool LoopVectorizationLegality::canVectorizeMemory() {
if (it->mayWriteToMemory()) {
StoreInst *St = dyn_cast<StoreInst>(it);
if (!St) return false;
- if (!St->isSimple()) {
+ if (!St->isSimple() && !TheLoop->isAnnotatedParallel()) {
DEBUG(dbgs() << "LV: Found a non-simple store.\n");
return false;
}
@@ -2636,6 +2629,13 @@ bool LoopVectorizationLegality::canVectorizeMemory() {
ReadWrites.insert(std::make_pair(Ptr, ST));
}
+ if (TheLoop->isAnnotatedParallel()) {
+ DEBUG(dbgs()
+ << "LV: A loop annotated parallel, ignore memory dependency "
+ << "checks.\n");
+ return true;
+ }
+
for (I = Loads.begin(), IE = Loads.end(); I != IE; ++I) {
LoadInst *LD = cast<LoadInst>(*I);
Value* Ptr = LD->getPointerOperand();