mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
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
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user