[all-commits] [llvm/llvm-project] 8a9e4f: [Clang][OpenMPIRBuilder] Fix off-by-one error when...

Michael Kruse via All-commits all-commits at lists.llvm.org
Mon Jan 31 15:29:06 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a9e4f245b66b90839bdf34e91cb0901e3260dad
      https://github.com/llvm/llvm-project/commit/8a9e4f245b66b90839bdf34e91cb0901e3260dad
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2022-01-31 (Mon, 31 Jan 2022)

  Changed paths:
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/test/OpenMP/irbuilder_for_unsigned.c
    A clang/test/OpenMP/irbuilder_for_unsigned_down.c
    M clang/test/OpenMP/irbuilder_unroll_full.c
    M clang/test/OpenMP/irbuilder_unroll_heuristic.c
    M clang/test/OpenMP/irbuilder_unroll_partial_factor.c
    M clang/test/OpenMP/irbuilder_unroll_partial_factor_for.c
    M clang/test/OpenMP/irbuilder_unroll_partial_heuristic.c
    M clang/test/OpenMP/irbuilder_unroll_partial_heuristic_constant_for.c
    M clang/test/OpenMP/irbuilder_unroll_partial_heuristic_runtime_for.c
    M clang/test/OpenMP/irbuilder_unroll_unroll_partial_factor.c
    M clang/test/OpenMP/irbuilder_unroll_unroll_partial_heuristic.c

  Log Message:
  -----------
  [Clang][OpenMPIRBuilder] Fix off-by-one error when dividing by stepsize.

When the stepsize does not evenly divide the range's end, round-up to ensure that that last multiple of the stepsize before the reaching the upper boud is reached. For instance, the trip count of

    for (int i = 0; i < 7; i+=5)

is two (i=0 and i=5), not (7-0)/5 == 1.

Reviewed By: peixin

Differential Revision: https://reviews.llvm.org/D118542




More information about the All-commits mailing list