diff options
author | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2015-12-01 12:08:36 +0000 |
---|---|---|
committer | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2015-12-01 12:08:36 +0000 |
commit | 0781d7b2b472f9e746b542f4cbff4bad8089f53c (patch) | |
tree | 7c9e626f10d822ace1c76b1414be0f9c68b0ef84 /llvm/lib/Analysis/VectorUtils.cpp | |
parent | a00de6366a6662ad71c509fed584c7f707859a27 (diff) | |
download | llvm-0781d7b2b472f9e746b542f4cbff4bad8089f53c.zip llvm-0781d7b2b472f9e746b542f4cbff4bad8089f53c.tar.gz llvm-0781d7b2b472f9e746b542f4cbff4bad8089f53c.tar.bz2 |
Fixed a failure in cost calculation for vector GEP
Cost calculation for vector GEP failed with due to invalid cast to GEP index operand.
The bug is fixed, added a test.
http://reviews.llvm.org/D14976
llvm-svn: 254408
Diffstat (limited to 'llvm/lib/Analysis/VectorUtils.cpp')
-rw-r--r-- | llvm/lib/Analysis/VectorUtils.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp index fbf387b..e461294 100644 --- a/llvm/lib/Analysis/VectorUtils.cpp +++ b/llvm/lib/Analysis/VectorUtils.cpp @@ -417,9 +417,10 @@ Value *llvm::findScalarElement(Value *V, unsigned EltNo) { /// the input value is (1) a splat constants vector or (2) a sequence /// of instructions that broadcast a single value into a vector. /// -llvm::Value *llvm::getSplatValue(Value *V) { - if (auto *CV = dyn_cast<ConstantDataVector>(V)) - return CV->getSplatValue(); +const llvm::Value *llvm::getSplatValue(const Value *V) { + + if (auto *C = dyn_cast<Constant>(V)) + return C->getSplatValue(); auto *ShuffleInst = dyn_cast<ShuffleVectorInst>(V); if (!ShuffleInst) |