summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-07-27 21:45:48 +0000
committerJustin Lebar <jlebar@google.com>2016-07-27 21:45:48 +0000
commit23a9686011b4ec1b1fdbd1d7748fddf7b3b06f9e (patch)
treee0c5438c20d578e4aef08c340bf749b72abf38d7 /llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
parent560333749f13b1a6072c376c3a12a684c7ade44d (diff)
downloadbcm5719-llvm-23a9686011b4ec1b1fdbd1d7748fddf7b3b06f9e.tar.gz
bcm5719-llvm-23a9686011b4ec1b1fdbd1d7748fddf7b3b06f9e.zip
[LSV] Don't assume that bitcast ops are Instructions.
Summary: When we ask the builder to create a bitcast on a constant, we get back a constant, not an instruction. Reviewers: asbirlea Subscribers: jholewinski, mzolotukhin, llvm-commits, arsenm Differential Revision: https://reviews.llvm.org/D22878 llvm-svn: 276922
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
index 804db412e29..acec94ecd05 100644
--- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -969,8 +969,6 @@ bool Vectorizer::vectorizeLoadChain(
if (VecLoadTy) {
SmallVector<Instruction *, 16> InstrsToErase;
- SmallVector<Instruction *, 16> InstrsToReorder;
- InstrsToReorder.push_back(cast<Instruction>(Bitcast));
unsigned VecWidth = VecLoadTy->getNumElements();
for (unsigned I = 0, E = Chain.size(); I != E; ++I) {
@@ -990,15 +988,14 @@ bool Vectorizer::vectorizeLoadChain(
}
}
- for (Instruction *ModUser : InstrsToReorder)
- reorder(ModUser);
+ // Bitcast might not be an Instruction, if the value being loaded is a
+ // constant. In that case, no need to reorder anything.
+ if (Instruction *BitcastInst = dyn_cast<Instruction>(Bitcast))
+ reorder(BitcastInst);
for (auto I : InstrsToErase)
I->eraseFromParent();
} else {
- SmallVector<Instruction *, 16> InstrsToReorder;
- InstrsToReorder.push_back(cast<Instruction>(Bitcast));
-
for (unsigned I = 0, E = Chain.size(); I != E; ++I) {
Value *V = Builder.CreateExtractElement(LI, Builder.getInt32(I));
Instruction *Extracted = cast<Instruction>(V);
@@ -1012,8 +1009,8 @@ bool Vectorizer::vectorizeLoadChain(
UI->replaceAllUsesWith(Extracted);
}
- for (Instruction *ModUser : InstrsToReorder)
- reorder(ModUser);
+ if (Instruction *BitcastInst = dyn_cast<Instruction>(Bitcast))
+ reorder(BitcastInst);
}
eraseInstructions(Chain);
OpenPOWER on IntegriCloud