[all-commits] [llvm/llvm-project] 733740: Fix a phase-ordering problem in SimplifyCFG.

Owen Anderson via All-commits all-commits at lists.llvm.org
Wed Jan 4 15:47:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 733740b18936364f20d9858e3a6f08855ec66b8b
      https://github.com/llvm/llvm-project/commit/733740b18936364f20d9858e3a6f08855ec66b8b
  Author: Owen Anderson <resistor at mac.com>
  Date:   2023-01-04 (Wed, 04 Jan 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/Local.cpp
    A llvm/test/Transforms/SimplifyCFG/switch-simplify-crash2.ll

  Log Message:
  -----------
  Fix a phase-ordering problem in SimplifyCFG.

Switch simplification could sometimes fail to notice when an
intermediate case removal caused the switch condition to become
constant. This would cause the switch to be simplified into a
conditional branch rather than a direct branch.

Most of the time this didn't matter, except that occasionally
downstream parts of SimplifyCFG expect tautological branches to
already have been eliminated. The missed handling in switch
simplification would cause an assertion failure in the downstream
code.

Triggering the assertion failure is fairly sensitive to the exact
order of various simplifications.

Fixes https://github.com/llvm/llvm-project/issues/59768

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D140831




More information about the All-commits mailing list