https://llvm.org/bugs/show_bug.cgi?id=23848
Bug ID: 23848
Summary: range metadata can be ignored
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 14474
--> https://llvm.org/bugs/attachment.cgi?id=14474&action=edit
IR file reproducing the issue
If you take the attached IR file and try to optimize it using "opt -O3 -S
shape_is_pos.ll", you will get the following output (i.e. LLVM doesn't realize
the condition is always true):
define i1 @is_positive(i64 %arg) #0 {
entry:
%result = icmp sgt i64 %arg, -1
ret i1 %result
}
OTOH if you uncomment the two lines were llvm.assume is called, you get the
following (the return code is properly optimized to true):
define i1 @is_positive(i64 %arg) #0 {
entry:
%is_pos = icmp sgt i64 %arg, -1
tail call void @llvm.assume(i1 %is_pos)
ret i1 true
}
(this is something I stumbled on, in a more complicated form, in Numba;
unfortunately llvm.assume() can also pessimize some of our benchmarks)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs