[llvm-commits] [llvm] r63616 - /llvm/trunk/lib/Analysis/AliasAnalysis.cpp
Owen Anderson
resistor at mac.com
Mon Feb 2 22:27:22 PST 2009
Author: resistor
Date: Tue Feb 3 00:27:22 2009
New Revision: 63616
URL: http://llvm.org/viewvc/llvm-project?rev=63616&view=rev
Log:
Teach AliasAnalysis that a bunch of the atomic intrinsics only dereference their arguments.
Modified:
llvm/trunk/lib/Analysis/AliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=63616&r1=63615&r2=63616&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Tue Feb 3 00:27:22 2009
@@ -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::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;
More information about the llvm-commits
mailing list