[llvm-branch-commits] [llvm] [AMDGPU][InstCombine] Fold constant add/sub into the dot accumulator (PR #225002)

Steffen Larsen via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 21 07:56:23 PDT 2026


steffenlarsen wrote:

> Yes, I’m planning to implement this optimization as well. For this first step, I wanted to limit the change to constant folding and keep the patch small and easy to review. As a follow up, I plan to handle non constant cases when the transformation is profitable, such as folding an add into the accumulator when the original accumulator is zero.

Is there a case where hoisting it won't be worth it? Worst case the accumulator won't fold and the addition/subtraction happens before the dot product instead of after. Could it cause worse scheduling maybe? If not, I don't think we'd need these changes if we just have hoisting and simple const-folding.

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


More information about the llvm-branch-commits mailing list