[llvm] [VPlan] Don't apply predication discount to non-originally-predicated blocks (PR #160449)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 03:17:27 PST 2025


================
@@ -49,6 +49,8 @@ define void @sink_replicate_region_1(i32 %x, ptr %ptr, ptr noalias %dst) optsize
 ; CHECK-NEXT: loop.0:
 ; CHECK-NEXT:   WIDEN-CAST ir<%conv> = sext vp<[[PRED1]]> to i32
 ; CHECK-NEXT:   EMIT vp<[[SPLICE:%.+]]> = first-order splice ir<%0>, ir<%conv>
+; CHECK-NEXT:   WIDEN ir<%rem> = srem vp<[[SPLICE]]>, ir<%x>
+; CHECK-NEXT:   WIDEN ir<%add> = add ir<%conv>, ir<%rem>
----------------
lukel97 wrote:

IIUC when this test was first written in https://reviews.llvm.org/D100751 sinking operated directly on regions. But now it happens in `sinkRecurrenceUsersAfterPrevious` which is called before optimization, so before `createAndOptimizeReplicateRegions`. 

So I don't think we're sinking replicate regions directly anymore, so I'm not sure if this is still testing the original "; Test cases for PR50009, which require sinking a replicate region due to a first-order recurrence." comment

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


More information about the llvm-commits mailing list