[llvm-commits] [llvm] r83959 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
Owen Anderson
resistor at mac.com
Tue Oct 13 09:59:21 PDT 2009
Nick,
This shouldn't be necessary. Duncan and I did the same things back in
r63900 andr64551.
--Owen
On Oct 13, 2009, at 12:48 AM, Nick Lewycky wrote:
> Author: nicholas
> Date: Tue Oct 13 02:48:38 2009
> New Revision: 83959
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83959&view=rev
> Log:
> Teach BasicAA a little something about the atomic intrinsics: they
> can only
> modify through the pointer they're given.
>
> Added:
> llvm/trunk/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
> Modified:
> llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
>
> Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=83959&r1=83958&r2=83959&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
> +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Tue Oct 13
> 02:48:38 2009
> @@ -284,6 +284,27 @@
> if (!passedAsArg)
> return NoModRef;
> }
> +
> + if (IntrinsicInst *II = dyn_cast<IntrinsicInst>
> (CS.getInstruction())) {
> + switch (II->getIntrinsicID()) {
> + default: break;
> + case Intrinsic::atomic_cmp_swap:
> + case Intrinsic::atomic_swap:
> + case Intrinsic::atomic_load_add:
> + case Intrinsic::atomic_load_sub:
> + case Intrinsic::atomic_load_and:
> + case Intrinsic::atomic_load_nand:
> + case Intrinsic::atomic_load_or:
> + case Intrinsic::atomic_load_xor:
> + case Intrinsic::atomic_load_max:
> + case Intrinsic::atomic_load_min:
> + case Intrinsic::atomic_load_umax:
> + case Intrinsic::atomic_load_umin:
> + if (alias(II->getOperand(1), Size, P, Size) == NoAlias)
> + return NoModRef;
> + break;
> + }
> + }
> }
>
> // The AliasAnalysis base class has some smarts, lets use them.
>
> Added: llvm/trunk/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll?rev=83959&view=auto
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll
> (added)
> +++ llvm/trunk/test/Analysis/BasicAA/2009-10-13-AtomicModRef.ll Tue
> Oct 13 02:48:38 2009
> @@ -0,0 +1,16 @@
> +; RUN: opt -gvn -S < %s | FileCheck %s
> +
> +declare i8 @llvm.atomic.load.add.i8.p0i8(i8*, i8)
> +
> +define void @foo(i8* %ptr) {
> + %P = getelementptr i8* %ptr, i32 0
> + %Q = getelementptr i8* %ptr, i32 1
> +; CHECK: getelementptr
> + %X = load i8* %P
> +; CHECK: = load
> + %Y = call i8 @llvm.atomic.load.add.i8.p0i8(i8* %Q, i8 1)
> + %Z = load i8* %P
> +; CHECK-NOT: = load
> + ret void
> +; CHECK: ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20091013/6918eef0/attachment.bin>
More information about the llvm-commits
mailing list