Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
e0bc382
[flang] Fix standalone build regression from #161179 (#164309)
mgorny Oct 21, 2025
e4f3e9a
[AMDGPU] Remove magic constants from V_PK_ADD_F32 pattern. NFC (#164335)
rampitec Oct 21, 2025
07d47c7
[AMDGPU] Update code sequence for CU-mode Release Fences in GFX10+ (#…
Pierre-vh Oct 21, 2025
ec26f21
[InstSimplify] Support ptrtoaddr in simplifyGEPInst() (#164262)
nikic Oct 21, 2025
db478ba
[Hexagon] Add REQUIRES: asserts to test
nikic Oct 21, 2025
34c6fa3
[AArch64] Combing scalar_to_reg into DUP if the DUP already exists (#…
davemgreen Oct 21, 2025
1bf7ed2
[CAS] OnDiskGraphDB - fix MSVC "not all control paths return a value"…
RKSimon Oct 21, 2025
253e435
Reapply "[libc++] Optimize __hash_table::erase(iterator, iterator)" (…
philnik777 Oct 21, 2025
8da0df4
[TableGen] List the indices of sub-operands (#163723)
statham-arm Oct 21, 2025
f188c97
[lldb] Add bidirectional packetLog to gdbclientutils.py (#162176)
dsandersllvm Oct 21, 2025
00092f9
[MLIR] [Vector] Added canonicalizer for folding from_elements + trans…
keshavvinayak01 Oct 21, 2025
ab789be
[DA] Add initial support for monotonicity check (#162280)
kasuga-fj Oct 21, 2025
cc850b8
[VPlan] Use VPlan::getRegion to shorten code (NFC) (#164287)
artagnon Oct 21, 2025
3fbae10
[VPlan] Improve code using m_APInt (NFC) (#161683)
artagnon Oct 21, 2025
1360aec
[SystemZ] Avoid trunc(add(X,X)) patterns (#164378)
RKSimon Oct 21, 2025
efcda54
[clang][CodeGen] Emit `llvm.tbaa.errno` metadata during module creation
antoniofrighetto Oct 21, 2025
822c291
[LV][NFC] Remove undef from phi incoming values (#163762)
david-arm Oct 21, 2025
2eb9251
[DA] Add option to enable specific dependence test only (#164245)
kasuga-fj Oct 21, 2025
c06ae43
[libcxx] Optimize `std::generate_n` for segmented iterators (#164266)
c8ef Oct 21, 2025
2bbc4ae
[BOLT] Check entry point address is not in constant island (#163418)
Asher8118 Oct 21, 2025
909f429
[llvm][dwarfdump] Pretty-print DW_AT_language_version (#164222)
Michael137 Oct 21, 2025
f8edcba
[DAG] visitTRUNCATE - more aggressively fold trunc(add(x,x)) -> add(t…
RKSimon Oct 21, 2025
889db04
Minor optimizations to DW_OP_LLVM_extract_bits_* (#163812)
tromey Oct 21, 2025
8d29d09
[VPlan] Run narrowInterleaveGroups during general VPlan optimizations…
fhahn Oct 21, 2025
5440cfc
[clang] Add support for cluster sync scope (#162575)
macurtis-amd Oct 21, 2025
d6e2143
[mlir][dataflow] Fix LivenessAnalysis/RemoveDeadValues handling of lo…
linuxlonelyeagle Oct 21, 2025
bdcbc1e
[LLVM][InstCombine] Preserve vector types when shrinking FP constants…
paulwalker-arm Oct 21, 2025
26feb1a
[PowerPC] Remove `UnsafeFPMath` uses (#154901)
paperchalice Oct 21, 2025
34cf8bb
[flang][OpenMP] Use parser::UnwrapRef instead of thing/value, NFC (#1…
kparzysz Oct 21, 2025
a042f69
[flang][OpenMP] Remember to set source in OmpBlockConstruct (#164131)
kparzysz Oct 21, 2025
33f812d
[mlir][sve] Extend the e2e test for linalg.pack + linalg.unpack (#158…
banach-space Oct 21, 2025
be2c6c1
[flang] Fix dumping type names for clang in DumpEvExpr (#164256)
kparzysz Oct 21, 2025
e9b6d35
[LLDB][PDB] Split `func-symbols.test` between DIA and native (#163733)
Nerixyz Oct 21, 2025
531d45d
[LLDB][PDB] Run `pointers.test` with both plugins (#163623)
Nerixyz Oct 21, 2025
186182b
[Offload] Use `amd_signal_async_handler` for host function calls (#15…
RossBrunton Oct 21, 2025
fbcd82a
[Windows] Fix Registry static data members not exported by extract_sy…
zond Oct 21, 2025
d9556d3
[LLDB][NativePDB] Require `target-windows` for `func-symbols.test` (#…
Nerixyz Oct 21, 2025
6e9a5c9
[flang] Remove "unsafe-fp-math" attribute support (#162783)
paperchalice Oct 21, 2025
c8c5a38
[clang][bytecode] Move shared interp functions to InterpHelpers.h (#1…
tbaederr Oct 21, 2025
95d1b4f
[CIR] Add support for atomic test-and-set and atomic clear (#164162)
Lancern Oct 21, 2025
c5f9a2a
[clang][bytecode] Don't emit checkNull for function pointers (#164376)
tbaederr Oct 21, 2025
573b624
[mlir][spirv] Remove `function-decorations-asserts.mlir` (#164383)
IgWod-IMG Oct 21, 2025
a585448
[flang][OpenMP] Move check of ALIGN clause to visitor function (#164261)
kparzysz Oct 21, 2025
14af435
[NFC][support]Add operator- to TimeRecord (#163361)
necto Oct 21, 2025
88d303e
[cmake][compiler-rt] Define _DEFAULT_SOURCE instead of enabling exten…
tambry Oct 21, 2025
6c4d121
[IR] Do not combine ptrtoaddr and trunc
nikic Oct 21, 2025
da48e41
[ORC] Fix compile error (#164411)
googlewalt Oct 21, 2025
7b91bb2
[clang][bytecode] Fix redeclaring global externs without initializer …
tbaederr Oct 21, 2025
b0c89a9
[mlir][LLVMIR] Remove "unsafe-fp-math" attribute support (#162782)
paperchalice Oct 21, 2025
bffdf0b
[libc++] Allow customizing trendline in visualize-historical script
ldionne Oct 21, 2025
7aa6c62
[PowecPC] Hint branch `bne-` for atomic operation after the store-co…
diggerlin Oct 21, 2025
20675ee
[SLP] Check all copyable children for non-schedulable parent nodes
alexey-bataev Oct 20, 2025
83927a6
[Modules] Fix LLVM_ENABLE_MODULES build (NFC) (#164402)
naveen-seth Oct 21, 2025
683e2bf
[ThinLTO] Make SummaryList private (NFC) (#164355)
teresajohnson Oct 21, 2025
58abcf6
[ADT] Modernize SparseMultiSet to use llvm::identity_cxx20 (NFC) (#16…
kazutakahirata Oct 21, 2025
4098e26
[ADT] Modernize SparseSet to use llvm::identity_cxx20 (NFC) (#164362)
kazutakahirata Oct 21, 2025
03d26db
[ADT] Document C++20 migration path for llvm::is_detected (#164363)
kazutakahirata Oct 21, 2025
956836c
[Orc] Migrate ExecutorAddr::rawPtr to llvm::identity_cxx20 (NFC) (#16…
kazutakahirata Oct 21, 2025
a34e8c3
[llvm] Proofread TableGen/BackGuide.rst (#164365)
kazutakahirata Oct 21, 2025
1e99026
[clang][bytecode] Fix `__builtin_strchr` with unsigned chars (#164410)
tbaederr Oct 21, 2025
fedbb0f
[libc] Capture 'POLY_COEFFS' by reference in asinpi_polyeval lambda. …
renhiyama Oct 21, 2025
48a99ad
[libc] Add llvm-libc-types header deps for <complex.h>. (#164422)
statham-arm Oct 21, 2025
550b62c
[clang] callee_type metadata for indirect calls (#163233)
Prabhuk Oct 21, 2025
abf80b5
[libc++][IWYU] Remove `std::move` header in `std::for_each` (#164272)
c8ef Oct 21, 2025
9e7209c
[clang][bytecode][NFC] Clean up variable creation (#164415)
tbaederr Oct 21, 2025
2ec01e4
[VPlan] Move two VPBlockUtils members (NFC) (#162507)
artagnon Oct 21, 2025
554ea40
[NFC][Clang][Diagnostics] Remove the DeferHint parameter of Diags(...…
jmmartinez Oct 21, 2025
5b3416c
[libc] implement `inet_aton` (#162651)
c8ef Oct 21, 2025
23339c4
[SPIR-V] Use `OpImageFetch` instead of `OpImageRead` when loading fro…
luciechoi Oct 21, 2025
6d5dea6
[ARM][SDAG] Add llvm.lround half promotion. (#164235)
davemgreen Oct 21, 2025
3161e16
[CIR] Atomic fetch operation (#161631)
Lancern Oct 21, 2025
0c0ad11
[acc][flang] lowering of acc declare on COMMON variables (#163676)
SusanTan Oct 21, 2025
fb870cb
[ORC] Fix unused variable warning (#164444)
googlewalt Oct 21, 2025
b1322c4
[compiler-rt] [CMake] Skip find_darwin_sdk_dir on disabled platforms …
ndrewh Oct 21, 2025
3155b05
[CIR] Implement inline builtin functions (#163911)
mmha Oct 21, 2025
311a199
[X86] Add ctpop/ctlz/cttz test coverage for very large integers (#164…
RKSimon Oct 21, 2025
70f7039
[RISCV][LLVM] Enable atomics for 'Zalrsc' (#163672)
slachowsky Oct 21, 2025
8dbc152
[AllocToken] Introduce llvm.alloc.token.id intrinsic (#163632)
melver Oct 21, 2025
f4421ff
[llvm][dwarfdump][docs] Mention DW_AT_linkage_name in --name doc (#16…
Michael137 Oct 21, 2025
e45b72d
[lldb][ObjC][NFC] Use early-return in AppleObjCDeclVendor::FindDecls …
Michael137 Oct 21, 2025
cc77d76
[lldb][DeclVendor] Remove ClangDeclVendor (#164380)
Michael137 Oct 21, 2025
9c42b3e
[InstCombine][profcheck] Preserve profile with negated select conditi…
alanzhao1 Oct 21, 2025
7287816
[CAS] Fix test fallouts from #114102 (#164457)
cachemeifyoucan Oct 21, 2025
3c77b49
[MIR2Vec] Add embedder for machine instructions (#162161)
svkeerthy Oct 21, 2025
4a1ea3e
Revert "[flang][cuda][rt] Canonicalize block size values" (#164460)
clementval Oct 21, 2025
513f9c5
[libc][math] Add float-only implementation for sinf / cosf. (#161680)
lntue Oct 21, 2025
321a419
[SPIR-V] Fix unit tests for dynamic indexing to add validation step. …
luciechoi Oct 21, 2025
12abe8a
[libc] Stub out message catalog functions from <nl_types.h> (#164360)
vonosmas Oct 21, 2025
d019a02
[CIR] Upstream Exception CXXTryStmt (#162528)
AmrDeveloper Oct 21, 2025
e1e4154
[mlir] Partially revert #162903 (#164464)
jansvoboda11 Oct 21, 2025
925b106
[Flang][Tests] Remove GPL notice to GFortran test suite documentation…
mcinally Oct 21, 2025
d4713ec
[lldb][windows] add a warning if CMake's version is inferior to 3.30 …
charles-zablit Oct 21, 2025
2219119
[MIR2Vec] Fix to skip tests in MIR2VecEmbeddingTestFixture (#164467)
svkeerthy Oct 21, 2025
7b190b7
[Clang][LLVM] Support for Fuchsia on ARM (#163848)
petrhosek Oct 21, 2025
297f972
[Hexagon] Handle bitcast of i64 -> v64i1 when Hvx is enabled (#163332)
pkarveti Oct 21, 2025
c208a23
[NFCI][asm][i386/x86-64] Enable AT&T syntax explicitly (#164453)
tambry Oct 21, 2025
bcf7267
[DirectX] remove unrecognized 'llvm.errno.tbaa' named metadata for DX…
inbelic Oct 21, 2025
f2cb997
[lldb] Implement Process::ReadMemoryRanges (#163651)
felipepiovezan Oct 21, 2025
82b5934
[VPlan] Clarify naming for helpers to create loop&replicate regions (…
fhahn Oct 21, 2025
084ec38
merge main into amd-staging
ronlieb Oct 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 11 additions & 2 deletions bolt/lib/Core/BinaryContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,8 +1337,17 @@ void BinaryContext::processInterproceduralReferences() {
<< Function.getPrintName() << " and "
<< TargetFunction->getPrintName() << '\n';
}
if (uint64_t Offset = Address - TargetFunction->getAddress())
TargetFunction->addEntryPointAtOffset(Offset);
if (uint64_t Offset = Address - TargetFunction->getAddress()) {
if (!TargetFunction->isInConstantIsland(Address)) {
TargetFunction->addEntryPointAtOffset(Offset);
} else {
TargetFunction->setIgnored();
this->outs() << "BOLT-WARNING: Ignoring entry point at address 0x"
<< Twine::utohexstr(Address)
<< " in constant island of function " << *TargetFunction
<< '\n';
}
}

continue;
}
Expand Down
27 changes: 27 additions & 0 deletions bolt/test/AArch64/constant-island-entry.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This test checks that we ignore functions which add an entry point that
// is in a constant island.

# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
# RUN: %clang %cflags %t.o -pie -Wl,-q -o %t.exe
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s

# CHECK: BOLT-WARNING: Ignoring entry point at address 0x{{[0-9a-f]+}} in constant island of function func

.globl func
.type func, %function
func:
b .Lafter_constant

.type constant_island, %object
constant_island:
.xword 0xabcdef

.Lafter_constant:
ret
.size func, .-func

.globl caller
.type caller, %function
caller:
bl constant_island
ret
2 changes: 2 additions & 0 deletions clang/docs/HIPSupport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ Predefined Macros
- Represents wavefront memory scope in HIP (value is 2).
* - ``__HIP_MEMORY_SCOPE_WORKGROUP``
- Represents workgroup memory scope in HIP (value is 3).
* - ``__HIP_MEMORY_SCOPE_CLUSTER``
- Represents cluster memory scope in HIP (value is 6).
* - ``__HIP_MEMORY_SCOPE_AGENT``
- Represents agent memory scope in HIP (value is 4).
* - ``__HIP_MEMORY_SCOPE_SYSTEM``
Expand Down
1 change: 1 addition & 0 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4843,6 +4843,7 @@ currently supported:
* ``__MEMORY_SCOPE_SYSTEM``
* ``__MEMORY_SCOPE_DEVICE``
* ``__MEMORY_SCOPE_WRKGRP``
* ``__MEMORY_SCOPE_CLUSTR``
* ``__MEMORY_SCOPE_WVFRNT``
* ``__MEMORY_SCOPE_SINGLE``

Expand Down
45 changes: 35 additions & 10 deletions clang/include/clang/Basic/SyncScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ enum class SyncScope {
SystemScope,
DeviceScope,
WorkgroupScope,
ClusterScope,
WavefrontScope,
SingleScope,
HIPSingleThread,
HIPWavefront,
HIPWorkgroup,
HIPCluster,
HIPAgent,
HIPSystem,
OpenCLWorkGroup,
Expand All @@ -65,6 +67,8 @@ inline llvm::StringRef getAsString(SyncScope S) {
return "device_scope";
case SyncScope::WorkgroupScope:
return "workgroup_scope";
case SyncScope::ClusterScope:
return "cluster_scope";
case SyncScope::WavefrontScope:
return "wavefront_scope";
case SyncScope::SingleScope:
Expand All @@ -75,6 +79,8 @@ inline llvm::StringRef getAsString(SyncScope S) {
return "hip_wavefront";
case SyncScope::HIPWorkgroup:
return "hip_workgroup";
case SyncScope::HIPCluster:
return "hip_cluster";
case SyncScope::HIPAgent:
return "hip_agent";
case SyncScope::HIPSystem:
Expand Down Expand Up @@ -174,13 +180,18 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
/// The enum values match the pre-defined macros
/// __HIP_MEMORY_SCOPE_*, which are used to define memory_scope_*
/// enums in hip-c.h.
/// These may be present in pch files or bitcode so preserve existing values
/// when adding a new ID.
enum ID {
SingleThread = 1,
Wavefront = 2,
Workgroup = 3,
Agent = 4,
System = 5,
Last = System
Cluster = 6,
End,
Last = End - 1,
Count = Last
};

AtomicScopeHIPModel() {}
Expand All @@ -193,10 +204,14 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
return SyncScope::HIPWavefront;
case Workgroup:
return SyncScope::HIPWorkgroup;
case Cluster:
return SyncScope::HIPCluster;
case Agent:
return SyncScope::HIPAgent;
case System:
return SyncScope::HIPSystem;
case End:
break;
}
llvm_unreachable("Invalid language sync scope value");
}
Expand All @@ -207,11 +222,12 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
}

ArrayRef<unsigned> getRuntimeValues() const override {
static_assert(Last == System, "Does not include all sync scopes");
static const unsigned Scopes[] = {
static_cast<unsigned>(SingleThread), static_cast<unsigned>(Wavefront),
static_cast<unsigned>(Workgroup), static_cast<unsigned>(Agent),
static_cast<unsigned>(System)};
static_cast<unsigned>(Workgroup), static_cast<unsigned>(Cluster),
static_cast<unsigned>(System), static_cast<unsigned>(Agent)};
static_assert(sizeof(Scopes) / sizeof(Scopes[0]) == Count,
"Does not include all sync scopes");
return llvm::ArrayRef(Scopes);
}

Expand All @@ -223,14 +239,18 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
/// Defines the generic atomic scope model.
class AtomicScopeGenericModel : public AtomicScopeModel {
public:
/// The enum values match predefined built-in macros __ATOMIC_SCOPE_*.
/// The enum values match predefined built-in macros __MEMORY_SCOPE_*.
/// These may be present in pch files or bitcode so preserve existing values
/// when adding a new ID.
enum ID {
System = 0,
Device = 1,
Workgroup = 2,
Wavefront = 3,
Single = 4,
Last = Single
Cluster = 5,
Count,
Last = Count - 1
};

AtomicScopeGenericModel() = default;
Expand All @@ -243,10 +263,14 @@ class AtomicScopeGenericModel : public AtomicScopeModel {
return SyncScope::SystemScope;
case Workgroup:
return SyncScope::WorkgroupScope;
case Cluster:
return SyncScope::ClusterScope;
case Wavefront:
return SyncScope::WavefrontScope;
case Single:
return SyncScope::SingleScope;
case Count:
break;
}
llvm_unreachable("Invalid language sync scope value");
}
Expand All @@ -256,11 +280,12 @@ class AtomicScopeGenericModel : public AtomicScopeModel {
}

ArrayRef<unsigned> getRuntimeValues() const override {
static_assert(Last == Single, "Does not include all sync scopes");
static const unsigned Scopes[] = {
static_cast<unsigned>(Device), static_cast<unsigned>(System),
static_cast<unsigned>(Workgroup), static_cast<unsigned>(Wavefront),
static_cast<unsigned>(Single)};
static_cast<unsigned>(System), static_cast<unsigned>(Device),
static_cast<unsigned>(Workgroup), static_cast<unsigned>(Cluster),
static_cast<unsigned>(Wavefront), static_cast<unsigned>(Single)};
static_assert(sizeof(Scopes) / sizeof(Scopes[0]) == Count,
"Does not include all sync scopes");
return llvm::ArrayRef(Scopes);
}

Expand Down
135 changes: 135 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -4457,6 +4457,79 @@ def CIR_TryOp : CIR_Op<"try",[
// Atomic operations
//===----------------------------------------------------------------------===//

def CIR_AtomicFetchKind : CIR_I32EnumAttr<
"AtomicFetchKind", "Binary opcode for atomic fetch-and-update operations", [
I32EnumAttrCase<"Add", 0, "add">,
I32EnumAttrCase<"Sub", 1, "sub">,
I32EnumAttrCase<"And", 2, "and">,
I32EnumAttrCase<"Xor", 3, "xor">,
I32EnumAttrCase<"Or", 4, "or">,
I32EnumAttrCase<"Nand", 5, "nand">,
I32EnumAttrCase<"Max", 6, "max">,
I32EnumAttrCase<"Min", 7, "min">
]>;

def CIR_AtomicFetchOp : CIR_Op<"atomic.fetch", [
AllTypesMatch<["result", "val"]>,
TypesMatchWith<"type of 'val' must match the pointee type of 'ptr'",
"ptr", "val", "mlir::cast<cir::PointerType>($_self).getPointee()">
]> {
let summary = "Atomic fetch-and-update operation";
let description = [{
C/C++ atomic fetch-and-update operation. This operation implements the C/C++
builtin functions `__atomic_<binop>_fetch`, `__atomic_fetch_<binop>`, and
`__c11_atomic_fetch_<binop>`, where `<binop>` is one of the following binary
opcodes: `add`, `sub`, `and`, `xor`, `or`, `nand`, `max`, and `min`.

This operation takes 2 arguments: a pointer `ptr` and a value `val`. The
type of `val` must match the pointee type of `ptr`. If the binary operation
is `add`, `sub`, `max`, or `min`, the type of `val` may either be an integer
type or a floating-point type. Otherwise, `val` must be an integer.

This operation atomically loads the value from `ptr`, performs the binary
operation as indicated by `binop` on the loaded value and `val`, and stores
the result back to `ptr`. If the `fetch_first` flag is present, the result
of this operation is the old value loaded from `ptr` before the binary
operation. Otherwise, the result of this operation is the result of the
binary operation.

Example:
%res = cir.atomic.fetch add seq_cst %ptr, %val
: (!cir.ptr<!s32i>, !s32i) -> !s32i
}];
let results = (outs CIR_AnyIntOrFloatType:$result);
let arguments = (ins
Arg<CIR_PtrToIntOrFloatType, "", [MemRead, MemWrite]>:$ptr,
CIR_AnyIntOrFloatType:$val,
CIR_AtomicFetchKind:$binop,
Arg<CIR_MemOrder, "memory order">:$mem_order,
UnitAttr:$is_volatile,
UnitAttr:$fetch_first
);

let assemblyFormat = [{
$binop $mem_order
(`fetch_first` $fetch_first^)?
$ptr `,` $val
(`volatile` $is_volatile^)?
`:` `(` qualified(type($ptr)) `,` qualified(type($val)) `)`
`->` type($result) attr-dict
}];

let hasVerifier = 1;

let extraLLVMLoweringPatternDecl = [{
mlir::Value buildPostOp(cir::AtomicFetchOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter,
mlir::Value rmwVal, bool isInt) const;

mlir::Value buildMinMaxPostOp(cir::AtomicFetchOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter,
mlir::Value rmwVal, bool isInt,
bool isSigned) const;
}];
}

def CIR_AtomicXchgOp : CIR_Op<"atomic.xchg", [
AllTypesMatch<["result", "val"]>,
TypesMatchWith<"type of 'val' must match the pointee type of 'ptr'",
Expand Down Expand Up @@ -4557,4 +4630,66 @@ def CIR_AtomicCmpXchgOp : CIR_Op<"atomic.cmpxchg", [
}];
}

def CIR_AtomicTestAndSetOp : CIR_Op<"atomic.test_and_set"> {
let summary = "Atomic test and set";
let description = [{
C/C++ atomic test and set operation. Implements the builtin function
`__atomic_test_and_set`.

The operation takes as its only operand a pointer to an 8-bit signed
integer. The operation atomically set the integer to an implementation-
defined non-zero "set" value. The result of the operation is a boolean value
indicating whether the previous value of the integer was the "set" value.

Example:
```mlir
%res = cir.atomic.test_and_set seq_cst %ptr : !cir.ptr<!s8i> -> !cir.bool
```
}];

let arguments = (ins
Arg<CIR_PtrToType<CIR_SInt8>, "", [MemRead, MemWrite]>:$ptr,
Arg<CIR_MemOrder, "memory order">:$mem_order,
OptionalAttr<I64Attr>:$alignment,
UnitAttr:$is_volatile
);

let results = (outs CIR_BoolType:$result);

let assemblyFormat = [{
$mem_order $ptr
(`volatile` $is_volatile^)?
`:` qualified(type($ptr)) `->` qualified(type($result)) attr-dict
}];
}

def CIR_AtomicClearOp : CIR_Op<"atomic.clear"> {
let summary = "Atomic clear";
let description = [{
C/C++ atomic clear operation. Implements the builtin function
`__atomic_clear`.

The operation takes as its only operand a pointer to an 8-bit signed
integer. The operation atomically sets the integer to zero.

Example:
```mlir
cir.atomic.clear seq_cst %ptr : !cir.ptr<!s8i>
```
}];

let arguments = (ins
Arg<CIR_PtrToType<CIR_SInt8>, "", [MemRead, MemWrite]>:$ptr,
Arg<CIR_MemOrder, "memory order">:$mem_order,
OptionalAttr<I64Attr>:$alignment,
UnitAttr:$is_volatile
);

let assemblyFormat = [{
$mem_order $ptr
(`volatile` $is_volatile^)?
`:` qualified(type($ptr)) attr-dict
}];
}

#endif // CLANG_CIR_DIALECT_IR_CIROPS_TD
1 change: 1 addition & 0 deletions clang/include/clang/CIR/MissingFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct MissingFeatures {
static bool opCallLandingPad() { return false; }
static bool opCallContinueBlock() { return false; }
static bool opCallChain() { return false; }
static bool opCallExceptionAttr() { return false; }

// CXXNewExpr
static bool exprNewNullCheck() { return false; }
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -10021,7 +10021,7 @@ class Sema final : public SemaBase {
public:
DeferDiagsRAII(Sema &S, bool DeferDiags)
: S(S), SavedDeferDiags(S.DeferDiags) {
S.DeferDiags = DeferDiags;
S.DeferDiags = SavedDeferDiags || DeferDiags;
}
~DeferDiagsRAII() { S.DeferDiags = SavedDeferDiags; }
};
Expand Down
9 changes: 3 additions & 6 deletions clang/include/clang/Sema/SemaBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,13 @@ class SemaBase {
};

/// Emit a diagnostic.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID,
bool DeferHint = false);
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID);

/// Emit a partial diagnostic.
SemaDiagnosticBuilder Diag(SourceLocation Loc, const PartialDiagnostic &PD,
bool DeferHint = false);
SemaDiagnosticBuilder Diag(SourceLocation Loc, const PartialDiagnostic &PD);

/// Emit a compatibility diagnostic.
SemaDiagnosticBuilder DiagCompat(SourceLocation Loc, unsigned CompatDiagId,
bool DeferHint = false);
SemaDiagnosticBuilder DiagCompat(SourceLocation Loc, unsigned CompatDiagId);

/// Build a partial diagnostic.
PartialDiagnostic PDiag(unsigned DiagID = 0);
Expand Down
Loading