[llvm] 1674f77 - [VecotrCombine] Fix unused variable for assertion disabled builds

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 00:32:49 PST 2020


On Fri, Feb 14, 2020 at 11:30 AM Kadir Cetinkaya via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Kadir Cetinkaya
> Date: 2020-02-14T09:30:29+01:00
> New Revision: 1674f772b4ea67f62cb93536143107ef2bd25b7f
>
> URL: https://github.com/llvm/llvm-project/commit/1674f772b4ea67f62cb93536143107ef2bd25b7f
> DIFF: https://github.com/llvm/llvm-project/commit/1674f772b4ea67f62cb93536143107ef2bd25b7f.diff
>
> LOG: [VecotrCombine] Fix unused variable for assertion disabled builds
>
> Added:
>
>
> Modified:
>     llvm/lib/Transforms/Vectorize/VectorCombine.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
> index a70d962a8f48..f5a26d012de9 100644
> --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
> +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
> @@ -107,8 +107,6 @@ static bool foldExtractBinop(Instruction &I, const TargetTransformInfo &TTI) {
>    int VecBOCost = TTI.getArithmeticInstrCost(BOpcode, VecTy);
>    int Extract0Cost = TTI.getVectorInstrCost(Instruction::ExtractElement,
>                                              VecTy, C0);
> -  int Extract1Cost = TTI.getVectorInstrCost(Instruction::ExtractElement,
> -                                            VecTy, C1);
It would be best to instead add   (void)Extract1Cost;   and keep this variable.

>    // Handle a special case - if the extract indexes are the same, the
>    // replacement sequence does not require a shuffle. Unless the vector binop is
> @@ -116,7 +114,9 @@ static bool foldExtractBinop(Instruction &I, const TargetTransformInfo &TTI) {
>    // Extra uses of the extracts mean that we include those costs in the
>    // vector total because those instructions will not be eliminated.
>    if (C0 == C1) {
> -    assert(Extract0Cost == Extract1Cost && "Different costs for same extract?");
> +    assert(Extract0Cost ==
> +               TTI.getVectorInstrCost(Instruction::ExtractElement, VecTy, C1) &&
> +           "Different costs for same extract?");
>      int ExtractCost = Extract0Cost;
>      if (X != Y) {
>        int ScalarCost = ExtractCost + ExtractCost + ScalarBOCost;
>
>
>
> _______________________________________________
> 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