From 17fb0d24eb4aa1dadb51bb24b6a27aa11635d7ec Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 12 Jun 2009 19:03:05 +0000 Subject: [PATCH] Give Instruction::isSameOperationAs a corresponding comment to note the relationship with MergeFunctions.cpp's isEquivalentOperation, and make a trivial code reordering so that the two functions are easier to compare. Fix the name of Instruction::isSameOperationAs in MergeFunction.cpp's isEquivalentOperation's comment, and fix a nearby 80-column violation. llvm-svn: 73241 --- llvm/lib/Transforms/IPO/MergeFunctions.cpp | 5 +++-- llvm/lib/VMCore/Instruction.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 2b7fb5d99d6a..1dd3279b9eb4 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -180,8 +180,9 @@ static bool isEquivalentType(const Type *Ty1, const Type *Ty2) { /// isEquivalentOperation - determine whether the two operations are the same /// except that pointer-to-A and pointer-to-B are equivalent. This should be -/// kept in sync with Instruction::isSameOperandAs. -static bool isEquivalentOperation(const Instruction *I1, const Instruction *I2) { +/// kept in sync with Instruction::isSameOperationAs. +static bool +isEquivalentOperation(const Instruction *I1, const Instruction *I2) { if (I1->getOpcode() != I2->getOpcode() || I1->getNumOperands() != I2->getNumOperands() || !isEquivalentType(I1->getType(), I2->getType())) diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp index 7556b8ebe760..e0764e494b2e 100644 --- a/llvm/lib/VMCore/Instruction.cpp +++ b/llvm/lib/VMCore/Instruction.cpp @@ -218,9 +218,12 @@ bool Instruction::isIdenticalTo(const Instruction *I) const { } // isSameOperationAs +// This should be kept in sync with isEquivalentOperation in +// lib/Transforms/IPO/MergeFunctions.cpp. bool Instruction::isSameOperationAs(const Instruction *I) const { - if (getOpcode() != I->getOpcode() || getType() != I->getType() || - getNumOperands() != I->getNumOperands()) + if (getOpcode() != I->getOpcode() || + getNumOperands() != I->getNumOperands() || + getType() != I->getType()) return false; // We have two instructions of identical opcode and #operands. Check to see