There is no need for isAssociative to take the type as an argument anymore.
authorDuncan Sands <baldrick@free.fr>
Mon, 20 Dec 2010 13:10:23 +0000 (13:10 +0000)
committerDuncan Sands <baldrick@free.fr>
Mon, 20 Dec 2010 13:10:23 +0000 (13:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122242 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Instruction.h
lib/VMCore/ConstantFold.cpp
lib/VMCore/Instruction.cpp

index 88f5ce1b2622ec176ed771422a0efec9ec3bdca1..89bb9fdf423d5f3f92f62be44957c21209f8459a 100644 (file)
@@ -200,11 +200,10 @@ public:
   ///
   ///   Associative operators satisfy:  x op (y op z) === (x op y) op z
   ///
-  /// In LLVM, the Add, Mul, And, Or, and Xor operators are associative, when
-  /// not applied to floating point types.
+  /// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
   ///
-  bool isAssociative() const { return isAssociative(getOpcode(), getType()); }
-  static bool isAssociative(unsigned op, const Type *Ty);
+  bool isAssociative() const { return isAssociative(getOpcode()); }
+  static bool isAssociative(unsigned op);
 
   /// isCommutative - Return true if the instruction is commutative:
   ///
index 2309f2274bf644271344c1ef5f52c6a80fb7686c..5c284b746de605b5a49d0e5a0987aa2f3d3e504d 100644 (file)
@@ -1338,8 +1338,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
 
     // Given ((a + b) + c), if (b + c) folds to something interesting, return
     // (a + (b + c)).
-    if (Instruction::isAssociative(Opcode, C1->getType()) &&
-        CE1->getOpcode() == Opcode) {
+    if (Instruction::isAssociative(Opcode) && CE1->getOpcode() == Opcode) {
       Constant *T = ConstantExpr::get(Opcode, CE1->getOperand(1), C2);
       if (!isa<ConstantExpr>(T) || cast<ConstantExpr>(T)->getOpcode() != Opcode)
         return ConstantExpr::get(Opcode, CE1->getOperand(0), T);
index fdddba988c3d133c751089637bd130baf0ee5a31..7bb2cf167b917ab1a611392ba2c7d6b59abec4f6 100644 (file)
@@ -348,7 +348,7 @@ bool Instruction::mayThrow() const {
 ///
 /// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
 ///
-bool Instruction::isAssociative(unsigned Opcode, const Type *Ty) {
+bool Instruction::isAssociative(unsigned Opcode) {
   return Opcode == And || Opcode == Or || Opcode == Xor ||
          Opcode == Add || Opcode == Mul;
 }