[cfe-dev] Parameter check question
Tanya Lattner
lattner at apple.com
Tue Oct 6 16:38:18 PDT 2009
On Oct 6, 2009, at 4:37 PM, Mike Stump wrote:
> On Oct 6, 2009, at 4:20 PM, Tanya Lattner wrote:
>> For some reason, getAddressSpace() is returning 0.
>
> $ cat as.c
> __attribute__((annotate("random"))) void foo(__attribute__
> ((address_space(1))) int *x) {
> *x = 0;
> x = 0;
> }
> $ /Developer/usr/bin/clang -emit-llvm -S as.c -o -
> ; ModuleID = 'as.c'
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-
> i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-
> s0:64:64-f80:128:128"
> target triple = "x86_64-apple-darwin10.0"
>
> define void @foo(i32 addrspace(1)* %x) nounwind ssp {
> %x.addr = alloca i32 addrspace(1)* ; <i32 addrspace(1)
> **> [#uses=3]
> store i32 addrspace(1)* %x, i32 addrspace(1)** %x.addr
> %1 = load i32 addrspace(1)** %x.addr ; <i32 addrspace(1)
> *> [#uses=1]
> store i32 0, i32 addrspace(1)* %1
> store i32 addrspace(1)* null, i32 addrspace(1)** %x.addr
> ret void
> }
>
> The 1 is on the thing that x points to, not x itself?
Yes, you are correct. Sorry, my mistake! It is doing the right thing.
Sorry for the noise.
-Tanya
More information about the cfe-dev
mailing list