[llvm] r299351 - [InstCombine] Make foldOpWithConstantIntoOperand take a BinaryOperator instead of a generic Instruction.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 00:08:08 PDT 2017


Author: ctopper
Date: Mon Apr  3 02:08:08 2017
New Revision: 299351

URL: http://llvm.org/viewvc/llvm-project?rev=299351&view=rev
Log:
[InstCombine] Make foldOpWithConstantIntoOperand take a BinaryOperator instead of a generic Instruction.

It blindly assumes there are two operands so make it explicit.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h?rev=299351&r1=299350&r2=299351&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h Mon Apr  3 02:08:08 2017
@@ -571,7 +571,7 @@ private:
   Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI);
 
   /// This is a convenience wrapper function for the above two functions.
-  Instruction *foldOpWithConstantIntoOperand(Instruction &I);
+  Instruction *foldOpWithConstantIntoOperand(BinaryOperator &I);
 
   /// \brief Try to rotate an operation below a PHI node, using PHI nodes for
   /// its operands.

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=299351&r1=299350&r2=299351&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Mon Apr  3 02:08:08 2017
@@ -967,7 +967,7 @@ Instruction *InstCombiner::FoldOpIntoPhi
   return replaceInstUsesWith(I, NewPN);
 }
 
-Instruction *InstCombiner::foldOpWithConstantIntoOperand(Instruction &I) {
+Instruction *InstCombiner::foldOpWithConstantIntoOperand(BinaryOperator &I) {
   assert(isa<Constant>(I.getOperand(1)) && "Unexpected operand type");
 
   if (auto *Sel = dyn_cast<SelectInst>(I.getOperand(0))) {




More information about the llvm-commits mailing list