[PATCH] Select Elimination in InstCombine
Gerolf Hoflehner
ghoflehner at apple.com
Mon Sep 8 21:39:18 PDT 2014
Hi chandlerc, mcrosier, ributzka, majnemer,
Summary
In special cases select instructions can be eliminated by
replacing them with a cheaper bitwise operation even when the
select result is used outside its home block. The instances implemented
here are %x=icmp.eq; %y=select %x,%r, null; %z=icmp.eq|neq %y, null;
br %z,true, false ==> %x=icmp.ne; %y=icmp.eq %r,null; %z=or %x,%y; br
%z,true,false. The optimization is integrated into the instruction
combiner and performed only when all uses of the select result can
be replaced by the select operand proper. For this dominator information
is used. Integration into the combiner means that only the select-icmp is
transformed at first. Then the combiner iteratively works out the simpler
pattern. Note that the instruction combiner already handles the local pattern
when there is no use of the select result outside its home block.
http://reviews.llvm.org/D5258
Files:
lib/Transforms/InstCombine/InstCombine.h
lib/Transforms/InstCombine/InstCombineCompares.cpp
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/select-cmp-br.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5258.13442.patch
Type: text/x-patch
Size: 11502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140909/e9a49ad2/attachment.bin>
More information about the llvm-commits
mailing list