[PATCH] D127712: Prevent crash when TurnSwitchRangeIntoICmp receives default unreachable destination
Samuel Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 01:06:40 PDT 2022
swamulism added inline comments.
================
Comment at: llvm/test/Transforms/SimplifyCFG/switch-default-undef.ll:9
+define void @0(i8 %sw, i32* %p0) {
+ switch i8 %sw, label %group3 [
+ i8 0, label %group1
----------------
hans wrote:
> In this switch, the default destination doesn't look unreachable. Is it made unreachable by some other transformation that happens before TurnSwitchRangeIntoICmp()? Can you make the test show the input that TurnSwitchRangeIntoICmp operates on directly?
It is made unreachable by some other transformation.
Using the IR when the crash occurs in `TurnSwitchRangeIntoICmp()` as an input actually doesn't cause a crash (I assume it gets optimized out before we get here).
So, I guess there is some other combination of transformations that causes `TurnSwitchRangeIntoICmp()` to get a switch looking like this:
```
switch i8 %sw, label %unreachable [
i8 10, label %group2
i8 9, label %group2
]
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127712/new/
https://reviews.llvm.org/D127712
More information about the llvm-commits
mailing list