[all-commits] [llvm/llvm-project] cfd1d4: OpenMP: Avoid using SmallVector::set_size()

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Wed Dec 8 15:24:26 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cfd1d49dc0cc4369ace2e9485bdba04b27f158b5
      https://github.com/llvm/llvm-project/commit/cfd1d49dc0cc4369ace2e9485bdba04b27f158b5
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2021-12-08 (Wed, 08 Dec 2021)

  Changed paths:
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

  Log Message:
  -----------
  OpenMP: Avoid using SmallVector::set_size()

Update `OpenMPIRBuilder::collapseLoops()` to call `resize()` instead of
`set_size()`. The latter asserts on capacity limits and cannot grow,
which seems likely to be unintentional here (if it is, I think a local
assertion would be good for clarity).

Also update `CodeGenFunction::EmitOMPCollapsedCanonicalLoopNest()` to
use `pop_back_n()` instead of `set_size()`.

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




More information about the All-commits mailing list