diff options
author | Yingwei Zheng <dtcxzyw2333@gmail.com> | 2024-04-25 20:47:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 20:47:56 +0800 |
commit | 697fcd009855a579f756dfe34498a815ed9dc3fd (patch) | |
tree | d138cf9674730712cf67ade502169f37b4be7847 /clang/lib/Basic/Module.cpp | |
parent | ee7365198c5575337cfcbf3cb0a0c6689dd703f5 (diff) | |
download | llvm-697fcd009855a579f756dfe34498a815ed9dc3fd.zip llvm-697fcd009855a579f756dfe34498a815ed9dc3fd.tar.gz llvm-697fcd009855a579f756dfe34498a815ed9dc3fd.tar.bz2 |
[SimplifyCFG] Handle `llvm.assume` in `passingValueIsAlwaysUndefined` (#89929)
See the following example:
```
define i32 @test(i32 %cond) {
entry:
switch i32 %cond, label %default [
i32 0, label %case0
i32 1, label %case1
i32 2, label %case2
]
case0:
br label %exit
case1:
br label %exit
case2:
br label %exit
default:
br label %exit
exit:
%bool = phi i1 [ false, %default ], [ true, %case0 ], [ true, %case1 ], [ true, %case2 ]
%res = phi i32 [ 0, %default ], [ 1, %case0 ], [ 2, %case1 ], [ 3, %case2 ]
call void @llvm.assume(i1 %bool)
ret i32 %res
}
```
The edge `%default -> %bool` is dead since it will trigger an immediate
UB.
Alive2: https://alive2.llvm.org/ce/z/gywJiE
My benchmark shows many rust applications and some c/c++ applications
(e.g., arrow/php/qemu) will benefit from this patch :)
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
0 files changed, 0 insertions, 0 deletions