diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-04-15 22:33:50 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-04-15 22:33:50 +0000 |
commit | 23e00ae631d8063a5d52d424968a6ebdc24e81f7 (patch) | |
tree | 5345f8e3cb2a481828e71bc2c8fc15d10b2e3a54 /lib/Transforms | |
parent | b8145e3881872fffbac15693c94536446f060330 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179569 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/MergeFunctions.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp index 892100f058..ab31b1a96e 100644 --- a/lib/Transforms/IPO/MergeFunctions.cpp +++ b/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) { |