[PowerPC] Don't commute trivial rlwimi instructions
[oota-llvm.git] / lib / Target / PowerPC / PPCInstrInfo.cpp
index 79c399b71ae865d7b3be0a675b7db496e9e797fc..70e223d78ada650c9bf626be37dc304dfb895cb9 100644 (file)
@@ -571,6 +571,11 @@ PPCInstrInfo::commuteInstruction(MachineInstr *MI, bool NewMI) const {
   unsigned MB = MI->getOperand(4).getImm();
   unsigned ME = MI->getOperand(5).getImm();
 
+  // We can't commute a trivial mask (there is no way to represent an all-zero
+  // mask).
+  if (MB == 0 && ME == 31)
+    return nullptr;
+
   if (NewMI) {
     // Create a new instruction.
     unsigned Reg0 = ChangeReg0 ? Reg2 : MI->getOperand(0).getReg();