[llvm-bugs] [Bug 52383] New: LowerSwitch should remove all dead blocks introduced by switch processing
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Nov 2 19:32:54 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52383
Bug ID: 52383
Summary: LowerSwitch should remove all dead blocks introduced
by switch processing
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Transformation Utilities
Assignee: unassignedbugs at nondot.org
Reporter: yilong.guo at intel.com
CC: llvm-bugs at lists.llvm.org
Consider the following ll:
```
define i32 @f(i32 %c) {
chk65:
%cmp = icmp sgt i32 %c, 65
br i1 %cmp, label %return, label %chk0
chk0:
%cmp1 = icmp slt i32 %c, 0
br i1 %cmp, label %return, label %bb_if
bb_if:
%ashr.val = ashr exact i32 %c, 2
%cmp2 = icmp sgt i32 %ashr.val, 14
br i1 %cmp2, label %bb_switch, label %return
bb_switch:
; %ashr.val must be 15 or 16 here (analyzed by LazyValueInfo)
switch i32 %ashr.val, label %out_of_switch_range [
i32 15, label %return
i32 16, label %another_ret
]
; unreachable default case
out_of_switch_range:
br label %successor_of_unreachable
; unreachable successors
successor_of_unreachable:
br label %return
another_ret:
br label %return
return:
%retval = phi i32 [-1, %chk0], [-1, %chk65], [-1, %bb_if], [42, %bb_switch],
[42, %another_ret], [-42, %successor_of_unreachable]
ret i32 %retval
}
```
Both "out_of_switch_range" and "successor_of_unreachable" should be deleted as
they become dead after switch lowering.
But LowerSwitch only deletes the "out_of_switch_range" -- it didn't delete dead
block's dominatees which also become unreachable.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211103/9b93b4d6/attachment.html>
More information about the llvm-bugs
mailing list