Skip to content

Commit 88b2bb5

Browse files
committed
Multi call
1 parent ff69436 commit 88b2bb5

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

llvm/lib/Transforms/Instrumentation/GPUSan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ bool GPUSanImpl::instrument() {
799799
}
800800

801801
uint64_t AmbiguousCallsBitWidth =
802-
llvm::PowerOf2Ceil(AmbiguousCalls.size() + 1);
802+
llvm::Log2_64_Ceil(AmbiguousCalls.size() + 1);
803803

804804
new GlobalVariable(M, Int64Ty, /*isConstant=*/true,
805805
GlobalValue::ExternalLinkage,
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// clang-format off
2+
// : %libomptarget-compileoptxx-generic -fsanitize=offload -O1
3+
// : not %libomptarget-run-generic 2> %t.out
4+
// : %fcheck-generic --check-prefixes=CHECK < %t.out
5+
// : %libomptarget-compileoptxx-generic -fsanitize=offload -O3
6+
// : not %libomptarget-run-generic 2> %t.out
7+
// RUN: %libomptarget-compileoptxx-generic -fsanitize=offload -O3 -g
8+
// RUN: not %libomptarget-run-generic 2> %t.out
9+
// RUN: %fcheck-generic --check-prefixes=DEBUG < %t.out
10+
// clang-format on
11+
12+
// UNSUPPORTED: aarch64-unknown-linux-gnu
13+
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
14+
// UNSUPPORTED: x86_64-pc-linux-gnu
15+
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
16+
// UNSUPPORTED: s390x-ibm-linux-gnu
17+
// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
18+
19+
#include <omp.h>
20+
21+
template <typename T> [[clang::optnone]] T deref(T *P) { return *P; }
22+
23+
template <int LEVEL, typename T> [[gnu::noinline]] T level(T *P) {
24+
if constexpr (LEVEL > 1)
25+
return level<LEVEL - 1>(P) + level<LEVEL - 2>(P);
26+
if constexpr (LEVEL > 0)
27+
return level<LEVEL - 1>(P);
28+
return deref(P);
29+
}
30+
31+
int main(void) {
32+
33+
int *ValidInt = (int *)omp_target_alloc(4, omp_get_default_device());
34+
#pragma omp target is_device_ptr(ValidInt)
35+
{
36+
level<12>(ValidInt);
37+
short *ValidShort = ((short *)ValidInt) + 2;
38+
level<12>(ValidShort);
39+
char *Invalid = ((char *)ValidInt) + 4;
40+
level<12>(Invalid);
41+
}
42+
}

0 commit comments

Comments
 (0)