[llvm] r305226 - Remove unneeded conditionals - the code is already conditional on the same condition

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 13:09:54 PDT 2017


Author: dblaikie
Date: Mon Jun 12 15:09:53 2017
New Revision: 305226

URL: http://llvm.org/viewvc/llvm-project?rev=305226&view=rev
Log:
Remove unneeded conditionals - the code is already conditional on the same condition

Modified:
    llvm/trunk/tools/llvm-stress/llvm-stress.cpp

Modified: llvm/trunk/tools/llvm-stress/llvm-stress.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-stress/llvm-stress.cpp?rev=305226&r1=305225&r2=305226&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-stress/llvm-stress.cpp (original)
+++ llvm/trunk/tools/llvm-stress/llvm-stress.cpp Mon Jun 12 15:09:53 2017
@@ -405,17 +405,15 @@ struct ConstModifier: public Modifier {
 
     if (Ty->isIntegerTy()) {
       switch (Ran->Rand() % 7) {
-      case 0: if (Ty->isIntegerTy())
-                return PT->push_back(ConstantInt::get(Ty,
-                  APInt::getAllOnesValue(Ty->getPrimitiveSizeInBits())));
-              llvm_unreachable("Unexpected state");
-      case 1: if (Ty->isIntegerTy())
-                return PT->push_back(ConstantInt::get(Ty,
-                  APInt::getNullValue(Ty->getPrimitiveSizeInBits())));
-              llvm_unreachable("Unexpected state");
+      case 0:
+        return PT->push_back(ConstantInt::get(
+            Ty, APInt::getAllOnesValue(Ty->getPrimitiveSizeInBits())));
+      case 1:
+        return PT->push_back(ConstantInt::get(
+            Ty, APInt::getNullValue(Ty->getPrimitiveSizeInBits())));
       case 2: case 3: case 4: case 5:
-      case 6: if (Ty->isIntegerTy())
-                PT->push_back(ConstantInt::get(Ty, Ran->Rand()));
+      case 6:
+        PT->push_back(ConstantInt::get(Ty, Ran->Rand()));
       }
     }
 




More information about the llvm-commits mailing list