[llvm] [AMDGPU] Enable reordering of VMEM loads during clustering (PR #107986)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 03:45:17 PDT 2024


================
@@ -581,6 +581,23 @@ bool SIInstrInfo::shouldClusterMemOps(ArrayRef<const MachineOperand *> BaseOps1,
   return NumDWORDs <= 8;
 }
 
+bool SIInstrInfo::canReorderClusterMemOps(
+    ArrayRef<const MachineOperand *> BaseOps1,
+    ArrayRef<const MachineOperand *> BaseOps2) const {
+  const MachineInstr *FirstLdSt =
+      !BaseOps1.empty() ? BaseOps1.front()->getParent() : nullptr;
+  const MachineInstr *SecondLdSt =
+      !BaseOps2.empty() ? BaseOps2.front()->getParent() : nullptr;
+  ;
+
+  if (!FirstLdSt || !isVMEM(*FirstLdSt))
+    return false;
+  if (!SecondLdSt || !isVMEM(*SecondLdSt))
+    return false;
+
----------------
arsenm wrote:

Does the calling code take care of correctness / aliasing issues? 

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


More information about the llvm-commits mailing list