[PATCH] D99032: GlobalISel: Add FoldBinOpIntoSelect combine

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 16:06:44 PST 2022


paquette added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3365
+  Register RHS = MI.getOperand(2).getReg();
+  MachineInstr *Select = MRI.getVRegDef(MI.getOperand(SelectOperand).getReg());
+
----------------
arsenm wrote:
> paquette wrote:
> > In the match function, you found the G_SELECT using `getOpcodeDef`, which walks through COPY instructions. If that walked through a COPY, I think this will give you the wrong instruction.
> It's theoretically wrong but due to the copy combines, this was unobservably broken
Would adding a testcase which only enables `fold_binop_into_select` make it possible to test?


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

https://reviews.llvm.org/D99032



More information about the llvm-commits mailing list