[llvm] [VPlan] Also duplicated scalar-steps when it enables sinking scalars. (PR #136021)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 10:53:16 PDT 2025


================
@@ -735,7 +737,8 @@ define void @cost_duplicate_recipe_for_sinking(ptr %A, i64 %N) #2 {
 ; CHECK-NEXT:    [[TMP68:%.*]] = extractelement <4 x i1> [[TMP22]], i32 0
 ; CHECK-NEXT:    br i1 [[TMP68]], label [[PRED_STORE_IF30:%.*]], label [[PRED_STORE_CONTINUE31:%.*]]
 ; CHECK:       pred.store.if30:
-; CHECK-NEXT:    [[TMP69:%.*]] = shl nsw i64 [[TMP6]], 2
+; CHECK-NEXT:    [[TMP108:%.*]] = add i64 [[INDEX]], 12
+; CHECK-NEXT:    [[TMP69:%.*]] = shl nsw i64 [[TMP108]], 2
----------------
fhahn wrote:

Yes, now we also sink for all lanes due to duplicating (VF = 4, IC = 4); `add i64 [[INDEX]], {4, 8, 12}` is also done in the loop header (start of each unrolled part), used by the GEPs for the wide loads, so won't be sunk be original sinkScalarOperands.





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


More information about the llvm-commits mailing list