[SCEVExpander] Avoid ConstantExpr::get() (NFCI)

Use ConstantFoldBinaryOpOperands() instead. This will be important
when not all binops have constant expression variants.
This commit is contained in:
Nikita Popov 2022-07-04 14:56:23 +02:00
parent 3912928aa8
commit 32a76fc292

View file

@ -220,7 +220,8 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode,
// Fold a binop with constant operands.
if (Constant *CLHS = dyn_cast<Constant>(LHS))
if (Constant *CRHS = dyn_cast<Constant>(RHS))
return ConstantExpr::get(Opcode, CLHS, CRHS);
if (Constant *Res = ConstantFoldBinaryOpOperands(Opcode, CLHS, CRHS, DL))
return Res;
// Do a quick scan to see if we have this binop nearby. If so, reuse it.
unsigned ScanLimit = 6;