[all-commits] [llvm/llvm-project] b79ed8: [OpenMP][OMPIRBuilder] Handle non-failing calls pr...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Thu Jan 9 02:28:38 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b79ed8729b3d6d5482481c41a7de2cd75b0f61df
      https://github.com/llvm/llvm-project/commit/b79ed8729b3d6d5482481c41a7de2cd75b0f61df
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    M llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

  Log Message:
  -----------
  [OpenMP][OMPIRBuilder] Handle non-failing calls properly (#115863)

The preprocessor definition used to enable asserts and the one that
`llvm::Error` and `llvm::Expected` use to ensure all created instances are
checked are not the same. By making these checks inside of an `assert` in cases
where errors are not expected, certain build configurations would trigger
runtime failures (e.g. `-DLLVM_ENABLE_ASSERTIONS=OFF
-DLLVM_UNREACHABLE_OPTIMIZE=ON`).

The `llvm::cantFail()` function, which was intended for this use case, is used
by this patch in place of `assert` to prevent these runtime failures. In tests,
new preprocessor definitions based on `ASSERT_THAT_EXPECTED` and
`EXPECT_THAT_EXPECTED` are used instead, to avoid silent failures in release
builds.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list