[PATCH] D13074: [InstSimplify] Fold simple known implications to true

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 17:22:41 PDT 2015


reames added inline comments.

================
Comment at: lib/Analysis/InstructionSimplify.cpp:2216
@@ -2174,3 +2215,3 @@
       break;
     case ICmpInst::ICMP_UGE:
       // X >=u 1 -> X
----------------
sanjoy wrote:
> hfinkel wrote:
> > reames wrote:
> > > Pretty sure I can't use signed compares.  I believe "1" is interpreted as "-1" in a signed compare.  This generates a different truth table.  
> > FWIW, yes, i1 signed values are interpreted as 0 and -1.
> I was taking about matching `LHS >=s RHS` as `LHS implies RHS`.  I
> think the truth table is
> 
> ```
> LHS | RHS | LHS >=s RHS   | LHS implies RHS
>  0  |  0  |  1 (0 >= 0)   |  1
>  0  |  1  |  1 (0 >= -1)  |  1
>  1  |  0  |  0 (-1 >= 0)  |  0
>  1  |  1  |  1 (-1 >= -1) |  1
> ```
Hm, interesting.  You appear to be right.  Assume I've added this, anything else?


http://reviews.llvm.org/D13074





More information about the llvm-commits mailing list