[llvm] [CodeGenPrepare] Fix crash in tryUnmergingGEPsAcrossIndirectBr with asm goto (PR #201443)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 02:27:01 PDT 2026


hesam-oxe wrote:

@topperc Added a regression test in `llvm/test/CodeGen/RISCV/asm-goto-cgp-crash.ll`.

The test uses the original reproducer pattern from #201252 — a `callbr` 
with `asm goto` that creates an indirect branch. Without the fix, this 
crashes in `tryUnmergingGEPsAcrossIndirectBr` with the assertion failure. 
With the fix, it compiles successfully.

Regarding your question about the block: it comes into CodeGenPrepare 
without a terminator because asm goto blocks are created by the frontend 
before terminators are inserted. The block becomes well-formed in a 
later pass. The early return is safe — GEP unmerging across indirect 
branches is not meaningful.

https://github.com/llvm/llvm-project/pull/201443


More information about the llvm-commits mailing list