[llvm] r306997 - [InstCombine] Remove an if that should have been guaranteed by the caller. Replace with an assert. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 2 22:54:11 PDT 2017


Author: ctopper
Date: Sun Jul  2 22:54:11 2017
New Revision: 306997

URL: http://llvm.org/viewvc/llvm-project?rev=306997&view=rev
Log:
[InstCombine] Remove an if that should have been guaranteed by the caller. Replace with an assert. NFC

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=306997&r1=306996&r2=306997&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Sun Jul  2 22:54:11 2017
@@ -80,16 +80,14 @@ static Value *getFCmpValue(unsigned Code
 /// \return Pointer to node that must replace the original binary operator, or
 ///         null pointer if no transformation was made.
 Value *InstCombiner::SimplifyBSwap(BinaryOperator &I) {
+  assert(I.isBitwiseLogicOp() && "Unexpected opcode for bswap simplifying");
+
   IntegerType *ITy = dyn_cast<IntegerType>(I.getType());
 
   // Can't do vectors.
   if (I.getType()->isVectorTy())
     return nullptr;
 
-  // Can only do bitwise ops.
-  if (!I.isBitwiseLogicOp())
-    return nullptr;
-
   Value *OldLHS = I.getOperand(0);
   Value *OldRHS = I.getOperand(1);
   ConstantInt *ConstLHS = dyn_cast<ConstantInt>(OldLHS);




More information about the llvm-commits mailing list