Fixes https://github.com/llvm/llvm-project/issues/106898. When emitting an infinite loop, clang codegen will delete the whole block and leave builder's current block as nullptr:837ee5b46a/clang/lib/CodeGen/CGStmt.cpp (L597-L600)Then clang will create `zext (icmp slt %a, %b)` without parent block for `a < b`. It will crash here:837ee5b46a/clang/lib/CodeGen/CGExprScalar.cpp (L416-L420)Even if we disabled this optimization, it still crashes in `Builder.CreateAssumption`:837ee5b46a/llvm/lib/IR/IRBuilder.cpp (L551-L561)This patch disables assumptions emission if current block is null.
121 KiB
121 KiB