[llvm] [SimplifyCFG] Handle trunc condition in foldBranchToCommonDest. (PR #135490)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 13 12:04:42 PDT 2025


nikic wrote:

> So shall I revert it? do I understand correct that it is not the optimization that is slow but it generates a slower binary

Yes, it generates a slower binary, at least in terms of instructions retired. I think part of the problem here may be that a lot of targets seem to treat all truncates as free? https://llvm.godbolt.org/z/49Tq8qEqe So they don't count towards the bonus inst threshold. A trunc i1 without nuw should have the same cost as an and 1, I think.

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


More information about the llvm-commits mailing list