[llvm] [VPlan] Introduce VPlan-level constant folder (PR #125365)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 13:05:17 PDT 2025


================
@@ -563,29 +563,24 @@ define void @pr70590_recipe_without_underlying_instr(i64 %n, ptr noalias %dst) {
 ; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x i1> [[TMP2]], i32 0
 ; CHECK-NEXT:    br i1 [[TMP3]], label [[PRED_SREM_IF:%.*]], label [[PRED_SREM_CONTINUE:%.*]]
 ; CHECK:       pred.srem.if:
-; CHECK-NEXT:    [[TMP4:%.*]] = srem i64 3, 0
 ; CHECK-NEXT:    br label [[PRED_SREM_CONTINUE]]
 ; CHECK:       pred.srem.continue:
-; CHECK-NEXT:    [[TMP5:%.*]] = phi i64 [ poison, %vector.body ], [ [[TMP4]], [[PRED_SREM_IF]] ]
----------------
fhahn wrote:

Can we have a variant of the test where we don't just use the first lane of the simplified replicate recipe, e.g. storing the result outside the replicate region?

Would also be good to have a case where we don't fold to poison, but I am not sure if that's possible.

In that case, could we constant-fold `VPPredPhi poison -> poison`?

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


More information about the llvm-commits mailing list