[RegisterBankInfo] Do not provide a default mapping for non-reg of phi
authorQuentin Colombet <qcolombet@apple.com>
Tue, 12 Apr 2016 00:30:14 +0000 (00:30 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Tue, 12 Apr 2016 00:30:14 +0000 (00:30 +0000)
operations.

llvm-svn: 266027

llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp

index e22401a..68173e9 100644 (file)
@@ -309,10 +309,17 @@ RegisterBankInfo::getInstrMappingImpl(const MachineInstr &MI) const {
   // Propagate RegBank to all operands that do not have a
   // mapping yet.
   for (unsigned OpIdx = 0, End = MI.getNumOperands(); OpIdx != End; ++OpIdx) {
+    const MachineOperand &MO = MI.getOperand(OpIdx);
+    // Don't assign a mapping for non-reg operands.
+    if (!MO.isReg())
+      continue;
+
+    // If a mapping already exists, do not touch it.
     if (!static_cast<const InstructionMapping *>(&Mapping)
              ->getOperandMapping(OpIdx)
              .BreakDown.empty())
       continue;
+
     Mapping.setOperandMapping(OpIdx, RegSize, *RegBank);
   }
   return Mapping;