Chris Lattner
a80d668215
Implement rdar://6480391, extending of equality icmp's to avoid a truncation.
I noticed this in the code compiled for a routine using std::map, which produced
this code:
%25 = tail call i32 @memcmp(i8* %24, i8* %23, i32 6) nounwind readonly
%.lobit.i = lshr i32 %25, 31 ; <i32> [#uses=1]
%tmp.i = trunc i32 %.lobit.i to i8 ; <i8> [#uses=1]
%toBool = icmp eq i8 %tmp.i, 0 ; <i1> [#uses=1]
br i1 %toBool, label %bb3, label %bb4
which compiled to:
call L_memcmp$stub
shrl $31, %eax
testb %al, %al
jne LBB1_11 ##
with this change, we compile it to:
call L_memcmp$stub
testl %eax, %eax
js LBB1_11
This triggers all the time in common code, with patters like this:
%169 = and i32 %ply, 1 ; <i32> [#uses=1]
%170 = trunc i32 %169 to i8 ; <i8> [#uses=1]
%toBool = icmp ne i8 %170, 0 ; <i1> [#uses=1]
%7 = lshr i32 %6, 24 ; <i32> [#uses=1]
%9 = trunc i32 %7 to i8 ; <i8> [#uses=1]
%10 = icmp ne i8 %9, 0 ; <i1> [#uses=1]
etc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 07:47:06 +00:00
..
2008-07-03 17:21:41 +00:00
2008-09-08 11:07:35 +00:00
2008-09-23 12:47:39 +00:00
2008-05-20 21:00:03 +00:00
2008-11-24 21:27:20 +00:00
2008-05-20 21:00:03 +00:00
2008-10-16 05:26:51 +00:00
2008-09-29 20:49:50 +00:00
2008-12-06 00:53:22 +00:00
2009-01-07 19:39:06 +00:00
2009-01-05 20:37:33 +00:00
2009-01-02 07:01:27 +00:00
2008-12-16 07:10:09 +00:00
2008-05-20 21:00:03 +00:00
2008-11-25 19:00:29 +00:00
2009-01-08 21:45:23 +00:00
2009-01-09 07:47:06 +00:00
2009-01-05 21:24:45 +00:00
2008-06-19 09:27:44 +00:00
2009-01-09 06:08:12 +00:00
2008-05-20 21:00:03 +00:00
2008-08-16 00:00:54 +00:00
2008-12-03 06:41:50 +00:00
2008-12-04 21:38:42 +00:00
2008-05-20 21:00:03 +00:00
2008-05-20 21:00:03 +00:00
2008-09-09 21:41:34 +00:00
2008-07-29 13:21:23 +00:00
2008-12-08 23:44:46 +00:00
2008-05-20 21:00:03 +00:00
2008-05-20 21:00:03 +00:00
2008-05-20 21:00:03 +00:00
2008-10-27 06:56:35 +00:00
2008-06-01 22:26:26 +00:00
2008-11-04 23:02:39 +00:00
2008-05-20 21:00:03 +00:00
2009-01-08 21:45:23 +00:00
2008-05-20 21:00:03 +00:00
2008-08-16 00:00:54 +00:00
2009-01-08 05:42:05 +00:00
2008-08-13 21:22:48 +00:00
2008-12-16 20:54:32 +00:00
2009-01-04 20:27:34 +00:00
2008-08-07 15:55:18 +00:00
2008-05-20 21:00:03 +00:00
2008-05-20 21:00:03 +00:00
2008-06-12 20:55:39 +00:00