[LLVMdev] A very basic doubt about LLVM Alias Analysis
Duncan Sands
baldrick at free.fr
Mon Feb 15 03:12:56 PST 2010
Hi Ambika,
> Using this option I do get all the vars as may alias ie
>
> MayAlias: i32* %j.0, i32* %k
> MayAlias: i32* %i.0, i32* %k
> MayAlias: i32* %i.0, i32* %j.0
>
> Is there any other analysis which will give them as must aliases.
at -O1 these variables are entirely eliminated here. I'm surprised
they aren't eliminated for you.
Ciao,
Duncan.
PS:
$ cat ambika.c
int main()
{
int *i,*j,k;
i=&k;
j=&k;
k=4;
printf("%d,%d,%d",*i,*j,k);
return 0;
}
$ llvm-gcc -S -O1 -emit-llvm -o - ambika.c
ambika.c: In function ‘main’:
ambika.c:7: warning: incompatible implicit declaration of built-in function ‘printf’
; ModuleID = 'ambika.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-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
@.str = private constant [9 x i8] c"%d,%d,%d\00", align 1 ; <[9 x i8]*> [#uses=1]
define i32 @main() nounwind {
entry:
%0 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]*
@.str, i64 0, i64 0), i32 4, i32 4, i32 4) nounwind ; <i32> [#uses=0]
ret i32 0
}
declare i32 @printf(i8* nocapture, ...) nounwind
More information about the llvm-dev
mailing list