Use PartialAlias to do better noalias lint checking.
authorDan Gohman <gohman@apple.com>
Fri, 10 Dec 2010 20:04:06 +0000 (20:04 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 10 Dec 2010 20:04:06 +0000 (20:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121514 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/Lint.cpp

index 0cdb4b1a1c91bf62d6ec413959ac72fcf6c11329..270aa457f1709efe4fbb6bba8e9f15eb6d12152e 100644 (file)
@@ -232,10 +232,12 @@ void Lint::visitCallSite(CallSite CS) {
         // where nothing is known.
         if (Formal->hasNoAliasAttr() && Actual->getType()->isPointerTy())
           for (CallSite::arg_iterator BI = CS.arg_begin(); BI != AE; ++BI)
-            Assert1(AI == BI ||
-                    !(*BI)->getType()->isPointerTy() ||
-                    AA->alias(*AI, *BI) != AliasAnalysis::MustAlias,
-                    "Unusual: noalias argument aliases another argument", &I);
+            if (AI != BI && (*BI)->getType()->isPointerTy()) {
+              AliasAnalysis::AliasResult Result = AA->alias(*AI, *BI);
+              Assert1(Result != AliasAnalysis::MustAlias &&
+                      Result != AliasAnalysis::PartialAlias,
+                      "Unusual: noalias argument aliases another argument", &I);
+            }
 
         // Check that an sret argument points to valid memory.
         if (Formal->hasStructRetAttr() && Actual->getType()->isPointerTy()) {