diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index c54ecd02e489..e4d80ee66986 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -411,7 +411,10 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr) if (unsigned NumArgs = MIOpInfo->getNumArgs()) NumOps = NumArgs; - isPredicable |= Rec->isSubClassOf("PredicateOperand"); + if (Rec->isSubClassOf("PredicateOperand")) { + if (!Rec->getValueAsBit("isImmutable")) + isPredicable = true; + } } else if (Rec->getName() == "variable_ops") { hasVariableNumberOfOperands = true; continue; diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index af01e4cd75a1..a57770de4689 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -107,7 +107,8 @@ InstrInfoEmitter::GetOperandInfo(const CodeGenInstruction &Inst) { // Predicate operands. Check to see if the original unexpanded operand // was of type PredicateOperand. - if (Inst.OperandList[i].Rec->isSubClassOf("PredicateOperand")) + if (Inst.OperandList[i].Rec->isSubClassOf("PredicateOperand") && + !Inst.OperandList[i].Rec->getValueAsBit("isImmutable")) Res += "|M_PREDICATE_OPERAND"; // Fill in constraint info.