[llvm] [IPSCCP] Do not attempt `tryToReplaceWithConstant` if may break invariants (PR #102820)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 00:49:20 PDT 2024
nikic wrote:
> > It's even more obvious when you consider that the returned constant may just be a constant integer/float rather than a global. That can open up all kinds of optimizations, and is also something where rematerialization is more likely to be profitable.
>
> Makes sense. Could reverting the constant replacement be an option, once DCE and friends have used SCCP results and have run, and we know materializing the constant turned out to be not profitable (as it is the case in #102791)? So, possibly somewhere in SelectionDAG?
At least in principle, yes, we could do that. It may be easier to handle in CGP rather than SDAG, esp. for cross-block cases.
https://github.com/llvm/llvm-project/pull/102820
More information about the llvm-commits
mailing list