[all-commits] [llvm/llvm-project] 697fcd: [SimplifyCFG] Handle `llvm.assume` in `passingValu...
Yingwei Zheng via All-commits
all-commits at lists.llvm.org
Thu Apr 25 05:48:17 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 697fcd009855a579f756dfe34498a815ed9dc3fd
https://github.com/llvm/llvm-project/commit/697fcd009855a579f756dfe34498a815ed9dc3fd
Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: 2024-04-25 (Thu, 25 Apr 2024)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
M llvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
Log Message:
-----------
[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 :)
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list