[all-commits] [llvm/llvm-project] 2f0a69: [OpenMP] Fix partial unrolling off-by-one.

Michael Kruse via All-commits all-commits at lists.llvm.org
Thu Jun 2 22:32:14 PDT 2022


  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f0a69c32a4c48473c187179a594ac035b244e74
      https://github.com/llvm/llvm-project/commit/2f0a69c32a4c48473c187179a594ac035b244e74
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2022-06-02 (Thu, 02 Jun 2022)

  Changed paths:
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/test/OpenMP/irbuilder_unroll_partial_factor_for_collapse.c
    M clang/test/OpenMP/irbuilder_unroll_partial_heuristic_for_collapse.c
    M clang/test/OpenMP/unroll_codegen_for_collapse_outer.cpp
    M clang/test/OpenMP/unroll_codegen_for_partial.cpp
    M clang/test/OpenMP/unroll_codegen_parallel_for_factor.cpp
    M clang/test/OpenMP/unroll_codegen_tile_for.cpp
    M clang/test/OpenMP/unroll_codegen_unroll_for.cpp
    M clang/test/OpenMP/unroll_codegen_unroll_for_attr.cpp

  Log Message:
  -----------
  [OpenMP] Fix partial unrolling off-by-one.

Even though the comment description is ".unroll_inner.iv < NumIterations", the code emitted a BO_LE ('<=') operator for the inner loop that is to be unrolled. This lead to one additional copy of the body code in a partially unrolled. It only manifests when the unrolled loop is consumed by another loop-associated construct. Fix by using the BO_LT operator instead.

The condition for the outer loop and the corresponding code for tiling correctly used BO_LT already.

Fixes #55236




More information about the All-commits mailing list