[PATCH] D47163: [InstCombine] don't change the size of a select if it would mismatch its condition operands' sizes

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 14:29:26 PDT 2018


spatel created this revision.
spatel added reviewers: efriedma, craig.topper, lebedev.ri.
Herald added a subscriber: mcrosier.

Don't always:
cast (select (cmp x, y), z, C) --> select (cmp x, y), (cast z), C'

This is something that came up as far back as https://reviews.llvm.org/D26556, and I lost track of it. I suspect that this transform is part of the underlying problem that is inspiring many of the recent proposals that seek to match larger patterns that include a cast op.

If this looks ok, then I can also add the canonicalization in the other direction, so we actively try to get the compare and select to match sizes.


https://reviews.llvm.org/D47163

Files:
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  test/Transforms/InstCombine/cast-select.ll
  test/Transforms/InstCombine/fpcast.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47163.147872.patch
Type: text/x-patch
Size: 7742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180521/44ffa62a/attachment-0001.bin>


More information about the llvm-commits mailing list