[llvm] [SimplifyCFG] Add predecessor threshold for TryToSimplifyUncondBranchFromEmptyBlock optimization. (PR #110715)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 01:18:52 PDT 2024


dtcxzyw wrote:

> Could you please explain in more detail where the compile-time issue comes from? Just many predecessors is not a problem by itself, something must be causing quadratic complexity if this is an issue.
> 
> 128 is really not particularly high in this context, that's something you'll easily see with a large switch statement.
> 
> llvm-opt-benchmark results indicate that this does improve compile-time in some cases, but it also makes it _much_ worse in others:

Reproduced locally.
Before:
```
time bin/opt -O3 ../../llvm-opt-benchmark/bench/php/original/pcre2_match.ll -disable-output

real    0m1.499s
user    0m1.479s
sys     0m0.019s
```
After:
```
time bin/opt -O3 ../../llvm-opt-benchmark/bench/php/original/pcre2_match.ll -disable-output

real    0m37.475s
user    0m37.451s
sys     0m0.021s
```

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


More information about the llvm-commits mailing list