[PATCH] D88060: [GISel]: Few InsertVecElt combines

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 14:42:35 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2415
+  auto Index = getConstantVRegVal(MI.getOperand(3).getReg(), MRI);
+  if (!Index || *Index != (NumElts - 1))
+    return false;
----------------
This could start at any index? Why give up at NumElts - 1?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2437
+
+  std::sort(Inserts.begin(), Inserts.end(),
+            [](const std::pair<Register, unsigned> &P1,
----------------
llvm::sort


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2449
+                Inserts.end());
+  Optional<Register> UndefReg;
+  auto GetUndef = [&]() {
----------------
Optional doesn't really buy you anything here? You can just use Register()?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2453
+      return *UndefReg;
+    Builder.setInstr(MI);
+    UndefReg = Builder.buildUndef(DstTy.getScalarType()).getReg(0);
----------------
I don't think you need to reset the insert point here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88060



More information about the llvm-commits mailing list