Index: test/TableGen/GlobalISelEmitter.td =================================================================== --- test/TableGen/GlobalISelEmitter.td +++ test/TableGen/GlobalISelEmitter.td @@ -138,6 +138,8 @@ // 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 || MI1->getNumOperands() < 3) // CHECK-NEXT: return false; @@ -180,6 +182,8 @@ // 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 || MI1->getNumOperands() < 3) // CHECK-NEXT: return false; Index: utils/TableGen/GlobalISelEmitter.cpp =================================================================== --- utils/TableGen/GlobalISelEmitter.cpp +++ utils/TableGen/GlobalISelEmitter.cpp @@ -776,6 +776,8 @@ 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,