[PATCH] D114232: [AMDGPU] Fold more inline constant operands by commuting instructions

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 19 03:22:37 PST 2021


foad created this revision.
foad added reviewers: arsenm, rampitec.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
foad requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

SIFoldOperands::foldInstOperand folds an immediate value into any number
of inline immediates uses, but it was missing uses that could be inline
if the instruction was commuted. The test diffs mostly show cases where
the immediate value 0 can be folded into more than one commuted v_addc
instruction.

Unfortunately this adds more duplication between
isInlineConstantIfFolded and tryAddToFoldList, but there was already
duplication of the mac/mad handling.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114232

Files:
  llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
  llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-idiv.ll
  llvm/test/CodeGen/AMDGPU/bypass-div.ll
  llvm/test/CodeGen/AMDGPU/flat-scratch.ll
  llvm/test/CodeGen/AMDGPU/sdiv64.ll
  llvm/test/CodeGen/AMDGPU/srem64.ll
  llvm/test/CodeGen/AMDGPU/stack-realign.ll
  llvm/test/CodeGen/AMDGPU/udiv.ll
  llvm/test/CodeGen/AMDGPU/udiv64.ll
  llvm/test/CodeGen/AMDGPU/urem64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114232.388454.patch
Type: text/x-patch
Size: 264343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211119/d36070d7/attachment-0001.bin>


More information about the llvm-commits mailing list