Parameter attributes are part of a FunctionType and deserve to be factored
authorReid Spencer <rspencer@reidspencer.com>
Mon, 8 Jan 2007 19:41:01 +0000 (19:41 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 8 Jan 2007 19:41:01 +0000 (19:41 +0000)
into comparisons of two FunctionTypes. Make it so.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33020 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Type.cpp

index 25da1e3a8517ec3205f4035e729324a8637ddae0..258aed03934c6c9391da02546d1d490845ea2f86 100644 (file)
@@ -607,11 +607,16 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2,
     const FunctionType *FTy2 = cast<FunctionType>(Ty2);
     if (FTy->isVarArg() != FTy2->isVarArg() ||
         FTy->getNumParams() != FTy2->getNumParams() ||
+        FTy->getNumAttrs() != FTy2->getNumAttrs() ||
+        FTy->getParamAttrs(0) != FTy2->getParamAttrs(0) ||
         !TypesEqual(FTy->getReturnType(), FTy2->getReturnType(), EqTypes))
       return false;
-    for (unsigned i = 0, e = FTy2->getNumParams(); i != e; ++i)
+    for (unsigned i = 0, e = FTy2->getNumParams(); i != e; ++i) {
+      if (FTy->getParamAttrs(i+1) != FTy->getParamAttrs(i+1))
+        return false;
       if (!TypesEqual(FTy->getParamType(i), FTy2->getParamType(i), EqTypes))
         return false;
+    }
     return true;
   } else {
     assert(0 && "Unknown derived type!");