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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 01:13:39 PDT 2024


nikic 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:
```

Top 5 improvements:
  cvc5/kind.cpp.ll 600352836 -> 215689291 -64.07%
  php/parse_date.ll 46278212535 -> 21177805250 -54.24%
  llvm/X86EncodingOptimization.cpp.ll 908626738 -> 436539081 -51.96%
  llvm/TokenKinds.cpp.ll 319626734 -> 156038687 -51.18%
  libquic/net_errors.cc.ll 234434780 -> 126031135 -46.24%
Top 5 regressions:
  php/pcre2_match.ll 10618116865 -> 997582429963 +9295.10%
  llvm/X86FixupInstTuning.cpp.ll 1011415693 -> 1822547362 +80.20%
  tokenizers-rs/4hn9gefsll13qr1r.ll 18284264366 -> 28850854248 +57.79%
  cpython/socketmodule.ll 1538073290 -> 1868852500 +21.51%
  openusd/write.c.ll 1139618620 -> 1299783905 +14.05%
```

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


More information about the llvm-commits mailing list