Teach AliasSetTracker about VAArgInst.
authorDan Gohman <gohman@apple.com>
Mon, 14 Apr 2008 18:34:50 +0000 (18:34 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 14 Apr 2008 18:34:50 +0000 (18:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49674 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/AliasSetTracker.h
lib/Analysis/AliasSetTracker.cpp

index 4b5148909acf78f540ed20feb42f1dcfab8cbd2e..a4367c43734ac0e8a0e69ee0fae0108cca5c7ddb 100644 (file)
@@ -29,6 +29,7 @@ class AliasAnalysis;
 class LoadInst;
 class StoreInst;
 class FreeInst;
+class VAArgInst;
 class AliasSetTracker;
 class AliasSet;
 
@@ -281,6 +282,7 @@ public:
   bool add(LoadInst *LI);
   bool add(StoreInst *SI);
   bool add(FreeInst *FI);
+  bool add(VAArgInst *VAAI);
   bool add(CallSite CS);          // Call/Invoke instructions
   bool add(CallInst *CI)   { return add(CallSite(CI)); }
   bool add(InvokeInst *II) { return add(CallSite(II)); }
@@ -295,6 +297,7 @@ public:
   bool remove(LoadInst *LI);
   bool remove(StoreInst *SI);
   bool remove(FreeInst *FI);
+  bool remove(VAArgInst *VAAI);
   bool remove(CallSite CS);
   bool remove(CallInst *CI)   { return remove(CallSite(CI)); }
   bool remove(InvokeInst *II) { return remove(CallSite(II)); }
index c35dc324b14aca033d2919939231ff58e70e4c0d..50a6bb8a83468d661062baa4a001c2f5fffc74f8 100644 (file)
@@ -292,6 +292,12 @@ bool AliasSetTracker::add(FreeInst *FI) {
   return NewPtr;
 }
 
+bool AliasSetTracker::add(VAArgInst *VAAI) {
+  bool NewPtr;
+  addPointer(VAAI->getOperand(0), ~0, AliasSet::ModRef, NewPtr);
+  return NewPtr;
+}
+
 
 bool AliasSetTracker::add(CallSite CS) {
   if (AA.doesNotAccessMemory(CS))
@@ -321,6 +327,8 @@ bool AliasSetTracker::add(Instruction *I) {
     return add(II);
   else if (FreeInst *FI = dyn_cast<FreeInst>(I))
     return add(FI);
+  else if (VAArgInst *VAAI = dyn_cast<VAArgInst>(I))
+    return add(VAAI);
   return true;
 }
 
@@ -414,6 +422,13 @@ bool AliasSetTracker::remove(FreeInst *FI) {
   return true;
 }
 
+bool AliasSetTracker::remove(VAArgInst *VAAI) {
+  AliasSet *AS = findAliasSetForPointer(VAAI->getOperand(0), ~0);
+  if (!AS) return false;
+  remove(*AS);
+  return true;
+}
+
 bool AliasSetTracker::remove(CallSite CS) {
   if (AA.doesNotAccessMemory(CS))
     return false; // doesn't alias anything
@@ -434,6 +449,8 @@ bool AliasSetTracker::remove(Instruction *I) {
     return remove(CI);
   else if (FreeInst *FI = dyn_cast<FreeInst>(I))
     return remove(FI);
+  else if (VAArgInst *VAAI = dyn_cast<VAArgInst>(I))
+    return remove(VAAI);
   return true;
 }