summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-04-15 22:33:50 +0000
committerBill Wendling <isanbard@gmail.com>2013-04-15 22:33:50 +0000
commit3789171972381c2071ab094936ed50b88c448e00 (patch)
treef76a110f58a9181723f126ee3dcb833f2d600a1c /llvm/lib/Transforms/IPO/MergeFunctions.cpp
parenta44f85abd420c5f9af79539a57917d8c9d2c5882 (diff)
downloadbcm5719-llvm-3789171972381c2071ab094936ed50b88c448e00.tar.gz
bcm5719-llvm-3789171972381c2071ab094936ed50b88c448e00.zip
We are not able to bitcast a pointer to an integral value.
Two return types are not equivalent if one is a pointer and the other is an integral. This is because we cannot bitcast a pointer to an integral value. PR15185 llvm-svn: 179569
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/MergeFunctions.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index 892100f0585..ab31b1a96e7 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -185,7 +185,7 @@ private:
}
/// Compare two Types, treating all pointer types as equal.
- bool isEquivalentType(Type *Ty1, Type *Ty2) const;
+ bool isEquivalentType(Type *Ty1, Type *Ty2, bool isReturnType = false) const;
// The two functions undergoing comparison.
const Function *F1, *F2;
@@ -200,12 +200,12 @@ private:
// Any two pointers in the same address space are equivalent, intptr_t and
// pointers are equivalent. Otherwise, standard type equivalence rules apply.
-bool FunctionComparator::isEquivalentType(Type *Ty1,
- Type *Ty2) const {
+bool FunctionComparator::isEquivalentType(Type *Ty1, Type *Ty2,
+ bool isReturnType) const {
if (Ty1 == Ty2)
return true;
if (Ty1->getTypeID() != Ty2->getTypeID()) {
- if (TD) {
+ if (TD && !isReturnType) {
LLVMContext &Ctx = Ty1->getContext();
if (isa<PointerType>(Ty1) && Ty2 == TD->getIntPtrType(Ctx)) return true;
if (isa<PointerType>(Ty2) && Ty1 == TD->getIntPtrType(Ctx)) return true;
@@ -261,7 +261,7 @@ bool FunctionComparator::isEquivalentType(Type *Ty1,
FTy1->isVarArg() != FTy2->isVarArg())
return false;
- if (!isEquivalentType(FTy1->getReturnType(), FTy2->getReturnType()))
+ if (!isEquivalentType(FTy1->getReturnType(), FTy2->getReturnType(), true))
return false;
for (unsigned i = 0, e = FTy1->getNumParams(); i != e; ++i) {
OpenPOWER on IntegriCloud