llvm-project/llvm/test/Transforms/SimpleLoopUnswitch
hyeongyu kim 0aeb37324d [SimpleLoopUnswitch] Re-fix introduction of UB when hoisted condition may be undef or poison
https://bugs.llvm.org/show_bug.cgi?id=27506
https://bugs.llvm.org/show_bug.cgi?id=31652
https://bugs.llvm.org/show_bug.cgi?id=51043

Problems with SimpleLoopUnswitch cause the bug reports above.

```
while (...) {
  if (C) { A }
  else   { B }
}
Into:

C' = freeze(C)
if (C') {
  while (...) { A }
} else {
  while (...) { B }
}
```
This problem can be solved by adding a freeze on hoisted branches(above transform) and has been solved by D29015.
However, D29015 is now reverted by performance regression(2b5a897651)

It is not the first time that an added freeze has caused performance regression.
SimplifyCFG also had a problem with UB caused by branching-on-undef, which was solved by adding freeze to the branching condition. (D104569)
Performance regression occurred in D104569, and patches such as D105344 and D105392 were written to minimize it.

This patch will correct the SimpleLoopUnswitch as D104569 handles the SimplyCFG while minimizing performance loss by introducing patches like D105344 and D105392(This patch was rebased with the author's permission)

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D106041
2021-10-12 01:02:09 +09:00
..
ARM
2006-06-13-SingleEntryPHI.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2006-06-27-DeadSwitchCase.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2007-05-09-Unreachable.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2007-05-09-tl.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2007-07-12-ExitDomInfo.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2007-07-13-DomInfo.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2007-07-18-DomInfo.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2007-08-01-Dom.ll
2007-08-01-LCSSA.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2007-10-04-DomFrontier.ll
2008-06-02-DomInfo.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2008-06-17-DomFrontier.ll
2010-11-18-LCSSA.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2011-06-02-CritSwitch.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2011-09-26-EHCrash.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2012-04-02-IndirectBr.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2012-04-30-LoopUnswitch-LPad-Crash.ll
2012-05-20-Phi.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
2015-09-18-Addrspace.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
LIV-loop-condtion.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
basictest-profmd.ll
basictest.ll
catchswitch.ll [SimpleLoopUnswitch] Don't non-trivially unswitch loops with catchswitch exits 2021-07-14 14:07:28 -07:00
cleanuppad.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
copy-metadata.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
crash.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
dead-blocks-uses-in-unreachablel-blocks.ll
delete-dead-blocks.ll
endless-unswitch.ll
exponential-behavior.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
exponential-nontrivial-unswitch-nested.ll
exponential-nontrivial-unswitch-nested2.ll
exponential-nontrivial-unswitch.ll
exponential-nontrivial-unswitch2.ll
exponential-switch-unswitch.ll
formDedicatedAfterTrivial1.ll
formDedicatedAfterTrivial2.ll
formDedicatedAfterTrivial3.ll
guards.ll
implicit-null-checks.ll
infinite-loop.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
msan.ll
nontrivial-unswitch-cost.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
nontrivial-unswitch-freeze.ll [SimpleLoopUnswitch] Re-fix introduction of UB when hoisted condition may be undef or poison 2021-10-12 01:02:09 +09:00
nontrivial-unswitch-invariant-select-bug.ll [SimpleLoopUnswitch] Don't unswitch constant conditions 2021-10-01 21:30:54 +00:00
nontrivial-unswitch-markloopasdeleted.ll [SimpleLoopUnswitch] Inform pass manager when child loops are deleted 2021-09-04 17:54:39 +02:00
nontrivial-unswitch-redundant-switch.ll
nontrivial-unswitch.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
not-safe-to-clone.ll
options.ll
partial-unswitch-mssa-threshold.ll
partial-unswitch-update-memoryssa.ll
partial-unswitch.ll
pipeline.ll
pr37888.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
preserve-analyses.ll [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
preserve-scev-exiting-multiple-loops.ll
trivial-unswitch-iteration.ll
trivial-unswitch-profmd.ll
trivial-unswitch.ll
update-scev.ll