Skip to content

Commit e2fe787

Browse files
authored
[Clang] Use "syncscope" instead of "synchscope". NFC. (#134616)
This matches the spelling of the keyword in LLVM IR.
1 parent 9fe6f6a commit e2fe787

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6757,7 +6757,7 @@ class PseudoObjectExpr final
67576757
/// and corresponding __opencl_atomic_* for OpenCL 2.0.
67586758
/// All of these instructions take one primary pointer, at least one memory
67596759
/// order. The instructions for which getScopeModel returns non-null value
6760-
/// take one synch scope.
6760+
/// take one sync scope.
67616761
class AtomicExpr : public Expr {
67626762
public:
67636763
enum AtomicOp {

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9076,7 +9076,7 @@ def err_atomic_op_needs_atomic_int : Error<
90769076
def warn_atomic_op_has_invalid_memory_order : Warning<
90779077
"%select{|success |failure }0memory order argument to atomic operation is invalid">,
90789078
InGroup<DiagGroup<"atomic-memory-ordering">>;
9079-
def err_atomic_op_has_invalid_synch_scope : Error<
9079+
def err_atomic_op_has_invalid_sync_scope : Error<
90809080
"synchronization scope argument to atomic operation is invalid">;
90819081
def warn_atomic_implicit_seq_cst : Warning<
90829082
"implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,

clang/include/clang/Basic/SyncScope.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121

2222
namespace clang {
2323

24-
/// Defines synch scope values used internally by clang.
24+
/// Defines sync scope values used internally by clang.
2525
///
2626
/// The enum values start from 0 and are contiguous. They are mainly used for
27-
/// enumerating all supported synch scope values and mapping them to LLVM
28-
/// synch scopes. Their numerical values may be different from the corresponding
29-
/// synch scope enums used in source languages.
27+
/// enumerating all supported sync scope values and mapping them to LLVM
28+
/// sync scopes. Their numerical values may be different from the corresponding
29+
/// sync scope enums used in source languages.
3030
///
31-
/// In atomic builtin and expressions, language-specific synch scope enums are
31+
/// In atomic builtin and expressions, language-specific sync scope enums are
3232
/// used. Currently only OpenCL memory scope enums are supported and assumed
3333
/// to be used by all languages. However, in the future, other languages may
34-
/// define their own set of synch scope enums. The language-specific synch scope
34+
/// define their own set of sync scope enums. The language-specific sync scope
3535
/// values are represented by class AtomicScopeModel and its derived classes.
3636
///
3737
/// To add a new enum value:
@@ -88,39 +88,39 @@ inline llvm::StringRef getAsString(SyncScope S) {
8888
case SyncScope::OpenCLSubGroup:
8989
return "opencl_subgroup";
9090
}
91-
llvm_unreachable("Invalid synch scope");
91+
llvm_unreachable("Invalid sync scope");
9292
}
9393

9494
/// Defines the kind of atomic scope models.
9595
enum class AtomicScopeModelKind { None, OpenCL, HIP, Generic };
9696

97-
/// Defines the interface for synch scope model.
97+
/// Defines the interface for sync scope model.
9898
class AtomicScopeModel {
9999
public:
100100
virtual ~AtomicScopeModel() {}
101-
/// Maps language specific synch scope values to internal
101+
/// Maps language specific sync scope values to internal
102102
/// SyncScope enum.
103103
virtual SyncScope map(unsigned S) const = 0;
104104

105-
/// Check if the compile-time constant synch scope value
105+
/// Check if the compile-time constant sync scope value
106106
/// is valid.
107107
virtual bool isValid(unsigned S) const = 0;
108108

109-
/// Get all possible synch scope values that might be
109+
/// Get all possible sync scope values that might be
110110
/// encountered at runtime for the current language.
111111
virtual ArrayRef<unsigned> getRuntimeValues() const = 0;
112112

113113
/// If atomic builtin function is called with invalid
114-
/// synch scope value at runtime, it will fall back to a valid
115-
/// synch scope value returned by this function.
114+
/// sync scope value at runtime, it will fall back to a valid
115+
/// sync scope value returned by this function.
116116
virtual unsigned getFallBackValue() const = 0;
117117

118118
/// Create an atomic scope model by AtomicScopeModelKind.
119119
/// \return an empty std::unique_ptr for AtomicScopeModelKind::None.
120120
static std::unique_ptr<AtomicScopeModel> create(AtomicScopeModelKind K);
121121
};
122122

123-
/// Defines the synch scope model for OpenCL.
123+
/// Defines the sync scope model for OpenCL.
124124
class AtomicScopeOpenCLModel : public AtomicScopeModel {
125125
public:
126126
/// The enum values match the pre-defined macros
@@ -147,7 +147,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
147147
case SubGroup:
148148
return SyncScope::OpenCLSubGroup;
149149
}
150-
llvm_unreachable("Invalid language synch scope value");
150+
llvm_unreachable("Invalid language sync scope value");
151151
}
152152

153153
bool isValid(unsigned S) const override {
@@ -156,7 +156,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
156156
}
157157

158158
ArrayRef<unsigned> getRuntimeValues() const override {
159-
static_assert(Last == SubGroup, "Does not include all synch scopes");
159+
static_assert(Last == SubGroup, "Does not include all sync scopes");
160160
static const unsigned Scopes[] = {
161161
static_cast<unsigned>(WorkGroup), static_cast<unsigned>(Device),
162162
static_cast<unsigned>(AllSVMDevices), static_cast<unsigned>(SubGroup)};
@@ -168,7 +168,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
168168
}
169169
};
170170

171-
/// Defines the synch scope model for HIP.
171+
/// Defines the sync scope model for HIP.
172172
class AtomicScopeHIPModel : public AtomicScopeModel {
173173
public:
174174
/// The enum values match the pre-defined macros
@@ -198,7 +198,7 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
198198
case System:
199199
return SyncScope::HIPSystem;
200200
}
201-
llvm_unreachable("Invalid language synch scope value");
201+
llvm_unreachable("Invalid language sync scope value");
202202
}
203203

204204
bool isValid(unsigned S) const override {
@@ -207,7 +207,7 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
207207
}
208208

209209
ArrayRef<unsigned> getRuntimeValues() const override {
210-
static_assert(Last == System, "Does not include all synch scopes");
210+
static_assert(Last == System, "Does not include all sync scopes");
211211
static const unsigned Scopes[] = {
212212
static_cast<unsigned>(SingleThread), static_cast<unsigned>(Wavefront),
213213
static_cast<unsigned>(Workgroup), static_cast<unsigned>(Agent),

clang/lib/CodeGen/CGAtomic.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,8 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *Expr, Address Dest,
781781
llvm::Value *Scope) {
782782
auto ScopeModel = Expr->getScopeModel();
783783

784-
// LLVM atomic instructions always have synch scope. If clang atomic
785-
// expression has no scope operand, use default LLVM synch scope.
784+
// LLVM atomic instructions always have sync scope. If clang atomic
785+
// expression has no scope operand, use default LLVM sync scope.
786786
if (!ScopeModel) {
787787
llvm::SyncScope::ID SS;
788788
if (CGF.getLangOpts().OpenCL)
@@ -821,8 +821,8 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *Expr, Address Dest,
821821
CGF.createBasicBlock("atomic.scope.continue", CGF.CurFn);
822822

823823
auto *SC = Builder.CreateIntCast(Scope, Builder.getInt32Ty(), false);
824-
// If unsupported synch scope is encountered at run time, assume a fallback
825-
// synch scope value.
824+
// If unsupported sync scope is encountered at run time, assume a fallback
825+
// sync scope value.
826826
auto FallBack = ScopeModel->getFallBackValue();
827827
llvm::SwitchInst *SI = Builder.CreateSwitch(SC, BB[FallBack]);
828828
for (auto S : Scopes) {

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4229,7 +4229,7 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
42294229
if (std::optional<llvm::APSInt> Result =
42304230
Scope->getIntegerConstantExpr(Context)) {
42314231
if (!ScopeModel->isValid(Result->getZExtValue()))
4232-
Diag(Scope->getBeginLoc(), diag::err_atomic_op_has_invalid_synch_scope)
4232+
Diag(Scope->getBeginLoc(), diag::err_atomic_op_has_invalid_sync_scope)
42334233
<< Scope->getSourceRange();
42344234
}
42354235
SubExprs.push_back(Scope);

clang/test/SemaOpenCL/atomic-ops.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void memory_checks(atomic_int *Ap, int *p, int val) {
159159
(void)__opencl_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_relaxed, memory_scope_work_group);
160160
}
161161

162-
void synchscope_checks(atomic_int *Ap, int scope) {
162+
void syncscope_checks(atomic_int *Ap, int scope) {
163163
(void)__opencl_atomic_load(Ap, memory_order_relaxed, memory_scope_work_item); // expected-error{{synchronization scope argument to atomic operation is invalid}}
164164
(void)__opencl_atomic_load(Ap, memory_order_relaxed, memory_scope_work_group);
165165
(void)__opencl_atomic_load(Ap, memory_order_relaxed, memory_scope_device);

0 commit comments

Comments
 (0)