summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2014-01-15 03:35:46 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2014-01-15 03:35:46 +0000
commitdc4c9460a25fa254df78947df150ebed857f5dc2 (patch)
tree5def36ef2f17381dd66ad5fa1e82d3d9800c23f3 /llvm/lib
parent39fdae7f6a59a63e64977fe42350141928e8ac6b (diff)
downloadbcm5719-llvm-dc4c9460a25fa254df78947df150ebed857f5dc2.tar.gz
bcm5719-llvm-dc4c9460a25fa254df78947df150ebed857f5dc2.zip
LoopVectorize: Only strip casts from integer types when replacing symbolic
strides Fixes PR18480. llvm-svn: 199291
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index bdfa0f06476..c05288bd070 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1072,9 +1072,10 @@ struct LoopVectorize : public LoopPass {
// LoopVectorizationCostModel.
//===----------------------------------------------------------------------===//
-static Value *stripCast(Value *V) {
+static Value *stripIntegerCast(Value *V) {
if (CastInst *CI = dyn_cast<CastInst>(V))
- return CI->getOperand(0);
+ if (CI->getOperand(0)->getType()->isIntegerTy())
+ return CI->getOperand(0);
return V;
}
@@ -1095,7 +1096,7 @@ static const SCEV *replaceSymbolicStrideSCEV(ScalarEvolution *SE,
Value *StrideVal = SI->second;
// Strip casts.
- StrideVal = stripCast(StrideVal);
+ StrideVal = stripIntegerCast(StrideVal);
// Replace symbolic stride by one.
Value *One = ConstantInt::get(StrideVal->getType(), 1);
@@ -1551,7 +1552,7 @@ InnerLoopVectorizer::addStrideCheck(Instruction *Loc) {
for (SmallPtrSet<Value *, 8>::iterator SI = Legal->strides_begin(),
SE = Legal->strides_end();
SI != SE; ++SI) {
- Value *Ptr = stripCast(*SI);
+ Value *Ptr = stripIntegerCast(*SI);
Value *C = ChkBuilder.CreateICmpNE(Ptr, ConstantInt::get(Ptr->getType(), 1),
"stride.chk");
// Store the first instruction we create.
OpenPOWER on IntegriCloud