[PATCH] Convert fcmp with 0.0 from casted integers to icmp

Matt Arsenault Matthew.Arsenault at amd.com
Mon Nov 24 14:57:50 PST 2014


Hi hfinkel, scanon,

This is already handled in general when it is known the
conversion can't lose bits with smaller integer types
casted into wider floating point types.
    
This pattern happens somewhat often in GPU programs that cast
workitem intrinsics to float, which are often compared with 0.
    
Specifically handle the special case of compares with zero which
should also be known to not lose information. I had a more general
version of this which allows equality compares if the casted float is
exactly representable in the integer, but I'm not 100% confident that
is always correct.
    
Also fold cases that aren't integers to true / false.

http://reviews.llvm.org/D6395

Files:
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6395.16586.patch
Type: text/x-patch
Size: 14976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141124/4893b2fc/attachment.bin>


More information about the llvm-commits mailing list