Skip to content

Commit 4105177

Browse files
committed
[NVPTX] Simplify error output when SyncScope ID not found
1 parent 629a056 commit 4105177

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4176,7 +4176,7 @@ bool NVPTXDAGToDAGISel::tryFence(SDNode *N) {
41764176
return true;
41774177
}
41784178

4179-
NVPTXScopes::NVPTXScopes(LLVMContext &C) : CTX(&C) {
4179+
NVPTXScopes::NVPTXScopes(LLVMContext &C) {
41804180
Scopes[C.getOrInsertSyncScopeID("singlethread")] = NVPTX::Scope::Thread;
41814181
Scopes[C.getOrInsertSyncScopeID("")] = NVPTX::Scope::System;
41824182
Scopes[C.getOrInsertSyncScopeID("block")] = NVPTX::Scope::Block;
@@ -4191,13 +4191,11 @@ NVPTX::Scope NVPTXScopes::operator[](SyncScope::ID ID) const {
41914191

41924192
auto S = Scopes.find(ID);
41934193
if (S == Scopes.end()) {
4194-
SmallVector<StringRef, 8> ScopeNames;
4195-
assert(CTX != nullptr && "CTX is nullptr");
4196-
CTX->getSyncScopeNames(ScopeNames);
4197-
StringRef Unknown{"unknown"};
4198-
auto Name = ID < ScopeNames.size() ? ScopeNames[ID] : Unknown;
4199-
report_fatal_error(
4200-
formatv("Could not find scope ID={} with name \"{}\".", int(ID), Name));
4194+
// TODO:
4195+
// - Add API to LLVMContext to get the name of a single scope.
4196+
// - Use that API here to print an error containing the name
4197+
// of this Unknown ID.
4198+
report_fatal_error(formatv("Could not find scope ID={}.", int(ID)));
42014199
}
42024200
return S->second;
42034201
}

llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ struct NVPTXScopes {
3535

3636
private:
3737
SmallMapVector<SyncScope::ID, NVPTX::Scope, 8> Scopes{};
38-
LLVMContext *CTX = nullptr;
3938
};
4039

4140
class LLVM_LIBRARY_VISIBILITY NVPTXDAGToDAGISel : public SelectionDAGISel {

0 commit comments

Comments
 (0)