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

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 02:24:40 PDT 2026


hesam-oxe wrote:

@topperc Regarding the test — the original test case from @iamanonymouscs 
in #201252 reproduces the crash. The fix passes the existing LLVM test 
suite (`ninja check-llvm-codegen-riscv`). 

Should I add a dedicated regression test in `llvm/test/CodeGen/RISCV/` 
with the asm goto reproducer?

Regarding the block — it comes into CodeGenPrepare without a terminator 
because the asm goto handling in the frontend creates blocks that haven't 
had terminators inserted yet. It does eventually become well-formed in 
a later pass. The early return is safe because GEP unmerging across 
indirect branches is not meaningful.

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


More information about the llvm-commits mailing list