[llvm-branch-commits] [llvm] [AMDGPU][InstCombine] Canonicalize dot constant operands (PR #225083)

Steffen Larsen via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 22 00:21:30 PDT 2026


================
@@ -1974,6 +1974,15 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
   case Intrinsic::amdgcn_udot4:
   case Intrinsic::amdgcn_sdot8:
   case Intrinsic::amdgcn_udot8: {
+    Value *Src0 = II.getArgOperand(0);
+    Value *Src1 = II.getArgOperand(1);
+
+    if (isa<Constant>(Src0) && !isa<Constant>(Src1)) {
+      II.setArgOperand(0, Src1);
+      II.setArgOperand(1, Src0);
+      return &II;
----------------
steffenlarsen wrote:

It might be the norm (and if so, please feel free to ignore this), but why not continue working on it after we've canonicalized it, instead of expecting another pass-over to do it?

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


More information about the llvm-branch-commits mailing list