[llvm] r353082 - [WarnMissedTransforms] Do not warn about already vectorized loops.
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 5 04:51:41 PST 2019
Merged to 8.0 in r353166. Please let me know if there are any follow-ups.
Thanks,
Hans
On Mon, Feb 4, 2019 at 8:55 PM Michael Kruse via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
> Author: meinersbur
> Date: Mon Feb 4 11:55:59 2019
> New Revision: 353082
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353082&view=rev
> Log:
> [WarnMissedTransforms] Do not warn about already vectorized loops.
>
> LoopVectorize adds llvm.loop.isvectorized, but leaves
> llvm.loop.vectorize.enable. Do not consider such a loop for user-forced
> vectorization since vectorization already happened -- by prioritizing
> llvm.loop.isvectorized except for TM_SuppressedByUser.
>
> Fixes http://llvm.org/PR40546
>
> Differential Revision: https://reviews.llvm.org/D57542
>
> Added:
> llvm/trunk/test/Transforms/LoopTransformWarning/enable_and_isvectorized.ll
> Modified:
> llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp
>
> Modified: llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp?rev=353082&r1=353081&r2=353082&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/LoopUtils.cpp Mon Feb 4 11:55:59 2019
> @@ -378,17 +378,17 @@ TransformationMode llvm::hasVectorizeTra
> Optional<int> InterleaveCount =
> getOptionalIntLoopAttribute(L, "llvm.loop.interleave.count");
>
> - if (Enable == true) {
> - // 'Forcing' vector width and interleave count to one effectively disables
> - // this tranformation.
> - if (VectorizeWidth == 1 && InterleaveCount == 1)
> - return TM_SuppressedByUser;
> - return TM_ForcedByUser;
> - }
> + // 'Forcing' vector width and interleave count to one effectively disables
> + // this tranformation.
> + if (Enable == true && VectorizeWidth == 1 && InterleaveCount == 1)
> + return TM_SuppressedByUser;
>
> if (getBooleanLoopAttribute(L, "llvm.loop.isvectorized"))
> return TM_Disable;
>
> + if (Enable == true)
> + return TM_ForcedByUser;
> +
> if (VectorizeWidth == 1 && InterleaveCount == 1)
> return TM_Disable;
>
>
> Added: llvm/trunk/test/Transforms/LoopTransformWarning/enable_and_isvectorized.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopTransformWarning/enable_and_isvectorized.ll?rev=353082&view=auto
> ==============================================================================
> --- llvm/trunk/test/Transforms/LoopTransformWarning/enable_and_isvectorized.ll (added)
> +++ llvm/trunk/test/Transforms/LoopTransformWarning/enable_and_isvectorized.ll Mon Feb 4 11:55:59 2019
> @@ -0,0 +1,33 @@
> +; RUN: opt -transform-warning -disable-output < %s 2>&1 | FileCheck -allow-empty %s
> +;
> +; llvm.org/PR40546
> +; Do not warn about about leftover llvm.loop.vectorize.enable for already
> +; vectorized loops.
> +
> +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> +
> +define void @test(i32 %n) {
> +entry:
> + %cmp = icmp eq i32 %n, 0
> + br i1 %cmp, label %simd.if.end, label %omp.inner.for.body.preheader
> +
> +omp.inner.for.body.preheader:
> + %wide.trip.count = zext i32 %n to i64
> + br label %omp.inner.for.body
> +
> +omp.inner.for.body:
> + %indvars.iv = phi i64 [ 0, %omp.inner.for.body.preheader ], [ %indvars.iv.next, %omp.inner.for.body ]
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
> + %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
> + br i1 %exitcond, label %simd.if.end, label %omp.inner.for.body, !llvm.loop !0
> +
> +simd.if.end:
> + ret void
> +}
> +
> +!0 = distinct !{!0, !1, !2}
> +!1 = !{!"llvm.loop.vectorize.enable", i1 true}
> +!2 = !{!"llvm.loop.isvectorized"}
> +
> +
> +; CHECK-NOT: loop not vectorized
>
>
> _______________________________________________
> 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