mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-01 12:16:08 +00:00
[IndVars] Rename getExtend; NFC
Rename `IndVarSimplify::getExtend` to `IndVarSimplify::createExtendInst` to make it obvious that it creates `llvm::Instruction` s. llvm-svn: 250484
This commit is contained in:
parent
37e87c2023
commit
7360f30852
@ -883,8 +883,8 @@ public:
|
|||||||
PHINode *createWideIV(SCEVExpander &Rewriter);
|
PHINode *createWideIV(SCEVExpander &Rewriter);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Value *getExtend(Value *NarrowOper, Type *WideType, bool IsSigned,
|
Value *createExtendInst(Value *NarrowOper, Type *WideType, bool IsSigned,
|
||||||
Instruction *Use);
|
Instruction *Use);
|
||||||
|
|
||||||
Instruction *cloneIVUser(NarrowIVDefUse DU, const SCEVAddRecExpr *WideAR);
|
Instruction *cloneIVUser(NarrowIVDefUse DU, const SCEVAddRecExpr *WideAR);
|
||||||
Instruction *cloneArithmeticIVUser(NarrowIVDefUse DU,
|
Instruction *cloneArithmeticIVUser(NarrowIVDefUse DU,
|
||||||
@ -917,8 +917,8 @@ static bool isLoopInvariant(Value *V, const Loop *L, const DominatorTree *DT) {
|
|||||||
return DT->properlyDominates(Inst->getParent(), L->getHeader());
|
return DT->properlyDominates(Inst->getParent(), L->getHeader());
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *WidenIV::getExtend(Value *NarrowOper, Type *WideType, bool IsSigned,
|
Value *WidenIV::createExtendInst(Value *NarrowOper, Type *WideType,
|
||||||
Instruction *Use) {
|
bool IsSigned, Instruction *Use) {
|
||||||
// Set the debug location and conservative insertion point.
|
// Set the debug location and conservative insertion point.
|
||||||
IRBuilder<> Builder(Use);
|
IRBuilder<> Builder(Use);
|
||||||
// Hoist the insertion point into loop preheaders as far as possible.
|
// Hoist the insertion point into loop preheaders as far as possible.
|
||||||
@ -967,14 +967,14 @@ Instruction *WidenIV::cloneBitwiseIVUser(NarrowIVDefUse DU) {
|
|||||||
// about the narrow operand yet so must insert a [sz]ext. It is probably loop
|
// about the narrow operand yet so must insert a [sz]ext. It is probably loop
|
||||||
// invariant and will be folded or hoisted. If it actually comes from a
|
// invariant and will be folded or hoisted. If it actually comes from a
|
||||||
// widened IV, it should be removed during a future call to widenIVUse.
|
// widened IV, it should be removed during a future call to widenIVUse.
|
||||||
Value *LHS =
|
Value *LHS = (NarrowUse->getOperand(0) == NarrowDef)
|
||||||
(NarrowUse->getOperand(0) == NarrowDef)
|
? WideDef
|
||||||
? WideDef
|
: createExtendInst(NarrowUse->getOperand(0), WideType,
|
||||||
: getExtend(NarrowUse->getOperand(0), WideType, IsSigned, NarrowUse);
|
IsSigned, NarrowUse);
|
||||||
Value *RHS =
|
Value *RHS = (NarrowUse->getOperand(1) == NarrowDef)
|
||||||
(NarrowUse->getOperand(1) == NarrowDef)
|
? WideDef
|
||||||
? WideDef
|
: createExtendInst(NarrowUse->getOperand(1), WideType,
|
||||||
: getExtend(NarrowUse->getOperand(1), WideType, IsSigned, NarrowUse);
|
IsSigned, NarrowUse);
|
||||||
|
|
||||||
auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
|
auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
|
||||||
auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
|
auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
|
||||||
@ -1065,12 +1065,12 @@ Instruction *WidenIV::cloneArithmeticIVUser(NarrowIVDefUse DU,
|
|||||||
|
|
||||||
Value *LHS = (NarrowUse->getOperand(0) == NarrowDef)
|
Value *LHS = (NarrowUse->getOperand(0) == NarrowDef)
|
||||||
? WideDef
|
? WideDef
|
||||||
: getExtend(NarrowUse->getOperand(0), WideType, SignExtend,
|
: createExtendInst(NarrowUse->getOperand(0), WideType,
|
||||||
NarrowUse);
|
SignExtend, NarrowUse);
|
||||||
Value *RHS = (NarrowUse->getOperand(1) == NarrowDef)
|
Value *RHS = (NarrowUse->getOperand(1) == NarrowDef)
|
||||||
? WideDef
|
? WideDef
|
||||||
: getExtend(NarrowUse->getOperand(1), WideType, SignExtend,
|
: createExtendInst(NarrowUse->getOperand(1), WideType,
|
||||||
NarrowUse);
|
SignExtend, NarrowUse);
|
||||||
|
|
||||||
auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
|
auto *NarrowBO = cast<BinaryOperator>(NarrowUse);
|
||||||
auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
|
auto *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS,
|
||||||
@ -1222,7 +1222,7 @@ bool WidenIV::widenLoopCompare(NarrowIVDefUse DU) {
|
|||||||
|
|
||||||
// Widen the other operand of the compare, if necessary.
|
// Widen the other operand of the compare, if necessary.
|
||||||
if (CastWidth < IVWidth) {
|
if (CastWidth < IVWidth) {
|
||||||
Value *ExtOp = getExtend(Op, WideType, Cmp->isSigned(), Cmp);
|
Value *ExtOp = createExtendInst(Op, WideType, Cmp->isSigned(), Cmp);
|
||||||
DU.NarrowUse->replaceUsesOfWith(Op, ExtOp);
|
DU.NarrowUse->replaceUsesOfWith(Op, ExtOp);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user