[PATCH] D47686: [InstCombine] refine UB-handling in shuffle-binop transform

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 3 07:40:48 PDT 2018


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

As noted in https://reviews.llvm.org/rL333782, we can be both better for optimization and safer with this transform:
BinOp (shuffle V1, Mask), C --> shuffle (BinOp V1, NewC), Mask

The only potentially unsafe-to-speculate binops are integer div/rem. All other binops are always safe (although I don't see a way to assert that in code here).

For opcodes like shifts that can produce poison, it can't matter here because we know the lanes with undef are dropped by the subsequent shuffle.


https://reviews.llvm.org/D47686

Files:
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/vec_shuffle.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47686.149638.patch
Type: text/x-patch
Size: 10617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180603/2734714f/attachment.bin>


More information about the llvm-commits mailing list