[llvm] [MachineLICM] Rematerialize instructions that may be hoisted before LICM (PR #158479)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 14 19:44:38 PDT 2025
================
@@ -167,3 +167,48 @@ bool llvm::isCycleInvariant(const MachineCycle *Cycle, MachineInstr &I) {
// If we got this far, the instruction is cycle invariant!
return true;
}
+
+bool llvm::mayLoadFromGOTOrConstantPool(MachineInstr &MI) {
+ assert(MI.mayLoad() && "Expected MI that loads!");
+
+ // If we lost memory operands, conservatively assume that the instruction
+ // reads from everything..
+ if (MI.memoperands_empty())
+ return true;
+
+ for (MachineMemOperand *MemOp : MI.memoperands())
+ if (const PseudoSourceValue *PSV = MemOp->getPseudoValue())
+ if (PSV->isGOT() || PSV->isConstantPool())
----------------
arsenm wrote:
PSV->isConstant? Or MemOp->isInvariant? Not sure if we verify those are consistent
https://github.com/llvm/llvm-project/pull/158479
More information about the llvm-commits
mailing list