summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-04-14 18:34:50 +0000
committerDan Gohman <gohman@apple.com>2008-04-14 18:34:50 +0000
commit235fc57ef2ed0a3c43a6e2d77b7c13f96a6f8036 (patch)
tree4e04bd9afa434af6f990619e61d0d322ef297019
parent4a9a3e53746e3cc752d8a242ddc887a106cf5021 (diff)
downloadllvm-235fc57ef2ed0a3c43a6e2d77b7c13f96a6f8036.tar.gz
llvm-235fc57ef2ed0a3c43a6e2d77b7c13f96a6f8036.tar.bz2
llvm-235fc57ef2ed0a3c43a6e2d77b7c13f96a6f8036.tar.xz
Teach AliasSetTracker about VAArgInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49674 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/AliasSetTracker.h3
-rw-r--r--lib/Analysis/AliasSetTracker.cpp17
2 files changed, 20 insertions, 0 deletions
diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h
index 4b5148909a..a4367c4373 100644
--- a/include/llvm/Analysis/AliasSetTracker.h
+++ b/include/llvm/Analysis/AliasSetTracker.h
@@ -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)); }
diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp
index c35dc324b1..50a6bb8a83 100644
--- a/lib/Analysis/AliasSetTracker.cpp
+++ b/lib/Analysis/AliasSetTracker.cpp
@@ -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;
}