[PATCH] D82638: [MachineCopyPropagation] BackwardPropagatableCopy: add check for hasOverlappingMultipleDef

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 15:39:35 PDT 2020


efriedma added a comment.

If the definition is earlyclobber, do we also need to check for overlapping uses?



================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:468
+    const MachineInstr &MI, const MachineOperand &MODef, Register Def) {
+  if (MI.getDesc().getNumDefs() > 1) {
+    for (const MachineOperand &MIDef : MI.defs()) {
----------------
Is the getNumDefs() check necessary?


================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:470
+    for (const MachineOperand &MIDef : MI.defs()) {
+      if ((&MIDef != &MODef) && MIDef.isReg() && MIDef.isDef() &&
+          TRI->regsOverlap(Def, MIDef.getReg()))
----------------
is the "isDef()" check necessary?


================
Comment at: llvm/test/CodeGen/ARM/mcp-dest-regs-no-dup.ll:2
+; RUN: llc -mtriple=arm-eabi -O1 %s -verify-machineinstrs -o %t
+; RUN: llvm-mc < %t -triple thumbv7 -filetype=obj -o /dev/null
+
----------------
Please make an MIR testcase (http://llvm.org/docs/MIRLangRef.html); this is overly fragile.


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

https://reviews.llvm.org/D82638





More information about the llvm-commits mailing list