| Issue |
165179
|
| Summary |
Missed optimization: failure to remove dead edge
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
kevina
|
From discord discussion: https://discourse.llvm.org/t/missed-optimization-due-to-overflow-check/88700
Godbolt link: https://godbolt.org/z/xqW3rcnKd.
Relevant IR code.
```llvm
_ZN4FracC2Eii.exit.i:
%0 = phi i32 [ 1, %if.else.i.i ], [ -1, %if.end10.i.i ]
...
lor.lhs.false.i:
switch i32 %0, label %if.end.i [
i32 1, label %_ZN7ReducedC2Eii.exit
i32 -1, label %_ZN7ReducedC2Eii.exit
]
if.end.i:
call void @Reduced::reduce_in_place()(ptr noundef nonnull align 4 dereferenceable(8) %retval)
br label %_ZN7ReducedC2Eii.exit
_ZN7ReducedC2Eii.exit:
%1 = load i64, ptr %retval, align 8
ret i64 %1
}
```
>From `%0 = phi i32 [ 1, %if.else.i.i ], [ -1, %if.end10.i.i ]` it should be obvious that `%0` can only be 1 or -1 yet LLVM doesn't see it and fails to remove the dead edge.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs