[llvm] [LICM] Promote conditional, loop-invariant memory accesses to scalars with intrinsic (PR #93999)
Ivan Shumakov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 27 07:22:39 PDT 2024
ii-sc wrote:
@preames @nikic Sorry for the delay. I have been fixing some issues with this patch. I am about to add commits, that make this optimization correct. (now there are some troubles with memory SSA metadata)
> Mostly though I'm not really convinced that we want to do this transform at all, at least not as an unconditional canonicalization transform.
I think that the best conditions for the current optimization are O3 optimization level or explicit `licm-conditional-access-promotion` option. In this case user might decide whether loops in his code are hot enough. (this will be a part of the upcoming commit)
Probably, one of the reasons why there is an intrinsic instead of CF change in the LICM is the fact that this will require numerous changes in the LICM code and I am not sure that it will not cause some bugs. New intrinsic is a good option because it introduces new way of solving such issues. In my opinion combination of conditional and masked stores convey intentions of the programmer better than only masked store, because, for example, usage of the vector intrinsic in the non-vector code might confuse other developers(and, perhaps, some optimizations).
The fact that the current intrinsic is lowered immediately after the LICM might be changed in the future when it will be used in the other optimizations.
https://github.com/llvm/llvm-project/pull/93999
More information about the llvm-commits
mailing list