diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2014-01-15 03:35:46 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2014-01-15 03:35:46 +0000 |
commit | e96fec2e436003714a6bf3739d594d77701da1e5 (patch) | |
tree | 95c6bae99bcff262d0e79073cfc65f4f10f825c4 /lib/Transforms/Vectorize/LoopVectorize.cpp | |
parent | 574df95d7ae58d9294662d513a66a77316329841 (diff) | |
download | llvm-e96fec2e436003714a6bf3739d594d77701da1e5.tar.gz llvm-e96fec2e436003714a6bf3739d594d77701da1e5.tar.bz2 llvm-e96fec2e436003714a6bf3739d594d77701da1e5.tar.xz |
LoopVectorize: Only strip casts from integer types when replacing symbolic
strides
Fixes PR18480.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index bdfa0f0647..c05288bd07 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/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. |