[LLVMbugs] [Bug 24288] New: Regression due to GMR changes in r242512
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jul 28 01:21:18 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24288
Bug ID: 24288
Summary: Regression due to GMR changes in r242512
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Global Analyses
Assignee: unassignedbugs at nondot.org
Reporter: michael.m.kuperstein at intel.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
We started seeing a lot of regressions in eembc. At least one of them (in
mp2decode) appears to reduce down to this:
@ptr = internal unnamed_addr global i8* getelementptr inbounds ([4096 x i8],
[4096 x i8]* @arr, i32 0, i32 0), align 4
@arr = internal global [4096 x i8] zeroinitializer, align 1
define i8* @foo(i32 %k, i32 %incr, i8* %p) {
entry:
%start = icmp sgt i32 %k, 0
br i1 %start, label %for.body, label %for.end
for.body:
%i = phi i32 [ %next, %for.body ], [ 0, %entry ]
%mul= mul nsw i32 %i, %incr
%readptr = getelementptr inbounds i8, i8* %p, i32 %mul
%val = load i8, i8* %readptr, align 1
%writeptr = load i8*, i8** @ptr
%newptr = getelementptr inbounds i8, i8* %writeptr
store i8* %newptr, i8** @ptr, align 4
store i8 %val, i8* %writeptr, align 1
%cmpptr = load i8*, i8** @ptr
%cmp = icmp eq i8* %cmpptr, getelementptr inbounds ([4096 x i8], [4096 x i8]*
@arr, i32 1, i32 0)
%next = add i32 %i, 1
br i1 %cmp, label %for.body, label %for.end
for.end:
%ret = load i8*, i8** @ptr
ret i8* %ret
}
The problem is that @ptr ends up in the same alias-set as the pointers based on
%p, messing up GVN:
opt -S C:\temp\mp2-reduced.ll -basicaa -globalsmodref-aa -print-alias-sets -gvn
-o -
Alias Set Tracker: 1 alias sets for 3 pointer values.
AliasSet[0xdf3820, 3] may alias, Mod/Ref Pointers: (i8* %readptr, 1), (i8**
@ptr, 8), (i8* %writeptr, 1)
; ModuleID = 'C:\temp\mp2-reduced.ll'
@ptr = internal unnamed_addr global i8* getelementptr inbounds ([4096 x i8],
[4096 x i8]* @arr, i32 0, i32 0), align 4
@arr = internal global [4096 x i8] zeroinitializer, align 1
define i8* @foo(i32 %k, i32 %incr, i8* %p) {
entry:
%start = icmp sgt i32 %k, 0
br i1 %start, label %entry.for.body_crit_edge, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%ret.pre = load i8*, i8** @ptr
br label %for.end
entry.for.body_crit_edge: ; preds = %entry
%writeptr.pre = load i8*, i8** @ptr
br label %for.body
for.body: ; preds =
%entry.for.body_crit_edge, %for.body
%writeptr = phi i8* [ getelementptr inbounds ([4096 x i8], [4096 x i8]* @arr,
i32 1, i32 0), %for.body ], [ %writeptr.pre, %entry.for.body_crit_edge ]
%i = phi i32 [ %next, %for.body ], [ 0, %entry.for.body_crit_edge ]
%mul = mul nsw i32 %i, %incr
%readptr = getelementptr inbounds i8, i8* %p, i32 %mul
%val = load i8, i8* %readptr, align 1
store i8* %writeptr, i8** @ptr, align 4
store i8 %val, i8* %writeptr, align 1
%cmpptr = load i8*, i8** @ptr
%cmp = icmp eq i8* %cmpptr, getelementptr inbounds ([4096 x i8], [4096 x i8]*
@arr, i32 1, i32 0)
%next = add i32 %i, 1
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds =
%entry.for.end_crit_edge, %for.body
%ret = phi i8* [ %ret.pre, %entry.for.end_crit_edge ], [ %cmpptr, %for.body ]
ret i8* %ret
}
But with -enable-unsafe-globalsmodref-alias-results:
Alias Set Tracker: 2 alias sets for 3 pointer values.
AliasSet[0xcf9580, 2] may alias, Mod/Ref Pointers: (i8* %readptr, 1), (i8*
%writeptr, 1)
AliasSet[0xcf9620, 1] must alias, Mod/Ref Pointers: (i8** @ptr, 8)
; ModuleID = 'C:\temp\mp2-reduced.ll'
@ptr = internal unnamed_addr global i8* getelementptr inbounds ([4096 x i8],
[4096 x i8]* @arr, i32 0, i32 0), align 4
@arr = internal global [4096 x i8] zeroinitializer, align 1
define i8* @foo(i32 %k, i32 %incr, i8* %p) {
entry:
%start = icmp sgt i32 %k, 0
br i1 %start, label %entry.for.body_crit_edge, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%ret.pre = load i8*, i8** @ptr
br label %for.end
entry.for.body_crit_edge: ; preds = %entry
%writeptr.pre = load i8*, i8** @ptr
br label %for.body
for.body: ; preds =
%entry.for.body_crit_edge, %for.body
%writeptr = phi i8* [ getelementptr inbounds ([4096 x i8], [4096 x i8]* @arr,
i32 1, i32 0), %for.body ], [ %writeptr.pre, %entry.for.body_crit_edge ]
%i = phi i32 [ %next, %for.body ], [ 0, %entry.for.body_crit_edge ]
%mul = mul nsw i32 %i, %incr
%readptr = getelementptr inbounds i8, i8* %p, i32 %mul
%val = load i8, i8* %readptr, align 1
store i8* %writeptr, i8** @ptr, align 4
store i8 %val, i8* %writeptr, align 1
%cmp = icmp eq i8* %writeptr, getelementptr inbounds ([4096 x i8], [4096 x
i8]* @arr, i32 1, i32 0)
%next = add i32 %i, 1
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds =
%entry.for.end_crit_edge, %for.body
%ret = phi i8* [ %ret.pre, %entry.for.end_crit_edge ], [ %writeptr, %for.body
]
ret i8* %ret
}
--
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/20150728/fd0c98ea/attachment.html>
More information about the llvm-bugs
mailing list