[llvm] Skip phi scans when folded block shares no predecessors (PR #225647)

Max Brandtner via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 02:07:37 PDT 2026


MaxBrandtner-IBM wrote:

Reproducer:
opt -passes=simplifycfg on the reproducer below:

  340.49s -> 6.90s

Reproduction steps:
```python
n=100000
print("int f(int);")
print("int test(void) {")
print("  int r;")
for i in range(n):
    print(f"  if ((r = f({i}))) return r;")
print("  return 0;")
print("}")
```

```sh
python genc.py >test.c
clang -O0 -Xclang -disable-O0-optnone -emit-llvm -c test.c -o test.bc
opt -passes=sroa -o test_sroa.bc ./test.bc
time setarch x86_64 -R $opt_old -passes=simplifycfg -disable-output test_sroa.bc
time setarch x86_64 -R $opt_new -passes=simplifycfg -disable-output test_sroa.bc
```


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


More information about the llvm-commits mailing list