[llvm] r301764 - InstructionSimplify: Simplify a shuffle with a undef mask to undef

Andrew Adams via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 17:26:03 PDT 2017


Hi Zvi,

I think this commit, or one of the two related adjacent ones, may have
caused: https://bugs.llvm.org//show_bug.cgi?id=32872

I'm getting vector shuffle weirdness involving undefs.

- Andrew

On Sat, Apr 29, 2017 at 11:06 PM, Zvi Rackover via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: zvi
> Date: Sun Apr 30 01:06:26 2017
> New Revision: 301764
>
> URL: http://llvm.org/viewvc/llvm-project?rev=301764&view=rev
> Log:
> InstructionSimplify: Simplify a shuffle with a undef mask to undef
>
> Summary:
> Following the discussion in pr32486, adding the simplification:
>  shuffle %x, %y, undef -> undef
>
> Reviewers: spatel, RKSimon, andreadb, davide
>
> Reviewed By: spatel
>
> Subscribers: jroelofs, davide, llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D32293
>
> Modified:
>     llvm/trunk/lib/Analysis/InstructionSimplify.cpp
>     llvm/trunk/test/Transforms/InstSimplify/shufflevector.ll
>
> Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> Analysis/InstructionSimplify.cpp?rev=301764&r1=301763&r2=301764&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
> +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Sun Apr 30 01:06:26
> 2017
> @@ -4049,6 +4049,9 @@ static Value *foldIdentityShuffles(int D
>  static Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1, Constant
> *Mask,
>                                          Type *RetTy, const SimplifyQuery
> &Q,
>                                          unsigned MaxRecurse) {
> +  if (isa<UndefValue>(Mask))
> +    return UndefValue::get(RetTy);
> +
>    Type *InVecTy = Op0->getType();
>    unsigned MaskNumElts = Mask->getType()->getVectorNumElements();
>    unsigned InVecNumElts = InVecTy->getVectorNumElements();
>
> Modified: llvm/trunk/test/Transforms/InstSimplify/shufflevector.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> Transforms/InstSimplify/shufflevector.ll?rev=301764&
> r1=301763&r2=301764&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/Transforms/InstSimplify/shufflevector.ll (original)
> +++ llvm/trunk/test/Transforms/InstSimplify/shufflevector.ll Sun Apr 30
> 01:06:26 2017
> @@ -118,6 +118,14 @@ define <4 x i32> @undef_mask(<4 x i32> %
>    ret <4 x i32> %shuf
>  }
>
> +define <4 x i32> @undef_mask_1(<4 x i32> %x, <4 x i32> %y) {
> +; CHECK-LABEL: @undef_mask_1(
> +; CHECK-NEXT:    ret <4 x i32> undef
> +;
> +  %shuf = shufflevector <4 x i32> %x, <4 x i32> %y, <4 x i32> undef
> +  ret <4 x i32> %shuf
> +}
> +
>  define <4 x i32> @identity_mask_0(<4 x i32> %x) {
>  ; CHECK-LABEL: @identity_mask_0(
>  ; CHECK-NEXT:    ret <4 x i32> [[X:%.*]]
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170501/da809a9a/attachment.html>


More information about the llvm-commits mailing list