[llvm] [AMDGPU] Don't cluster lds instrs together (PR #180908)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 15 07:07:24 PST 2026


================
@@ -563,12 +563,24 @@ static bool memOpsHaveSameBasePtr(const MachineInstr &MI1,
   return Base1 == Base2;
 }
 
+static bool isDSInstrOperands(ArrayRef<const MachineOperand *> operands) {
+  if (operands.empty()) {
+    return false;
+  }
+  const auto *MI = operands.front()->getParent();
+  return SIInstrInfo::isDS(*MI);
+}
+
 bool SIInstrInfo::shouldClusterMemOps(ArrayRef<const MachineOperand *> BaseOps1,
                                       int64_t Offset1, bool OffsetIsScalable1,
                                       ArrayRef<const MachineOperand *> BaseOps2,
                                       int64_t Offset2, bool OffsetIsScalable2,
                                       unsigned ClusterSize,
                                       unsigned NumBytes) const {
+  if (isDSInstrOperands(BaseOps1) || isDSInstrOperands(BaseOps2)) {
+    return false;
+  }
----------------
shiltian wrote:

```suggestion
  if (isDSInstrOperands(BaseOps1) || isDSInstrOperands(BaseOps2))
    return false;
```

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


More information about the llvm-commits mailing list