Skip to content

Commit

Permalink
[SCEV] Remove zext/sext from BuildConstantForSCEV
Browse files Browse the repository at this point in the history
In preparation for removing these constant expressions.
  • Loading branch information
nikic committed Sep 28, 2023
1 parent 6dd8ec6 commit c887700
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions llvm/lib/Analysis/ScalarEvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9666,18 +9666,6 @@ static Constant *BuildConstantFromSCEV(const SCEV *V) {
return cast<SCEVConstant>(V)->getValue();
case scUnknown:
return dyn_cast<Constant>(cast<SCEVUnknown>(V)->getValue());
case scSignExtend: {
const SCEVSignExtendExpr *SS = cast<SCEVSignExtendExpr>(V);
if (Constant *CastOp = BuildConstantFromSCEV(SS->getOperand()))
return ConstantExpr::getSExt(CastOp, SS->getType());
return nullptr;
}
case scZeroExtend: {
const SCEVZeroExtendExpr *SZ = cast<SCEVZeroExtendExpr>(V);
if (Constant *CastOp = BuildConstantFromSCEV(SZ->getOperand()))
return ConstantExpr::getZExt(CastOp, SZ->getType());
return nullptr;
}
case scPtrToInt: {
const SCEVPtrToIntExpr *P2I = cast<SCEVPtrToIntExpr>(V);
if (Constant *CastOp = BuildConstantFromSCEV(P2I->getOperand()))
Expand Down Expand Up @@ -9727,13 +9715,15 @@ static Constant *BuildConstantFromSCEV(const SCEV *V) {
}
return C;
}
case scSignExtend:
case scZeroExtend:
case scUDivExpr:
case scSMaxExpr:
case scUMaxExpr:
case scSMinExpr:
case scUMinExpr:
case scSequentialUMinExpr:
return nullptr; // TODO: smax, umax, smin, umax, umin_seq.
return nullptr;
}
llvm_unreachable("Unknown SCEV kind!");
}
Expand Down

0 comments on commit c887700

Please sign in to comment.