diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index 7d71d46278eb..58ad12e2ce65 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -3832,9 +3832,9 @@ bool PPCInstrInfo::convertToImmediateForm(MachineInstr &MI, return true; ImmInstrInfo III; - bool IsVFReg = MI.getOperand(0).isReg() - ? PPC::isVFRegister(MI.getOperand(0).getReg()) - : false; + bool IsVFReg = MI.getOperand(0).isReg() && + MI.getOperand(0).getReg().isPhysical() && + PPC::isVFRegister(MI.getOperand(0).getReg()); bool HasImmForm = instrHasImmForm(MI.getOpcode(), IsVFReg, III, PostRA); // If this is a reg+reg instruction that has a reg+imm form, // and one of the operands is produced by an add-immediate, @@ -4873,9 +4873,9 @@ bool PPCInstrInfo::transformToNewImmFormFedByAdd( // get Imm Form info. ImmInstrInfo III; - bool IsVFReg = MI.getOperand(0).isReg() - ? PPC::isVFRegister(MI.getOperand(0).getReg()) - : false; + bool IsVFReg = MI.getOperand(0).isReg() && + MI.getOperand(0).getReg().isPhysical() && + PPC::isVFRegister(MI.getOperand(0).getReg()); if (!instrHasImmForm(XFormOpcode, IsVFReg, III, PostRA)) return false;