Fix the second build bot break introduced by r320791.
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Fri, 15 Dec 2017 14:17:45 +0000 (14:17 +0000)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Fri, 15 Dec 2017 14:17:45 +0000 (14:17 +0000)
llvm-svn: 320811

llvm/lib/Target/PowerPC/PPCInstrInfo.cpp

index 879bb4c..031e668 100644 (file)
@@ -2286,6 +2286,13 @@ MachineInstr *PPCInstrInfo::getConstantDefMI(MachineInstr &MI,
         MachineBasicBlock::reverse_iterator E = MI.getParent()->rend(), It = MI;
         It++;
         unsigned Reg = MI.getOperand(i).getReg();
+        // MachineInstr::readsRegister only returns true if the machine
+        // instruction reads the exact register or its super-register. It
+        // does not consider uses of sub-registers which seems like strange
+        // behaviour. Nonetheless, if we end up with a 64-bit register here,
+        // get the corresponding 32-bit register to check.
+        if (PPC::G8RCRegClass.contains(Reg))
+          Reg = Reg - PPC::X0 + PPC::R0;
 
         // Is this register defined by a load-immediate in this block?
         for ( ; It != E; ++It) {