[OPENMP]Fix overflow during counting the number of iterations.
authorAlexey Bataev <a.bataev@hotmail.com>
Thu, 4 Jun 2020 16:07:13 +0000 (12:07 -0400)
committerAlexey Bataev <a.bataev@hotmail.com>
Wed, 17 Jun 2020 12:47:01 +0000 (08:47 -0400)
commit08029595ca36067e23d22c2a8732aba0d4afb50a
tree0eaf7bd04fd988c4700b2a79bdccbf3548e8aa36
parent34ee2549a72c2947fb3f6677fbe8ad97da100011
[OPENMP]Fix overflow during counting the number of iterations.

Summary:
The OpenMP loops are normalized and transformed into the loops from 0 to
max number of iterations. In some cases, original scheme may lead to
overflow during calculation of number of iterations. If it is unknown,
if we can end up with overflow or not (the bounds are not constant and
  we cannot define if there is an overflow), cast original type to the
  unsigned.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, openmp-commits, cfe-commits, caomhin

Tags: #clang, #openmp

Differential Revision: https://reviews.llvm.org/D81881
14 files changed:
clang/lib/Sema/SemaOpenMP.cpp
clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c
clang/test/AST/ast-dump-openmp-teams-distribute-simd.c
clang/test/AST/ast-dump-openmp-teams-distribute.c
clang/test/OpenMP/for_codegen.cpp
clang/test/OpenMP/master_taskloop_reduction_codegen.cpp
clang/test/OpenMP/master_taskloop_simd_reduction_codegen.cpp
clang/test/OpenMP/ordered_doacross_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_reduction_codegen.cpp
clang/test/OpenMP/parallel_master_taskloop_simd_reduction_codegen.cpp
clang/test/OpenMP/taskloop_reduction_codegen.cpp
clang/test/OpenMP/taskloop_simd_reduction_codegen.cpp
openmp/runtime/test/worksharing/for/omp_for_bigbounds.c