[PATCH] D87149: [InstCombine] erase instructions leading up to unreachable
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 09:44:54 PDT 2020
jdoerfert added a comment.
In D87149#2263725 <https://reviews.llvm.org/D87149#2263725>, @lebedev.ri wrote:
> In D87149#2263708 <https://reviews.llvm.org/D87149#2263708>, @nikic wrote:
>
>> @lebedev.ri I don't think the printf() case is any different. Keep in mind that undefined behavior acts retroactively, so if we know that unreachable will be executed later, we are free to optimize away side-effects before it as well. (If printf is not considered willreturn, then we cannot optimize it away, and won't.)
>
> IOW you are saying that in https://godbolt.org/z/TEo6oj `tail call void @_Z5errorv()` should ideally be optimized out?
If `_Z5errorv` was `willreturn` and `nounwind`, yes. Otherwise, no. Basically, if `isGuaranteedToTransferExecutionToSuccessor` given the call returns true.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87149/new/
https://reviews.llvm.org/D87149
More information about the llvm-commits
mailing list