[llvm] 7b201bf - [InstCombine] remove unused parameter and add assert; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 20 08:47:50 PDT 2020


Author: Sanjay Patel
Date: 2020-06-20T11:47:00-04:00
New Revision: 7b201bfcac262572667ff091b3bf8d00e7786217

URL: https://github.com/llvm/llvm-project/commit/7b201bfcac262572667ff091b3bf8d00e7786217
DIFF: https://github.com/llvm/llvm-project/commit/7b201bfcac262572667ff091b3bf8d00e7786217.diff

LOG: [InstCombine] remove unused parameter and add assert; NFC

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 5f7e35ecf038..cbbde9a1aeb8 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -402,10 +402,12 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
   return Changed ? &I : nullptr;
 }
 
-static Instruction *foldFPSignBitOps(BinaryOperator &I,
-                                     InstCombiner::BuilderTy &Builder) {
-  Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
+static Instruction *foldFPSignBitOps(BinaryOperator &I) {
   BinaryOperator::BinaryOps Opcode = I.getOpcode();
+  assert((Opcode == Instruction::FMul || Opcode == Instruction::FDiv) &&
+         "Expected fmul or fdiv");
+
+  Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
   Value *X, *Y;
 
   // -X * -Y --> X * Y
@@ -439,7 +441,7 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
   if (Value *FoldedMul = foldMulSelectToNegate(I, Builder))
     return replaceInstUsesWith(I, FoldedMul);
 
-  if (Instruction *R = foldFPSignBitOps(I, Builder))
+  if (Instruction *R = foldFPSignBitOps(I))
     return R;
 
   // X * -1.0 --> -X
@@ -1237,7 +1239,7 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
   if (Instruction *R = foldFDivConstantDividend(I))
     return R;
 
-  if (Instruction *R = foldFPSignBitOps(I, Builder))
+  if (Instruction *R = foldFPSignBitOps(I))
     return R;
 
   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);


        


More information about the llvm-commits mailing list