[llvm] [VPlan] Introduces explicit broadcast for live-in constants. (PR #133213)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 23:10:54 PDT 2025


================
@@ -1967,7 +1968,8 @@ define i32 @anyof_fcmp(ptr %a, i64 %n, i32 %start, i32 %inv) {
 ; IF-EVL-NEXT:    [[TMP13:%.*]] = getelementptr inbounds float, ptr [[TMP12]], i32 0
 ; IF-EVL-NEXT:    [[VP_OP_LOAD:%.*]] = call <vscale x 4 x float> @llvm.vp.load.nxv4f32.p0(ptr align 4 [[TMP13]], <vscale x 4 x i1> splat (i1 true), i32 [[TMP10]])
 ; IF-EVL-NEXT:    [[TMP14:%.*]] = fcmp fast olt <vscale x 4 x float> [[VP_OP_LOAD]], splat (float 3.000000e+00)
-; IF-EVL-NEXT:    [[TMP16]] = call <vscale x 4 x i1> @llvm.vp.merge.nxv4i1(<vscale x 4 x i1> [[TMP14]], <vscale x 4 x i1> splat (i1 true), <vscale x 4 x i1> [[VEC_PHI]], i32 [[TMP10]])
+; IF-EVL-NEXT:    [[TMP15:%.*]] = or <vscale x 4 x i1> [[VEC_PHI]], [[TMP14]]
+; IF-EVL-NEXT:    [[TMP16]] = call <vscale x 4 x i1> @llvm.vp.merge.nxv4i1(<vscale x 4 x i1> splat (i1 true), <vscale x 4 x i1> [[TMP15]], <vscale x 4 x i1> [[VEC_PHI]], i32 [[TMP10]])
----------------
ElvisWang123 wrote:

This is caused by the vplan optimize cannot recognize the pattern of `vp.merge true, (or x, y), x -> vp.merge y, true, x` (introduced in #135017).  Because it became `vp.merge (broadcast true) ...`.

Perhaps split off a patch that make `m_True()` recognize `broadcast True` ? ([b31efdd](https://github.com/llvm/llvm-project/pull/133213/commits/b31efdd4194e8b478a764ef679fe31c8a9533fe1))

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


More information about the llvm-commits mailing list