summaryrefslogtreecommitdiff
path: root/openmp/libomptarget/DeviceRTL/src/State.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2023-07-18 16:05:08 -0700
committerJohannes Doerfert <johannes@jdoerfert.de>2023-07-18 16:50:50 -0700
commit88a68de14cf66d067be54b8127c17b51192f2aa8 (patch)
tree30152f4050be3cb37cabb321b6f0fb9e59714a67 /openmp/libomptarget/DeviceRTL/src/State.cpp
parent621d1d07d9c426875323ed7a996758477ae33517 (diff)
[OpenMP][NFCI] Split assertion message from assertion expression
We ended up with `llvm.assume(icmp ne ptr as(4) null, as(4) @str)` because the string in address space 4 was not known to be non-null. There is no need to create these assumes.
Diffstat (limited to 'openmp/libomptarget/DeviceRTL/src/State.cpp')
-rw-r--r--openmp/libomptarget/DeviceRTL/src/State.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/openmp/libomptarget/DeviceRTL/src/State.cpp b/openmp/libomptarget/DeviceRTL/src/State.cpp
index 9c1c9abaf493..b97d230fd501 100644
--- a/openmp/libomptarget/DeviceRTL/src/State.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/State.cpp
@@ -142,7 +142,7 @@ void *SharedMemorySmartStackTy::push(uint64_t Bytes) {
void *GlobalMemory = memory::allocGlobal(
AlignedBytes, "Slow path shared memory allocation, insufficient "
"shared memory stack memory!");
- ASSERT(GlobalMemory != nullptr && "nullptr returned by malloc!");
+ ASSERT(GlobalMemory != nullptr, "nullptr returned by malloc!");
return GlobalMemory;
}
@@ -189,12 +189,12 @@ bool state::ICVStateTy::operator==(const ICVStateTy &Other) const {
}
void state::ICVStateTy::assertEqual(const ICVStateTy &Other) const {
- ASSERT(NThreadsVar == Other.NThreadsVar);
- ASSERT(LevelVar == Other.LevelVar);
- ASSERT(ActiveLevelVar == Other.ActiveLevelVar);
- ASSERT(MaxActiveLevelsVar == Other.MaxActiveLevelsVar);
- ASSERT(RunSchedVar == Other.RunSchedVar);
- ASSERT(RunSchedChunkVar == Other.RunSchedChunkVar);
+ ASSERT(NThreadsVar == Other.NThreadsVar, nullptr);
+ ASSERT(LevelVar == Other.LevelVar, nullptr);
+ ASSERT(ActiveLevelVar == Other.ActiveLevelVar, nullptr);
+ ASSERT(MaxActiveLevelsVar == Other.MaxActiveLevelsVar, nullptr);
+ ASSERT(RunSchedVar == Other.RunSchedVar, nullptr);
+ ASSERT(RunSchedChunkVar == Other.RunSchedChunkVar, nullptr);
}
void state::TeamStateTy::init(bool IsSPMD) {
@@ -217,8 +217,8 @@ bool state::TeamStateTy::operator==(const TeamStateTy &Other) const {
void state::TeamStateTy::assertEqual(TeamStateTy &Other) const {
ICVState.assertEqual(Other.ICVState);
- ASSERT(ParallelTeamSize == Other.ParallelTeamSize);
- ASSERT(HasThreadState == Other.HasThreadState);
+ ASSERT(ParallelTeamSize == Other.ParallelTeamSize, nullptr);
+ ASSERT(HasThreadState == Other.HasThreadState, nullptr);
}
state::TeamStateTy SHARED(ompx::state::TeamState);
@@ -251,7 +251,7 @@ void state::init(bool IsSPMD) {
}
void state::enterDataEnvironment(IdentTy *Ident) {
- ASSERT(config::mayUseThreadStates() &&
+ ASSERT(config::mayUseThreadStates(),
"Thread state modified while explicitly disabled!");
if (!config::mayUseThreadStates())
return;
@@ -269,7 +269,7 @@ void state::enterDataEnvironment(IdentTy *Ident) {
atomic::seq_cst, atomic::seq_cst))
memory::freeGlobal(ThreadStatesPtr,
"Thread state array allocated multiple times");
- ASSERT(atomic::load(ThreadStatesBitsPtr, atomic::seq_cst) &&
+ ASSERT(atomic::load(ThreadStatesBitsPtr, atomic::seq_cst),
"Expected valid thread states bit!");
}
NewThreadState->init(ThreadStates[TId]);
@@ -278,7 +278,7 @@ void state::enterDataEnvironment(IdentTy *Ident) {
}
void state::exitDataEnvironment() {
- ASSERT(config::mayUseThreadStates() &&
+ ASSERT(config::mayUseThreadStates(),
"Thread state modified while explicitly disabled!");
unsigned TId = mapping::getThreadIdInBlock();
@@ -309,7 +309,7 @@ void state::assumeInitialState(bool IsSPMD) {
TeamStateTy InitialTeamState;
InitialTeamState.init(IsSPMD);
InitialTeamState.assertEqual(TeamState);
- ASSERT(mapping::isSPMDMode() == IsSPMD);
+ ASSERT(mapping::isSPMDMode() == IsSPMD, nullptr);
}
extern "C" {
@@ -323,7 +323,7 @@ int omp_get_max_threads(void) { return icv::NThreads; }
int omp_get_level(void) {
int LevelVar = icv::Level;
- ASSERT(LevelVar >= 0);
+ ASSERT(LevelVar >= 0, nullptr);
return LevelVar;
}
@@ -445,7 +445,7 @@ void __kmpc_begin_sharing_variables(void ***GlobalArgs, uint64_t nArgs) {
} else {
SharedMemVariableSharingSpacePtr = (void **)memory::allocGlobal(
nArgs * sizeof(void *), "new extended args");
- ASSERT(SharedMemVariableSharingSpacePtr != nullptr &&
+ ASSERT(SharedMemVariableSharingSpacePtr != nullptr,
"Nullptr returned by malloc!");
}
*GlobalArgs = SharedMemVariableSharingSpacePtr;