summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-02-06 05:04:00 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-02-06 05:04:00 +0000
commitcb1a4c26ee66e533df24540a7484f9f4f26f151d (patch)
tree11ca05aa18d94bbc6b481f49b80a34e7bee2e5b8 /llvm/lib/Transforms/IPO/MergeFunctions.cpp
parentf8797fda44da0b0dfc4294957f7edc72caf2e34c (diff)
downloadbcm5719-llvm-cb1a4c26ee66e533df24540a7484f9f4f26f151d.tar.gz
bcm5719-llvm-cb1a4c26ee66e533df24540a7484f9f4f26f151d.zip
Simplify away redundant test, and document what's going on.
llvm-svn: 124977
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/MergeFunctions.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index 44f39fb5bac..79a7533c484 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/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() &&
OpenPOWER on IntegriCloud