[llvm] [SimplifyCFG] Don't perform "redirecting phis between unmergeable BBs and successor BB" optimization when not using jump tables. (PR #160560)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 10:52:39 PDT 2025


aemerson wrote:

> 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.

Right, sorry I should have made it clearer that the size issue isn't demonstrated by the test case, that was just trying to ensure that the general transform doesn't happen without jump tables.

I've got a reduced test case that shows a significant (7%+) size difference when compiling with and without this change. I'm attaching the interestingness script used to reduce this down.
[interestingness.sh](https://github.com/user-attachments/files/22565800/interestingness.sh)

GitHub won't let me attach IR so I've put it here: https://godbolt.org/z/7baoK9j1a

Compiling that with:
```
clang -c -arch armv6m -ffreestanding -static -fstack-protector -fno-PIC -Oz -nostdlibinc -ffreestanding -fomit-frame-pointer -mllvm -inline-threshold=10 -fno-jump-tables input.ll
```
should show the issue.


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


More information about the llvm-commits mailing list