[LLVMbugs] [Bug 23067] New: Alias analysis fails to recognize non-zero variable offset
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Mar 30 02:44:24 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23067
Bug ID: 23067
Summary: Alias analysis fails to recognize non-zero variable
offset
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Global Analyses
Assignee: unassignedbugs at nondot.org
Reporter: james.molloy at arm.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
In the following code, &a[i] cannot alias &a[i+m], as m is known to be nonzero.
However, *x is reloaded across the "*w >>= 1" statement.
void test(int n, int m, int * restrict a)
{
for (int j = 0; j < m; ++j) {
for (int i = j; i < n; ++i) {
int *x = &a[i];
int *w = &a[i+m];
*x >>= 1;
*w >>= 1;
*x += 2;
}
}
}
... Produces:
for.body3: ; preds =
%for.body3.preheader, %for.body3
%indvars.iv23 = phi i64 [ %indvars.iv.next24, %for.body3 ], [ %indvars.iv,
%for.body3.preheader ]
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv23
%1 = add nsw i64 %indvars.iv23, %0
%arrayidx5 = getelementptr inbounds i32, i32* %a, i64 %1
%2 = load i32, i32* %arrayidx, align 4, !tbaa !1
%shr = ashr i32 %2, 1
store i32 %shr, i32* %arrayidx, align 4, !tbaa !1 *** POINTLESS
STORE
%3 = load i32, i32* %arrayidx5, align 4, !tbaa !1
%shr6 = ashr i32 %3, 1
store i32 %shr6, i32* %arrayidx5, align 4, !tbaa !1
%4 = load i32, i32* %arrayidx, align 4, !tbaa !1 *** POINTLESS
RELOAD
%add7 = add nsw i32 %4, 2
store i32 %add7, i32* %arrayidx, align 4, !tbaa !1
%indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 1
%lftr.wideiv = trunc i64 %indvars.iv.next24 to i32
%exitcond = icmp eq i32 %lftr.wideiv, %n
br i1 %exitcond, label %for.inc8.loopexit, label %for.body3
--
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/20150330/36dd50c5/attachment.html>
More information about the llvm-bugs
mailing list