diff --git a/test/TableGen/GlobalISelEmitter.td b/test/TableGen/GlobalISelEmitter.td index eb0609c5126..aeac85962f6 100644 --- a/test/TableGen/GlobalISelEmitter.td +++ b/test/TableGen/GlobalISelEmitter.td @@ -138,6 +138,8 @@ def ADD : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2), // CHECK-NEXT: return false; // CHECK-NEXT: if (!MI0.getOperand(1).isReg()) // CHECK-NEXT: return false; +// CHECK-NEXT: if (TRI.isPhysicalRegister(MI0.getOperand(1).getReg())) +// CHECK-NEXT: return false; // CHECK-NEXT: MachineInstr &MI1 = *MRI.getVRegDef(MI0.getOperand(1).getReg()); // CHECK-NEXT: if (MI1.getNumOperands() < 3) // CHECK-NEXT: return false; @@ -180,6 +182,8 @@ def ADD : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2), // CHECK-NEXT: return false; // CHECK-NEXT: if (!MI0.getOperand(2).isReg()) // CHECK-NEXT: return false; +// CHECK-NEXT: if (TRI.isPhysicalRegister(MI0.getOperand(2).getReg())) +// CHECK-NEXT: return false; // CHECK-NEXT: MachineInstr &MI1 = *MRI.getVRegDef(MI0.getOperand(2).getReg()); // CHECK-NEXT: if (MI1.getNumOperands() < 3) // CHECK-NEXT: return false; diff --git a/utils/TableGen/GlobalISelEmitter.cpp b/utils/TableGen/GlobalISelEmitter.cpp index 2b624d95c66..7a500eaf411 100644 --- a/utils/TableGen/GlobalISelEmitter.cpp +++ b/utils/TableGen/GlobalISelEmitter.cpp @@ -775,6 +775,8 @@ public: void emitCxxCaptureStmts(raw_ostream &OS, RuleMatcher &Rule, StringRef OperandExpr) const override { OS << "if (!" << OperandExpr + ".isReg())\n" + << " return false;\n" + << "if (TRI.isPhysicalRegister(" << OperandExpr + ".getReg()))\n" << " return false;\n"; std::string InsnVarName = Rule.defineInsnVar( OS, *InsnMatcher,