mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-09 22:24:37 +00:00
Use a SCEV expression cast instead of immediately inserting a
new instruction with SCEVExpander::InsertCastOfTo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69290 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1836,17 +1836,17 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
|
|||||||
if (L->contains(User.Inst->getParent()))
|
if (L->contains(User.Inst->getParent()))
|
||||||
User.Inst->moveBefore(LatchBlock->getTerminator());
|
User.Inst->moveBefore(LatchBlock->getTerminator());
|
||||||
}
|
}
|
||||||
if (RewriteOp->getType() != ReplacedTy) {
|
|
||||||
Instruction::CastOps opcode =
|
|
||||||
CastInst::getCastOpcode(RewriteOp, false, ReplacedTy, false);
|
|
||||||
assert(opcode != Instruction::SExt &&
|
|
||||||
opcode != Instruction::ZExt &&
|
|
||||||
"Unexpected widening cast!");
|
|
||||||
RewriteOp = SCEVExpander::InsertCastOfTo(opcode, RewriteOp, ReplacedTy);
|
|
||||||
}
|
|
||||||
|
|
||||||
SCEVHandle RewriteExpr = SE->getUnknown(RewriteOp);
|
SCEVHandle RewriteExpr = SE->getUnknown(RewriteOp);
|
||||||
|
|
||||||
|
if (TD->getTypeSizeInBits(RewriteOp->getType()) !=
|
||||||
|
TD->getTypeSizeInBits(ReplacedTy)) {
|
||||||
|
assert(TD->getTypeSizeInBits(RewriteOp->getType()) >
|
||||||
|
TD->getTypeSizeInBits(ReplacedTy) &&
|
||||||
|
"Unexpected widening cast!");
|
||||||
|
RewriteExpr = SE->getTruncateExpr(RewriteExpr, ReplacedTy);
|
||||||
|
}
|
||||||
|
|
||||||
// If we had to insert new instructions for RewriteOp, we have to
|
// If we had to insert new instructions for RewriteOp, we have to
|
||||||
// consider that they may not have been able to end up immediately
|
// consider that they may not have been able to end up immediately
|
||||||
// next to RewriteOp, because non-PHI instructions may never precede
|
// next to RewriteOp, because non-PHI instructions may never precede
|
||||||
|
Reference in New Issue
Block a user