[LLVMdev] difference between alias set tracker and alias analysis evaluator
Amr Yehia
yehia at iss.rwth-aachen.de
Fri May 29 03:35:40 PDT 2009
Hi all,
I have a problem with alias aliasing results returned by the alias set
tracker and the alias analysis evaluator.
so i call opt tool to run my module with the following options
"-anders-aa -aa-eval -print-alias-sets -print-all-alias-modref-info"
i use 2 classes to print alias analysis, the AliasSetTracket and
AliasAnalysisEvaluator.
but they give different results.
here is a sample program:
int main(){
int a[5];
struct {
char id[10];
int line;
} sym;
sym.line =a[1] + 10;
a[3] = 3;
sym.id[5] = a[3];
return 0;
}
and here is the ll file
define i32 @main() nounwind {
entry:
%retval = alloca i32 ; <i32*> [#uses=2]
%sym = alloca %struct..0anon ; <%struct..0anon*> [#uses=2]
%a = alloca [5 x i32] ; <[5 x i32]*> [#uses=3]
%0 = alloca i32 ; <i32*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%1 = getelementptr [5 x i32]* %a, i32 0, i64 1 ; <i32*> [#uses=1]
%2 = load i32* %1, align 4 ; <i32> [#uses=1]
%3 = add i32 %2, 10 ; <i32> [#uses=1]
%4 = getelementptr %struct..0anon* %sym, i32 0, i32 1 ;
<i32*> [#uses=1]
store i32 %3, i32* %4, align 4
%5 = getelementptr [5 x i32]* %a, i32 0, i64 3 ; <i32*> [#uses=1]
store i32 3, i32* %5, align 4
%6 = getelementptr [5 x i32]* %a, i32 0, i64 3 ; <i32*> [#uses=1]
%7 = load i32* %6, align 4 ; <i32> [#uses=1]
%8 = trunc i32 %7 to i8 ; <i8> [#uses=1]
%9 = getelementptr %struct..0anon* %sym, i32 0, i32 0 ; <[10
x i8]*> [#uses=1]
%10 = getelementptr [10 x i8]* %9, i32 0, i64 5 ; <i8*> [#uses=1]
store i8 %8, i8* %10, align 1
store i32 0, i32* %0, align 4
%11 = load i32* %0, align 4 ; <i32> [#uses=1]
store i32 %11, i32* %retval, align 4
br label %return
return: ; preds = %entry
%retval1 = load i32* %retval ; <i32> [#uses=1]
ret i32 %retval1
}
the AliasSetTracker gives the following result:
Alias Set Tracker: 6 alias sets for 7 pointer values.
AliasSet[0x2ce5d30,1] must alias, Ref Pointers: (i32* %1, 4)
AliasSet[0x2ce5ab0,1] must alias, Mod Pointers: (i32* %4, 4)
AliasSet[0x2ce59c0,2] must alias, Mod/Ref Pointers: (i32* %5, 4),
(i32* %6, 4)
AliasSet[0x2ce5910,1] must alias, Mod Pointers: (i8* %10, 1)
AliasSet[0x2ce5820,1] must alias, Mod/Ref Pointers: (i32* %0, 4)
AliasSet[0x2ce4f00,1] must alias, Mod/Ref Pointers: (i32* %retval, 4)
the alias analysis evaluator gives the following results (i removed all
the NoAlias results)
MayAlias: [5 x i32]* %a, i32* %1
MayAlias: %struct..0anon* %sym, i32* %4
MayAlias: [5 x i32]* %a, i32* %5
MayAlias: [5 x i32]* %a, i32* %6
MustAlias: i32* %5, i32* %6
MustAlias: %struct..0anon* %sym, [10 x i8]* %9
MayAlias: %struct..0anon* %sym, i8* %10
MayAlias: [10 x i8]* %9, i8* %10
so my questions finally are:
- why is there is a difference between the 2 results,
- how can i get the alias set tracker to give me all the aliasing
results returned by alias analysis evaluator
thank you
More information about the llvm-dev
mailing list