[PATCH] D42739: [InstCombine] allow multi-use values in canEvaluate* if all uses are in 1 inst

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 08:05:40 PST 2018


spatel created this revision.
spatel added reviewers: aaboud, craig.topper.
Herald added a subscriber: mcrosier.

This is the enhancement suggested in https://reviews.llvm.org/D42536 to fix a shortcoming in regular InstCombine's canEvaluate* functionality.
When we have multiple uses of a value, but they're all in one instruction, we can allow that expression to be narrowed or widened for the same cost as a single-use value.

AFAICT, this can only matter for multiply: sub/and/or/xor/select would be simplified away if the operands are the same value; add becomes shl; shifts with a variable shift amount aren't handled.


https://reviews.llvm.org/D42739

Files:
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  test/Transforms/InstCombine/cast-mul-select.ll
  test/Transforms/InstCombine/icmp-mul-zext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42739.132176.patch
Type: text/x-patch
Size: 4656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180131/7706aab7/attachment.bin>


More information about the llvm-commits mailing list