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
This commit is contained in:
Elena Demikhovsky
2015-12-01 12:08:36 +00:00
parent a00de6366a
commit 0781d7b2b4
5 changed files with 43 additions and 17 deletions

View File

@@ -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)