[PATCH] D49047: [InstCombine] fix shuffle-of-binops transform to avoid poison/undef

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 6 15:20:33 PDT 2018


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

As noted in https://reviews.llvm.org/D48987, there are many different ways for this transform to go wrong. In particular, the poison potential for shifts means we have to more careful with those ops. I added tests to make that behavior visible for all of the different cases that I could find.

This is a partial fix. To make this review easier, I did not make changes for the single binop pattern (handled in foldSelectShuffleWith1Binop()). I also left out some potential optimizations noted with TODO comments. I'll follow-up once we're confident that things are correct here.

The goal is to correct all marked FIXME tests (assuming I identified those correctly) to either avoid the shuffle transform or do it safely.

Note that distinguishing when the shuffle mask contains undefs and using getBinOpIdentity() allows for some improvements to div/rem patterns, so there are wins along with the missed opportunities and fixes.


https://reviews.llvm.org/D49047

Files:
  lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  test/Transforms/InstCombine/shuffle_select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49047.154463.patch
Type: text/x-patch
Size: 20123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180706/6a668744/attachment.bin>


More information about the llvm-commits mailing list