diff options
author | Owen Anderson <resistor@mac.com> | 2009-02-03 06:27:22 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-02-03 06:27:22 +0000 |
commit | cd89525434810af74d2d3f882f0e0ac5c677e341 (patch) | |
tree | 563af6fcf60380d77fbe28c829c21e1624279615 /lib/Analysis/AliasAnalysis.cpp | |
parent | dac5c4b10b387b55c2394cd98a64f3f1394df2e8 (diff) |
Teach AliasAnalysis that a bunch of the atomic intrinsics only dereference their arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/AliasAnalysis.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index d5de2fe616..2571492118 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -28,6 +28,7 @@ #include "llvm/Pass.h" #include "llvm/BasicBlock.h" #include "llvm/Function.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Instructions.h" #include "llvm/Type.h" #include "llvm/Target/TargetData.h" @@ -114,6 +115,27 @@ AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) { AliasAnalysis::ModRefBehavior AliasAnalysis::getModRefBehavior(CallSite CS, std::vector<PointerAccessInfo> *Info) { + if (IntrinsicInst* II = dyn_cast<IntrinsicInst>(CS.getInstruction())) { + switch (II->getIntrinsicID()) { + case Intrinsic::atomic_cmp_swap: + case Intrinsic::atomic_load_add: + case Intrinsic::atomic_load_and: + case Intrinsic::atomic_load_max: + case Intrinsic::atomic_load_min: + case Intrinsic::atomic_load_nand: + case Intrinsic::atomic_load_or: + case Intrinsic::atomic_load_sub: + case Intrinsic::atomic_load_umax: + case Intrinsic::atomic_load_umin: + case Intrinsic::atomic_load_xor: + case Intrinsic::atomic_swap: + // CAS and related intrinsics only access their arguments. + return AliasAnalysis::AccessesArguments; + default: + break; + } + } + if (CS.doesNotAccessMemory()) // Can't do better than this. return DoesNotAccessMemory; |