[PATCH] D118351: [AMDGPU][GlobalISel] Code quality: don't expand G_BUILD_VECTOR_TRUNC if not neccessary

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 07:47:50 PST 2022


arsenm accepted this revision.
arsenm added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp:386-396
+  // If the selected MachineInstruction is a G_BITCAST, the result will
+  // be the source of the bitcast.
+  // If not, build a bitcast that uses the dst of the selected
+  // MachineInstr.
+  if (SrcMI->getOpcode() == TargetOpcode::G_BITCAST) {
+    Reg = SrcMI->getOperand(1).getReg();
+    Helper.replaceRegWith(MRI, DstReg, Reg);
----------------
arsenm wrote:
> Special casing the use doesn't feel right. If the type doesn't match, insert a new cast and rely on bitcast folding?
I guess you did track that from before, so it doesn't really matter


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118351/new/

https://reviews.llvm.org/D118351



More information about the llvm-commits mailing list