[llvm-branch-commits] [llvm] [AMDGPU][InstCombine] Canonicalize dot constant operands (PR #225083)
Harrison Hao via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Sep 22 05:14:55 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;
----------------
harrisonGPU wrote:
Thanks, I’d prefer to keep this as a separate canonicalization step and let InstCombine revisit the modified instruction from the worklist.
For example this function: `canonicalizeConstantArg0ToArg1`
https://github.com/llvm/llvm-project/pull/225083
More information about the llvm-branch-commits
mailing list