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: unassignedb...@nondot.org
Reporter: max.kazant...@azul.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs