[PATCH] [RegAllocGreedy] Rematerialization crashes while updating operands in bundled MIs

Quentin Colombet qcolombet at apple.com
Thu May 21 09:43:23 PDT 2015


Hi Dmitri,

The bug is scary!

This LGTM to a few nitpicks while you are here.
Also I assume this is not triggered by any in-tree target. If it is, please add a test case.

Thanks,
-Quentin


================
Comment at: lib/CodeGen/InlineSpiller.cpp:925
@@ -924,2 +924,3 @@
+    MachineInstr *MI = Ops[i].first;
     MachineOperand &MO = MI->getOperand(Ops[i].second);
     if (MO.isReg() && MO.isUse() && MO.getReg() == VirtReg.reg) {
----------------
MI is not reused anywhere so just fold the expression here:
MachineOperand &MO = Ops[i].first->getOperand(Ops[i].second);

That way we won’t have the shadow variable.

================
Comment at: lib/CodeGen/InlineSpiller.cpp:1103
@@ -1101,3 +1102,3 @@
   for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
     unsigned Idx = Ops[i].second;
     MachineOperand &MO = MI->getOperand(Idx);
----------------
While you are here, add an assert in that loop:
MI == Ops[i].first

http://reviews.llvm.org/D9904

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list