Sanjay Patel
1e95676e58
[InstCombine] add (sext i1 X), 1 --> zext (not X)
...
http://rise4fun.com/Alive/i8Q
A narrow bitwise logic op is obviously better than math for value tracking,
and zext is better than sext. Typically, the 'not' will be folded into an
icmp predicate.
The IR difference would even survive through codegen for x86, so we would see
worse code:
https://godbolt.org/g/C14HMF
one_or_zero(int, int): # @one_or_zero(int, int)
xorl %eax, %eax
cmpl %esi, %edi
setle %al
retq
one_or_zero_alt(int, int): # @one_or_zero_alt(int, int)
xorl %ecx, %ecx
cmpl %esi, %edi
setg %cl
movl $1, %eax
subl %ecx, %eax
retq
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306243 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-25 14:15:28 +00:00
..
2017-03-31 23:22:19 +00:00
2017-04-11 19:07:30 +00:00
2016-06-15 06:18:01 +00:00
2017-05-05 08:40:24 +00:00
2017-04-10 20:18:21 +00:00
2017-05-03 02:26:10 +00:00
2017-04-13 16:44:25 +00:00
2015-12-03 19:41:25 +00:00
2017-06-11 20:46:05 +00:00
2017-06-21 17:06:24 +00:00
2017-04-21 15:50:16 +00:00
2017-03-09 00:03:37 +00:00
2017-06-04 08:21:58 +00:00
2017-06-02 02:18:36 +00:00
2017-06-23 01:08:16 +00:00
2016-09-01 09:42:39 +00:00
2017-06-16 00:18:29 +00:00
2017-06-09 23:18:11 +00:00
2017-05-03 02:26:10 +00:00
2017-04-10 20:18:21 +00:00
2017-06-14 19:29:53 +00:00
2016-05-05 02:37:32 +00:00
2016-06-24 23:32:02 +00:00
2015-12-27 08:13:45 +00:00
2017-05-03 12:28:54 +00:00
2017-05-03 00:18:48 +00:00
2016-12-20 02:09:43 +00:00
2017-05-25 07:15:09 +00:00
2017-06-14 13:14:38 +00:00
2017-04-27 18:39:08 +00:00
2017-03-07 22:18:48 +00:00
2016-05-21 02:24:44 +00:00
2017-06-16 23:14:35 +00:00
2017-04-27 00:28:03 +00:00
2017-06-08 17:27:40 +00:00
2017-06-21 07:28:13 +00:00
2017-06-08 13:20:55 +00:00
2017-06-18 03:10:26 +00:00
2017-06-23 16:12:37 +00:00
2017-06-25 14:15:28 +00:00
2017-01-24 19:55:36 +00:00
2017-05-08 23:18:46 +00:00
2017-06-06 10:17:14 +00:00
2017-06-22 22:59:04 +00:00
2016-06-05 19:08:54 +00:00
2017-02-04 19:44:14 +00:00
2017-06-06 14:54:01 +00:00
2017-05-23 13:36:25 +00:00
2016-07-20 01:55:27 +00:00
2017-06-18 03:10:26 +00:00
2017-04-25 18:00:08 +00:00
2016-08-22 12:59:58 +00:00
2017-06-22 20:20:56 +00:00
2017-01-13 00:16:23 +00:00
2017-06-16 14:43:59 +00:00
2016-09-21 19:16:47 +00:00
2017-01-27 01:32:26 +00:00
2017-02-27 15:44:49 +00:00
2016-11-21 22:35:34 +00:00
2017-06-22 23:27:16 +00:00
2017-02-14 21:10:40 +00:00
2016-05-10 18:28:10 +00:00
2017-06-19 17:57:15 +00:00
2017-05-12 15:30:58 +00:00
2017-06-23 04:03:04 +00:00
2017-06-22 10:00:28 +00:00
2017-04-05 09:24:26 +00:00
2017-04-05 09:24:26 +00:00
2016-05-13 22:52:35 +00:00
2017-06-07 18:32:24 +00:00
2016-07-28 22:08:41 +00:00
2016-08-12 17:28:27 +00:00
2017-04-21 23:54:12 +00:00
2017-06-16 20:50:41 +00:00
2017-04-21 22:13:55 +00:00
2017-04-10 20:18:21 +00:00
2017-01-21 02:02:56 +00:00
2017-03-23 23:21:07 +00:00
2016-09-17 20:40:16 +00:00
2016-12-19 08:22:17 +00:00
2017-06-19 00:24:00 +00:00
2017-05-03 02:26:10 +00:00
2017-01-04 21:24:56 +00:00
2017-06-25 00:26:43 +00:00
2017-04-18 13:29:26 +00:00
2016-06-25 01:40:54 +00:00
2016-06-24 20:13:42 +00:00
2016-10-03 19:35:30 +00:00
2017-06-21 16:07:09 +00:00
2015-06-17 20:52:32 +00:00
2017-06-12 21:26:53 +00:00
2017-06-14 13:14:38 +00:00
2017-06-21 17:57:43 +00:00
2017-03-31 06:29:49 +00:00
2017-04-10 00:33:25 +00:00
2017-03-21 21:39:51 +00:00
2017-05-25 06:33:36 +00:00
2017-04-28 21:13:09 +00:00
2017-06-09 19:31:10 +00:00
2017-06-20 20:38:06 +00:00
2017-05-10 12:30:07 +00:00
2017-06-17 20:28:13 +00:00
2017-03-21 21:39:51 +00:00
2015-10-30 23:28:12 +00:00
2017-04-11 13:32:11 +00:00
2017-04-24 20:25:01 +00:00
2017-06-19 15:21:18 +00:00
2017-06-08 23:01:49 +00:00
2017-06-14 21:19:52 +00:00
2017-06-02 18:24:23 +00:00