diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-06-26 16:54:53 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-06-26 16:54:53 +0000 |
commit | 29acf7e03af9b5524daa1e7523e0296cc766ff24 (patch) | |
tree | 97c116b8abc4ca1848f3fa2d4a0c5580042f196c /lib | |
parent | c19bd321362166805194cbaf170e06a4790d2da9 (diff) | |
download | external_llvm-29acf7e03af9b5524daa1e7523e0296cc766ff24.tar.gz external_llvm-29acf7e03af9b5524daa1e7523e0296cc766ff24.tar.bz2 external_llvm-29acf7e03af9b5524daa1e7523e0296cc766ff24.zip |
Do not add cse-ed instructions into the visited map because we dont want to consider them as a candidate for replacement of instructions to be visited.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Vectorize/SLPVectorizer.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 9c8244b9ff..bb37994e9f 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1258,6 +1258,8 @@ Value *FuncSLP::vectorizeArith(ArrayRef<Value *> Operands) { for (unsigned i = 0, e = Operands.size(); i != e; ++i) { Value *S = Builder.CreateExtractElement(Vec, Builder.getInt32(i)); Operands[i]->replaceAllUsesWith(S); + Instruction *I = cast<Instruction>(Operands[i]); + I->eraseFromParent(); } return Vec; @@ -1280,7 +1282,7 @@ void FuncSLP::optimizeGatherSequence() { // Check if it has a preheader. BasicBlock *PreHeader = L->getLoopPreheader(); if (!PreHeader) - return; + continue; // If the vector or the element that we insert into it are // instructions that are defined in this basic block then we can't @@ -1310,17 +1312,19 @@ void FuncSLP::optimizeGatherSequence() { if (!Insert || !GatherSeq.count(Insert)) continue; - // Check if we can replace this instruction with any of the - // visited instructions. + // Check if we can replace this instruction with any of the + // visited instructions. for (SmallPtrSet<Instruction*, 16>::iterator v = Visited.begin(), ve = Visited.end(); v != ve; ++v) { if (Insert->isIdenticalTo(*v) && - DT->dominates((*v)->getParent(), Insert->getParent())) { + DT->dominates((*v)->getParent(), Insert->getParent())) { Insert->replaceAllUsesWith(*v); + Insert = 0; break; } } - Visited.insert(Insert); + if (Insert) + Visited.insert(Insert); } } } |