Issue 150229
Summary [GVN] hits assertion "Cannot split critical edge from IndirectBrInst" in llvm::SplitKnownCriticalEdge
Labels new issue
Assignees
Reporter tetzank
    The gvn pass cannot handle the indirectbr instruction with more than one destination. It hits an assertion in llvm::SplitKnownCriticalEdge trying to add a "dead" block after the indirectbr.
The newgvn pass works fine.

Reproducer:
```llvm
define void @foo(i1 %cmp) {
first:
  br i1 %cmp, label %exit, label %second

second:
  br i1 %cmp, label %ibr, label %exit ; cmp must be false to reach this, branch to ibr never taken

ibr: ; this block is dead
 indirectbr ptr blockaddress(@foo, %exit), [label %exit, label %exit] ; double label required, works with just one

exit:
  ret void
}
```

`opt --passes=gvn -S minimal.ll`

Related Bug: https://github.com/llvm/llvm-project/issues/49237
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to