[all-commits] [llvm/llvm-project] ef93f7: [SimplifyCFG] FoldBranchToCommonDest: gracefully h...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Mon Dec 28 12:32:09 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ef93f7a11c347534ac768ec8bbbed64cd20c41d2
      https://github.com/llvm/llvm-project/commit/ef93f7a11c347534ac768ec8bbbed64cd20c41d2
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-28 (Mon, 28 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll

  Log Message:
  -----------
  [SimplifyCFG] FoldBranchToCommonDest: gracefully handle unreachable code ()

We might be dealing with an unreachable code,
so the bonus instruction we clone might be self-referencing.

There is a sanity check that all uses of bonus instructions
that are not in the original block with said bonus instructions
are PHI nodes, and that is obviously not the case
for self-referencing instructions..

So if we find such an use, just rewrite it.

Thanks to Mikael Holmén for the reproducer!

Fixes https://bugs.llvm.org/show_bug.cgi?id=48450#c8




More information about the All-commits mailing list