[PATCH] D109243: AMDGPU/GlobalISel: Add build_vector_trunc post-legalizer combine

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 14:10:24 PDT 2022


arsenm added a comment.

We're currently leaning towards not using legal G_BUILD_VECTOR_TRUNC anymore but this could still be a generic combine



================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp:317
+    MachineInstr &MI) {
+
+  if (MI.getNumOperands() != 3)
----------------
Should assert on the opcode


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp:279
+      getDefIgnoringCopies(MI.getOperand(2).getReg(), MRI);
+  if (!SecondElt || !isa<GImplicitDef>(SecondElt))
+    return false;
----------------
arsenm wrote:
> getDefIgnoringCopies cannot fail, so no point in the null check. Also you can fold this into return of the bool expression
Still don't need this null check


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

https://reviews.llvm.org/D109243



More information about the llvm-commits mailing list