[llvm] [LV][VPlan] Implement VPlan-based cost for exit condition. (PR #125640)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 22:14:49 PDT 2025


ElvisWang123 wrote:

Rebased and ping!

Summary of VF changes for different benchmarks.

| benchmark  | reason  |
|---|---|
| AArch64/conditional-branches-cost.ll |  The cost of the `uitofp` with <vscale x 2 x i8> (cost = 1)  is lower than < 2 x i8> (cost = 4). So the LV will choose `<vscale x 2 x i8>`. @david-arm @davemgreen  Just wondering why the cost is different for same width?   | 
| X86/constant-fold.ll  |  Max TC = 3 make VF 2, 4 still need scalar epilogue which is not profitable.  | 
| X86/fixed-order-recurrence.ll |  MAX TC = 9. | 
| X86/induction-costs.ll | TC = 8 |
| X86/multi-exit-cost.l  | TC = 31, this make VF = 16 needs 15 iteration of scalar epilogue.|
| X86/optsize.ll  | Optimize for code size |
| X86/pr81872.ll | TC = 9 |
| X86/predicate-switch.ll | Extra cost of the `icmp` make this loop not vectorized. But this test will still not  be vectorized when implementing the cost of VPInstruction w/o underlying value. |
| X86/scev-checks-unprofitable.ll | TC = 7 |

Possible solutions.

-  If the test is created for some optimization or functional coverage. It's probably better to force vectorize or setting the vector-width to make sure the test always be vectorized.
- Increase the small ( not power-of-2 friendly) trip count to large trip count.

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


More information about the llvm-commits mailing list