[llvm-bugs] [Bug 37636] New: InstCombine produces worse code when provided with range information
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 31 01:55:13 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37636
Bug ID: 37636
Summary: InstCombine produces worse code when provided with
range information
Product: new-bugs
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: max.kazantsev at azul.com
CC: llvm-bugs at lists.llvm.org
Instcombine can sometimes produce a worse code when dealing with values
annotated by ranges than if there was no range. Apparently it tries to replace
sdiv with bit magic and it breaks some other pattern recognition.
Tests:
define i1 @good(i32* %A) {
%A.val = load i32, i32* %A, align 8
%B = sdiv i32 %A.val, 2
%C = icmp sge i32 0, %B
ret i1 %C
}
define i1 @bad(i32* %A) {
%A.val = load i32, i32* %A, align 8, !range !0
%B = sdiv i32 %A.val, 2
%C = icmp sge i32 0, %B
ret i1 %C
}
!0 = !{i32 0, i32 2147483647}
Run opt -instcombine -S
The result is:
define i1 @good(i32* %A) {
%A.val = load i32, i32* %A, align 8
%C = icmp slt i32 %A.val, 2
ret i1 %C
}
define i1 @bad(i32* %A) {
%A.val = load i32, i32* %A, align 8, !range !0
%B.mask = and i32 %A.val, 2147483646
%C = icmp eq i32 %B.mask, 0
ret i1 %C
}
!0 = !{i32 0, i32 2147483647}
--
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/20180531/c36669be/attachment.html>
More information about the llvm-bugs
mailing list