[LLVMbugs] [Bug 23848] New: range metadata can be ignored

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 15 07:00:18 PDT 2015


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: unassignedbugs at nondot.org
          Reporter: pitrou at free.fr
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150615/a272598f/attachment.html>


More information about the llvm-bugs mailing list