[PATCH] D118138: [AMDGPU][GlobalISel] Combine unmerge of undef

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 25 06:09:06 PST 2022


foad added inline comments.


================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:543
+  [{ return Helper.matchCombineUnmergeUndef(*${d}); }]),
+  (apply [{ Helper.applyCombineUnmergeUndef(*${d}); }])
+>;
----------------
Could use applyBuildFn if you prefer, as it avoids writing a separate "apply" function of your own.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1754
+  Register SrcReg = MI.getOperand(SrcIdx).getReg();
+  MachineInstr *SrcInstr = MRI.getVRegDef(SrcReg);
+  return SrcInstr->getOpcode() == TargetOpcode::G_IMPLICIT_DEF;
----------------
Could return isa<GImplicitDef>(MRI.getVRegDef(SrcReg)) if you prefer.


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizercombiner-select.mir:1
 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
 # RUN: llc -march=amdgcn -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
----------------
Can you regenerate the checks in this file and commit it please (consider it pre-approved) and then rebase this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118138



More information about the llvm-commits mailing list