diff options
author | Yingwei Zheng <dtcxzyw2333@gmail.com> | 2024-09-04 13:36:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 13:36:32 +0800 |
commit | c94bd96c277e0b48e198fdc831bb576d9a04aced (patch) | |
tree | fce89e8ad0d72ad8d922a8658501c9bde751b631 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 6c607cfb2c2d8acd2b92d7ed8106ab1e4fc0d79d (diff) | |
download | llvm-c94bd96c277e0b48e198fdc831bb576d9a04aced.zip llvm-c94bd96c277e0b48e198fdc831bb576d9a04aced.tar.gz llvm-c94bd96c277e0b48e198fdc831bb576d9a04aced.tar.bz2 |
[Clang][CodeGen] Don't emit assumptions if current block is unreachable. (#106936)
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:
https://github.com/llvm/llvm-project/blob/837ee5b46a5f7f898f0de7e46a19600b896a0a1f/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:
https://github.com/llvm/llvm-project/blob/837ee5b46a5f7f898f0de7e46a19600b896a0a1f/clang/lib/CodeGen/CGExprScalar.cpp#L416-L420
Even if we disabled this optimization, it still crashes in
`Builder.CreateAssumption`:
https://github.com/llvm/llvm-project/blob/837ee5b46a5f7f898f0de7e46a19600b896a0a1f/llvm/lib/IR/IRBuilder.cpp#L551-L561
This patch disables assumptions emission if current block is null.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions