From f37c34430dd72b1d38c2207cce436ed1612b9995 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 31 Oct 2002 04:20:07 +0000 Subject: [PATCH] Use new isCommutative interface, which gives us SetEQ and SetNE for free. Thanks fly out to Casey Carter for this fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4460 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ValueNumbering.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/Analysis/ValueNumbering.cpp b/lib/Analysis/ValueNumbering.cpp index 519d9dbf97f..53d70e84b57 100644 --- a/lib/Analysis/ValueNumbering.cpp +++ b/lib/Analysis/ValueNumbering.cpp @@ -129,16 +129,12 @@ static inline bool isIdenticalBinaryInst(const Instruction &I1, I1.getOperand(1) == I2->getOperand(1)) return true; - // If the instruction is commutative and associative, the instruction can - // match if the operands are swapped! + // If the instruction is commutative, the instruction can match if the + // operands are swapped! // if ((I1.getOperand(0) == I2->getOperand(1) && I1.getOperand(1) == I2->getOperand(0)) && - (I1.getOpcode() == Instruction::Add || - I1.getOpcode() == Instruction::Mul || - I1.getOpcode() == Instruction::And || - I1.getOpcode() == Instruction::Or || - I1.getOpcode() == Instruction::Xor)) + I1.isCommutative()) return true; return false;