[PATCH] InstCombine: Combine two icmps into one if the RHSs agree

David Majnemer david.majnemer at gmail.com
Thu Jul 31 11:27:33 PDT 2014


Hi nicholas, bkramer,

consider:
%cmp1 = icmp CC %V1, C
%cmp2 = icmp CC %V2, C
%and  = and %cmp1, %cmp2

we can transform this into:
%or  = or %V1, %V2
%cmp = icmp CC %or, C

This saves us an instruction and generates considerably nicer assembly
for X86, X86-64, arm, powerpc64 and aarch64.

http://reviews.llvm.org/D4744

Files:
  lib/Transforms/InstCombine/InstCombine.h
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/Transforms/InstCombine/2008-08-05-And.ll
  test/Transforms/InstCombine/or.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4744.12075.patch
Type: text/x-patch
Size: 5632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140731/72892e71/attachment.bin>


More information about the llvm-commits mailing list