[llvm] 7b78206 - [InstCombine] Simplify code. NFCI.

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 10:14:57 PDT 2020


Nitpicking: this is not really NFC, because i don't think langref
states that all negative shuffle mask elements are undef, or that
there is a single possible negative shuffle mask, which is undef/-1.
I think this is something that might warrant some better docs either way.

Roman

On Sun, Sep 27, 2020 at 8:12 PM Benjamin Kramer via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Benjamin Kramer
> Date: 2020-09-27T19:11:07+02:00
> New Revision: 7b782062b4d580e48ab724e278f38cc3da763f02
>
> URL: https://github.com/llvm/llvm-project/commit/7b782062b4d580e48ab724e278f38cc3da763f02
> DIFF: https://github.com/llvm/llvm-project/commit/7b782062b4d580e48ab724e278f38cc3da763f02.diff
>
> LOG: [InstCombine] Simplify code. NFCI.
>
> Added:
>
>
> Modified:
>     llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
> index cf3dcc91de0a..b789c8b26cc5 100644
> --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
> +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
> @@ -2635,17 +2635,9 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
>    // If the result mask is equal to one of the original shuffle masks,
>    // or is a splat, do the replacement.
>    if (isSplat || newMask == LHSMask || newMask == RHSMask || newMask == Mask) {
> -    SmallVector<Constant*, 16> Elts;
> -    for (unsigned i = 0, e = newMask.size(); i != e; ++i) {
> -      if (newMask[i] < 0) {
> -        Elts.push_back(UndefValue::get(Int32Ty));
> -      } else {
> -        Elts.push_back(ConstantInt::get(Int32Ty, newMask[i]));
> -      }
> -    }
>      if (!newRHS)
>        newRHS = UndefValue::get(newLHS->getType());
> -    return new ShuffleVectorInst(newLHS, newRHS, ConstantVector::get(Elts));
> +    return new ShuffleVectorInst(newLHS, newRHS, newMask);
>    }
>
>    return MadeChange ? &SVI : nullptr;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list