[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
Wed Oct 22 02:56:09 PDT 2025


================
@@ -64,10 +62,8 @@ loop:
   %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
   %gep.b = getelementptr inbounds [2048 x i32], ptr @b, i32 0, i32 %iv
   %lv.b  = load i32, ptr %gep.b, align 4
-  %add = add i32 %lv.b, 10
-  %mul = mul i32 2, %add
----------------
lukel97 wrote:

I think this is supposed to be testing that replicate regions are merged? https://github.com/llvm/llvm-project/pull/160449#discussion_r2397523127

Because the add and mul are no longer replicated because there's no predication discount, we now end up with

```
REPLICATE load
WIDE add
WIDE mul
REPLICATE store
```

So I had to remove the add and the mul so the load and store replicate regions would be together, which allows them to be merged.

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


More information about the llvm-commits mailing list