Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / DeviceRTL / src / Debug.cpp
blobdd627fc65d8f64dd368b0ba8d4acee5490079847
1 //===--- Debug.cpp -------- Debug utilities ----------------------- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains debug utilities
11 //===----------------------------------------------------------------------===//
13 #include "Debug.h"
14 #include "Configuration.h"
15 #include "Environment.h"
16 #include "Interface.h"
17 #include "Mapping.h"
18 #include "State.h"
19 #include "Types.h"
21 using namespace ompx;
23 #pragma omp begin declare target device_type(nohost)
25 extern "C" {
26 void __assert_assume(bool condition) { __builtin_assume(condition); }
28 void __assert_fail(const char *expr, const char *file, unsigned line,
29 const char *function) {
30 __assert_fail_internal(expr, nullptr, file, line, function);
32 void __assert_fail_internal(const char *expr, const char *msg, const char *file,
33 unsigned line, const char *function) {
34 if (msg) {
35 PRINTF("%s:%u: %s: Assertion %s (`%s') failed.\n", file, line, function,
36 msg, expr);
37 } else {
38 PRINTF("%s:%u: %s: Assertion `%s' failed.\n", file, line, function, expr);
40 __builtin_trap();
44 #pragma omp end declare target