[PATCH] D76523: [GlobalISel] Combine G_SELECTs of the form (cond ? x : x) into x

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 12:01:03 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1524-1525
+                                                     unsigned OpIdx) {
+  assert(OpIdx < MI.getNumOperands() && "OpIdx is out of bounds");
+  assert(MI.getOperand(OpIdx).isReg() && "Expected register operand?");
+  assert(MI.getNumDefs() == 1 && "Expected one def?");
----------------
These asserts are both redundant with ones in the accessors


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1526
+  assert(MI.getOperand(OpIdx).isReg() && "Expected register operand?");
+  assert(MI.getNumDefs() == 1 && "Expected one def?");
+  Register OldReg = MI.getOperand(0).getReg();
----------------
This should specifically be getNumExplicitDefs, this will fail to fail with an implicit def


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

https://reviews.llvm.org/D76523





More information about the llvm-commits mailing list