[PATCH] D114766: If constrained intrinsic is replaced, remove its side effect
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 30 08:40:15 PST 2021
sepavloff added a comment.
In D114766#3161692 <https://reviews.llvm.org/D114766#3161692>, @nikic wrote:
> In D114766#3161680 <https://reviews.llvm.org/D114766#3161680>, @sepavloff wrote:
>
>> In D114766#3160877 <https://reviews.llvm.org/D114766#3160877>, @nikic wrote:
>>
>>> This is likely not going to be particularly useful, as the InstSimplifyPass is not really used outside of testing. To be generally applicable, this logic would have to be in wouldInstructionBeTriviallyDead().
>>
>> Why? This pass is run when clang is executed. [...]
>
> Yes, because we do happen to have a single InstSimplifyPass run at the very end of the pipeline (in https://github.com/llvm/llvm-project/blob/98dbcff19cfedb4e27d267310a76d616cd435447/llvm/lib/Passes/PassBuilderPipelines.cpp#L1194). However, mostly InstSimplify is only used as an analysis, with the most important consumer being InstCombine, which uses InstSimplify (the analysis, not the pass) and runs many times during the optimization pipeline. So while your code is indeed getting optimized, it is optimized very late, and you would likely see phase-ordering issues in a more practical example.
Probably the pass should run earlier, it is hard to reason without analyzing practical cases. If it is indeed so, we could move the pass or run it several times. Tuning pipeline is not unique for constant folding only. But without ability to remove instructions many optimizations do not make sense.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114766/new/
https://reviews.llvm.org/D114766
More information about the llvm-commits
mailing list