[all-commits] [llvm/llvm-project] 602ab2: [SimplifyCFG] avoid crash on degenerate loop

RotateRight via All-commits all-commits at lists.llvm.org
Fri Jun 11 06:45:08 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 602ab248335e1540e82667e74fea44b7f042e112
      https://github.com/llvm/llvm-project/commit/602ab248335e1540e82667e74fea44b7f042e112
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-06-11 (Fri, 11 Jun 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll

  Log Message:
  -----------
  [SimplifyCFG] avoid crash on degenerate loop

The problematic code pattern in the test is based on:
https://llvm.org/PR50638

If the IfCond is itself the phi that we are trying to remove,
then the loop around line 2835 can end up with something like:
%cmp = select i1 %cmp, i1 false, i1 true

That can then lead to a use-after-free and assert (although
I'm still not seeing that locally in my release + asserts build).

I think this can only happen with unreachable code.

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




More information about the All-commits mailing list