mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
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
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user