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

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 13:43:50 PDT 2015


sanjoy added inline comments.

================
Comment at: lib/Analysis/InstructionSimplify.cpp:2216
@@ -2174,3 +2215,3 @@
       break;
     case ICmpInst::ICMP_UGE:
       // X >=u 1 -> X
----------------
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
```


http://reviews.llvm.org/D13074





More information about the llvm-commits mailing list