[PATCH] D31525: InstSimplify: Add a hook for shufflevector

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 09:10:16 PDT 2017


zvi added a comment.

In https://reviews.llvm.org/D31525#715234, @spatel wrote:

> Why would a shuffle with undef mask automatically return undef? For example:
>  shufflevector <2 x i8> <i8 42, i8 42>, <2 x i8> <i8 42, i8 42>, <2 x i32> undef
>
> Should this be constant folded to <i8 42, i8 42> , <2 x i8> undef or something else?


I was asking myself the same question when i saw this in both InstCombine <https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/InstCombineVectorOps.cpp#L1145> and in ConstanFolding <https://github.com/llvm-mirror/llvm/blob/master/lib/IR/ConstantFold.cpp#L836>. SimplifyDemandedVectorElts behaves the same.
I couldn't deduce this is allowed from reading the language reference.


Repository:
  rL LLVM

https://reviews.llvm.org/D31525





More information about the llvm-commits mailing list