[PATCH] Select Elimination in InstCombine

Gerolf Hoflehner ghoflehner at apple.com
Thu Nov 6 18:06:11 PST 2014


I need to re-open this for another round of reviews. Although the select-icmp
optmization had received pretty good reviews its commit got hit by
a self-host failure (pr21210) that exposed two issues. In addition to
the fixes there is a new function and some small refactoring.

Fixes:

f1) do not replace select by operand in the block that contains the select
f2) do not perform the optimization when a use of the select
could be reached on both paths out of the conditional block that
contains the select


Major changes:
- dominatesAllUses() fixes f1)
- replacedSelectWithOperand has a more natural interface and fixes f2)
- replaceUsesOutsideBlock() in lib/IR/Value.cpp
- test/Transforms/InstCombine/pr21210.ll

http://reviews.llvm.org/D5258

Files:
  include/llvm/IR/Value.h
  lib/IR/Value.cpp
  lib/Transforms/InstCombine/InstCombine.h
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/pr12338.ll
  test/Transforms/InstCombine/pr21199.ll
  test/Transforms/InstCombine/pr21210.ll
  test/Transforms/InstCombine/select-cmp-br.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5258.15905.patch
Type: text/x-patch
Size: 21164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141107/08ab53dc/attachment.bin>


More information about the llvm-commits mailing list