[llvm-bugs] [Bug 31749] New: Some of the GVN assume-equal tests seem quite broken
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 24 21:22:36 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31749
Bug ID: 31749
Summary: Some of the GVN assume-equal tests seem quite broken
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: dberlin at dberlin.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Assume-equal.ll has some tests that make no sense, or otherwise look very
broken.
Even with assume support, NewGVN doesn't get them for this reason.
Example:
; CHECK-LABEL: define i32 @_Z1ij(i32 %p)
define i32 @_Z1ij(i32 %p) {
entry:
%cmp = icmp eq i32 %p, 42
call void @llvm.assume(i1 %cmp)
; CHECK: br i1 true, label %bb2, label %bb2
br i1 %cmp, label %bb2, label %bb2
bb2:
; CHECK-NOT: %cmp2 =
%cmp2 = icmp eq i32 %p, 42
; CHECK-NOT: call void @llvm.assume(
call void @llvm.assume(i1 %cmp2)
; CHECK: br i1 true, label %bb2, label %bb2
br i1 %cmp, label %bb2, label %bb2
; CHECK: ret i32 42
ret i32 %p
}
The ret here is outside bb2 (because the branch terminates it).
NewGVN considers it unreachable, and so ignores it. It would delete it but we
don't delete terminators to avoid breaking the CFG.
We believe block ret is unreachable
BasicBlock Dead:
ret: ; No predecessors!
ret i32 %p
Z1ij is similar.
If we are trying to test that %p gets replaced with 42, i believe it should be
br i1 %cmp, label %ret, label %bb2
...
ret:
ret i32 p
Which NewGVN with assume support gets.
I can't figure out what Z1il is testing for :)
we do what it wants though
z1im ditto.
Wanted a second opinion, so flagging this.
--
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/20170125/130e9e45/attachment-0001.html>
More information about the llvm-bugs
mailing list