[llvm-dev] questions about AliasAnalysis(Basic Alias Analysis) in llvm3.3
PeiLIU via llvm-dev
llvm-dev at lists.llvm.org
Wed May 4 05:34:03 PDT 2016
Hi, My name is Pei Liu, I am using llvm-3.3 do some developing. I want to
confirm that basic blocks operate global variables or not. For example:
C-Language source code:
int ga;
int main()
{
int a = 10;
int b = 100;
if (a > 8) {
int ma = ga;
}
return 0;
}
The llvm IR .ll file looks like this:
; Function Attrs: nounwind uwtable
define i32 @main() #0 {
entry:
%retval = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%ma = alloca i32, align 4
store i32 0, i32* %retval
call void @llvm.dbg.declare(metadata !{i32* %a}, metadata !23), !dbg !24
store i32 10, i32* %a, align 4, !dbg !24
call void @llvm.dbg.declare(metadata !{i32* %b}, metadata !25), !dbg !26
store i32 100, i32* %b, align 4, !dbg !26
%tmp = load i32* %a, align 4, !dbg !27
%cmp = icmp sgt i32 %tmp, 8, !dbg !27
br i1 %cmp, label %if.then, label %if.end, !dbg !27
if.then: ; preds = %entry
call void @llvm.dbg.declare(metadata !{i32* %ma}, metadata !28), !dbg !30
%tmp1 = load i32* @ga, align 4, !dbg !30
store i32 %tmp1, i32* %ma, align 4, !dbg !30
br label %if.end, !dbg !31
if.end: ; preds = %if.then, %entry
ret i32 0, !dbg !32
}
I want to use AliasAnalysis to confirm that the if.then block operate the
global variable. I use the function canBasicBlockModify(const BasicBlock
&BB, const Value *P, uint64_t Size) which belong to the class of
AliasAnalysis. However, I use every block to test then it always return
true of the function canBasicBlockModify.
Does this property which basic block operates global variable can be
confirmed? If it can be confirm, then how? Thanks for your help. Best
wishes!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160504/95709350/attachment.html>
More information about the llvm-dev
mailing list