diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-02-06 05:04:00 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-02-06 05:04:00 +0000 |
commit | 39c33e3b6344be1d1cc35ad9fb1b647fd8adfe65 (patch) | |
tree | 0ed16158881299223cf446b714115c08a3a65945 /lib/Transforms/IPO/MergeFunctions.cpp | |
parent | d489332549f226701825de990a2f5869dad96ace (diff) |
Simplify away redundant test, and document what's going on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r-- | lib/Transforms/IPO/MergeFunctions.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp index 44f39fb5ba..79a7533c48 100644 --- a/lib/Transforms/IPO/MergeFunctions.cpp +++ b/lib/Transforms/IPO/MergeFunctions.cpp @@ -284,6 +284,10 @@ bool FunctionComparator::isEquivalentType(const Type *Ty1, // Instruction::isSameOperationAs. bool FunctionComparator::isEquivalentOperation(const Instruction *I1, const Instruction *I2) const { + // Differences from Instruction::isSameOperationAs: + // * replace type comparison with calls to isEquivalentType. + // * we test for I->hasSameSubclassOptionalData (nuw/nsw/tail) at the top + // * because of the above, we don't test for the tail bit on calls later on if (I1->getOpcode() != I2->getOpcode() || I1->getNumOperands() != I2->getNumOperands() || !isEquivalentType(I1->getType(), I2->getType()) || @@ -307,8 +311,7 @@ bool FunctionComparator::isEquivalentOperation(const Instruction *I1, if (const CmpInst *CI = dyn_cast<CmpInst>(I1)) return CI->getPredicate() == cast<CmpInst>(I2)->getPredicate(); if (const CallInst *CI = dyn_cast<CallInst>(I1)) - return CI->isTailCall() == cast<CallInst>(I2)->isTailCall() && - CI->getCallingConv() == cast<CallInst>(I2)->getCallingConv() && + return CI->getCallingConv() == cast<CallInst>(I2)->getCallingConv() && CI->getAttributes() == cast<CallInst>(I2)->getAttributes(); if (const InvokeInst *CI = dyn_cast<InvokeInst>(I1)) return CI->getCallingConv() == cast<InvokeInst>(I2)->getCallingConv() && |