/// lexically identical expressions. This does not require any ahead of time
/// analysis, so it is a very fast default implementation.
///
- struct BasicVN : public FunctionPass, public ValueNumbering {
-
- /// Pass Implementation stuff. This isn't much of a pass.
- ///
- bool runOnFunction(Function &) { return false; }
-
- /// getAnalysisUsage - Does not modify anything.
- ///
- virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- }
-
+ struct BasicVN : public ImmutablePass, public ValueNumbering {
/// getEqualNumberNodes - Return nodes with the same value number as the
/// specified Value. This fills in the argument vector with any equal
/// values.
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;