[llvm] [VPlan] Also expand integer SCEVAddExpr in expandSCEVExpr. (PR #200925)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 12:54:42 PDT 2026


================
@@ -938,21 +940,25 @@ VPValue *VPSCEVExpander::tryToExpand(const SCEV *S) {
     return Builder.getPlan().getOrAddLiveIn(cast<SCEVUnknown>(S)->getValue());
   case scVScale:
     return Builder.createNaryOp(VPInstruction::VScale, {}, S->getType());
+  case scAddExpr:
   case scMulExpr: {
-    auto *Mul = cast<SCEVMulExpr>(S);
+    if (S->getType()->isPointerTy())
+      return nullptr;
+    auto *NAry = cast<SCEVNAryExpr>(S);
+    unsigned Opcode =
+        isa<SCEVAddExpr>(NAry) ? Instruction::Add : Instruction::Mul;
     SmallVector<VPValue *, 2> Ops;
-    for (const SCEVUse &Op : Mul->operands()) {
+    for (const SCEVUse &Op : reverse(NAry->operands())) {
----------------
artagnon wrote:

Why the new reverse?

https://github.com/llvm/llvm-project/pull/200925


More information about the llvm-commits mailing list