[llvm] r310424 - My commit r310346 introduced some valid warnings. This cleans them up.

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 15:17:31 PDT 2017


Author: nemanjai
Date: Tue Aug  8 15:17:31 2017
New Revision: 310424

URL: http://llvm.org/viewvc/llvm-project?rev=310424&view=rev
Log:
My commit r310346 introduced some valid warnings. This cleans them up.

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=310424&r1=310423&r2=310424&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Aug  8 15:17:31 2017
@@ -2818,6 +2818,7 @@ SDValue PPCDAGToDAGISel::getCompoundZero
   case ZeroCompare::GESExt:
     ToExtend = SDValue(CurDAG->getMachineNode(Is32Bit ? PPC::NOR : PPC::NOR8,
                                               dl, InVT, LHS, LHS), 0);
+    break;
   case ZeroCompare::LEZExt:
   case ZeroCompare::LESExt: {
     if (Is32Bit) {
@@ -2834,15 +2835,18 @@ SDValue PPCDAGToDAGISel::getCompoundZero
       ToExtend = SDValue(CurDAG->getMachineNode(PPC::OR8, dl, MVT::i64,
                                                 Addi, LHS), 0);
     }
+    break;
   }
   }
 
   // For 64-bit sequences, the extensions are the same for the GE/LE cases.
-  if (!Is32Bit && (CmpTy == ZeroCompare::GEZExt || ZeroCompare::LEZExt))
+  if (!Is32Bit &&
+      (CmpTy == ZeroCompare::GEZExt || CmpTy == ZeroCompare::LEZExt))
     return SDValue(CurDAG->getMachineNode(PPC::RLDICL, dl, MVT::i64,
                                           ToExtend, getI64Imm(1, dl),
                                           getI64Imm(63, dl)), 0);
-  if (!Is32Bit && (CmpTy == ZeroCompare::GESExt || ZeroCompare::LESExt))
+  if (!Is32Bit &&
+      (CmpTy == ZeroCompare::GESExt || CmpTy == ZeroCompare::LESExt))
     return SDValue(CurDAG->getMachineNode(PPC::SRADI, dl, MVT::i64, ToExtend,
                                           getI64Imm(63, dl)), 0);
 
@@ -2866,10 +2870,9 @@ SDValue PPCDAGToDAGISel::getCompoundZero
                                           getI32Imm(-1, dl)), 0);
   }
 
-  // Some compilers warn if there's a default label in the switch above, others
-  // warn if there isn't a return statement here or in a default label. Appease
-  // both (even though this is unreachable).
-  return SDValue();
+  // The above case covers all the enumerators so it can't have a default clause
+  // to avoid compiler warnings.
+  llvm_unreachable("Unknown zero-comparison type.");
 }
 
 /// Produces a zero-extended result of comparing two 32-bit values according to




More information about the llvm-commits mailing list