[llvm] [MachineLICM] Fix incorrect CSE on hoisted const load (PR #73007)
Igor Kirillov via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 04:54:17 PST 2023
================
@@ -1422,6 +1422,11 @@ bool MachineLICMBase::EliminateCSE(
if (MI->isImplicitDef())
return false;
+ // Do not CSE normal loads because between them could be store instructions
+ // that change the loaded value
+ if (MI->mayLoad() && !MI->isDereferenceableInvariantLoad())
----------------
igogo-x86 wrote:
That's a particular case where we load constant from memory like this:
```
fadd float %tmp3.i, 1.000000e+10
```
Also, if at least one store is in the loop, we don't hoist loads.
https://github.com/llvm/llvm-project/pull/73007
More information about the llvm-commits
mailing list