[LLVMbugs] [Bug 15967] New: basicaa claims no alias when there is
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri May 10 23:40:35 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15967
Bug ID: 15967
Summary: basicaa claims no alias when there is
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Global Analyses
Assignee: unassignedbugs at nondot.org
Reporter: moo321 at mailinator.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
test.s:
target datalayout = "e"
%struct.foo = type { i32, i32 }
define i32 @main() {
%t = alloca %struct.foo, align 4
%1 = getelementptr inbounds %struct.foo* %t, i32 0, i32 0
store i32 1, i32* %1, align 4
%2 = getelementptr inbounds %struct.foo* %t, i64 1
%3 = bitcast %struct.foo* %2 to i8*
%4 = getelementptr inbounds i8* %3, i32 -1
store i8 0, i8* %4
%5 = getelementptr inbounds i8* %4, i32 -1
store i8 0, i8* %5
%6 = getelementptr inbounds i8* %5, i32 -1
store i8 0, i8* %6
%7 = getelementptr inbounds i8* %6, i32 -1
store i8 0, i8* %7
%8 = getelementptr inbounds i8* %7, i32 -1
store i8 0, i8* %8
%9 = getelementptr inbounds i8* %8, i32 -1
store i8 0, i8* %9
%10 = getelementptr inbounds i8* %9, i32 -1
store i8 0, i8* %10
%11 = getelementptr inbounds i8* %10, i32 -1
store i8 0, i8* %11
%12 = load i32* %1, align 4
ret i32 %12
}
This is the source program:
struct foo {
int a;
int fill;
};
int main() {
foo t;
t.a = 1;
char*p = (char*)(&t+1);
for (int i=0;i<sizeof(t);++i) *--p = 0;
return t.a;
}
Running 'opt test.s -S -basicaa -gvn' transforms the ret to 'ret i32 1'.
'clang -O2 test.cpp -S' produces:
define i32 @main() nounwind uwtable {
ret i32 1
}
The program is supposed to return 0.
The error seems to be in lib/Analysis/BasicAliasAnalysis.cpp in the function
BasicAliasAnalysis::aliasGEP.
It seems to figure that
%11 = getelementptr inbounds i8* %10, i32 -1
and
%t = alloca %struct.foo, align 4
cannot possibly alias each other, because %11 is derived from
%2 = getelementptr inbounds %struct.foo* %t, i64 1
and those can not alias each other, or something along those lines.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130511/97775539/attachment.html>
More information about the llvm-bugs
mailing list