[llvm] [VPlan] Don't use the legacy cost model for loop conditions (PR #156864)

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 07:37:20 PST 2026


john-brawn-arm wrote:

> thanks for the altet update, checked the latest verison, but I think we still effectively always disable the assertion now, because the original exiting condition will get removed and then we won't find a recipe matching the compare, which so planContainsAdditionalSimplification will always return true

Yes, checking the tests in llvm/test/Transforms/LoopVectorize/ in almost all of the cases where we call planContainsAdditionalSimplification it returns true (only returns false in 5 of 4191 cases).

After thinking about this a bit I think maybe the way to resolve this is to make the current loop condition be set as the underlying value of the BranchOnCount, as then it will end up in SeenInstrs and won't be counted as a simplification. I have a prototype for this that seems to work, I'll push it for review soon.

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


More information about the llvm-commits mailing list