[llvm] [MachineLICM] Fix incorrect CSE on hoisted const load (PR #73007)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 01:02:00 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())
----------------
david-arm wrote:

Sorry, just ignore me. I think I probably misunderstood the problem you're trying to solve. I guess I'm just trying to understand why we don't just always return false for all loads.

https://github.com/llvm/llvm-project/pull/73007


More information about the llvm-commits mailing list