[llvm] [MachineOutliner] Remove LOHs from outlined candidates (PR #143617)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 20:08:36 PDT 2025


================
@@ -1075,6 +1076,23 @@ bool MachineOutliner::outline(
                       << " B) > threshold (" << OutlinerBenefitThreshold
                       << " B)\n");
 
+    // Remove all Linker Optimization Hints from the candidates since we did not
+    // check if the set of hints are the same for each of them.
+    // TODO: The intersection of the LOHs from all candidates should be legal in
+    // the outlined function.
+    SmallPtrSet<MachineInstr *, 2> MIs;
+    std::optional<size_t> MinRemovedLOHs;
+    for (Candidate &C : OF->Candidates) {
+      const TargetInstrInfo &TII = *C.getMF()->getSubtarget().getInstrInfo();
----------------
arsenm wrote:

Should this really be a subtarget property in an outlining context? This would need to be module level / TargetMachine? 

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


More information about the llvm-commits mailing list