[PATCH] D117758: [GlobalISel] Change ConstantFoldVectorBinop to return vector of APInt

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 02:02:26 PST 2022


foad created this revision.
foad added reviewers: arsenm, aemerson.
Herald added subscribers: kerbowa, hiraditya, rovka, nhaehnle, jvesely.
foad requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Previously it built MIR for the results and returned a Register.

This avoids building constants for earlier elements of the vector if
later elements will fail to fold, and allows CSEMIRBuilder::buildInstr
to avoid unconditionally building a copy from the result.

Use a new helper function MachineIRBuilder::buildBuildVectorConstant
to build a G_BUILD_VECTOR of G_CONSTANTs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117758

Files:
  llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
  llvm/include/llvm/CodeGen/GlobalISel/Utils.h
  llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp
  llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
  llvm/lib/CodeGen/GlobalISel/Utils.cpp
  llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-constant-fold-vector-op.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-getelementptr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117758.401555.patch
Type: text/x-patch
Size: 8814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220120/a1a3a8d1/attachment.bin>


More information about the llvm-commits mailing list