[llvm] [SimplifyCFG] Don't perform "redirecting phis between unmergeable BBs and successor BB" optimization when not using jump tables. (PR #160560)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 24 10:17:59 PDT 2025
nikic wrote:
> This optimization works well for most cases but implicitly assumes that the backend will be able to generate jump tables (see "And lookup table optimization should convert it into add %arg 1." in PR #67275 description).
>
> When -fno-jump-tables is used however this regresses code size, which is especially painful in targets like armv7 where there's already high register pressure.
I'm not really clear about what no-jump-tables has to do with this transform. The specific example from #67275 does benefit from a switch to arithmetic conversion -- which, since recently, is not actually affected by `"no-jump-tables"` anymore (see https://llvm.godbolt.org/z/s7GrWxGnn for it being applied to that example in the presence of `"no-jump-tables"`).
I also checked the codegen for you test case with and without this transform on armv7, and it seems to be the same: https://llvm.godbolt.org/z/673dbfGKs This particular example doesn't even generate a code structure where jump tables would be relevant.
https://github.com/llvm/llvm-project/pull/160560
More information about the llvm-commits
mailing list