Skip to content

Commit f0063d5

Browse files
authored
Merge branch 'main' into users/mtrofin/10-06-_dfajt_profcheck_propagate_select_-_br_profile_metadata
2 parents a4ddaf2 + 051fa18 commit f0063d5

File tree

138 files changed

+1943
-1795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+1943
-1795
lines changed

clang/docs/ClangOffloadPackager.rst

Lines changed: 0 additions & 193 deletions
This file was deleted.

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,9 +3277,9 @@ def CIR_ComplexCreateOp : CIR_Op<"complex.create", [Pure, SameTypeOperands]> {
32773277
def CIR_ComplexRealOp : CIR_Op<"complex.real", [Pure]> {
32783278
let summary = "Extract the real part of a complex value";
32793279
let description = [{
3280-
`cir.complex.real` operation takes an operand of `!cir.complex`, `!cir.int`
3281-
or `!cir.float`. If the operand is `!cir.complex`, the real part of it will
3282-
be returned, otherwise the value returned unmodified.
3280+
`cir.complex.real` operation takes an operand of `!cir.complex`, `cir.int`,
3281+
`!cir.bool` or `!cir.float`. If the operand is `!cir.complex`, the real
3282+
part of it will be returned, otherwise the value returned unmodified.
32833283

32843284
Example:
32853285

@@ -3289,8 +3289,8 @@ def CIR_ComplexRealOp : CIR_Op<"complex.real", [Pure]> {
32893289
```
32903290
}];
32913291

3292-
let results = (outs CIR_AnyIntOrFloatType:$result);
3293-
let arguments = (ins CIR_AnyComplexOrIntOrFloatType:$operand);
3292+
let results = (outs CIR_AnyIntOrBoolOrFloatType:$result);
3293+
let arguments = (ins CIR_AnyComplexOrIntOrBoolOrFloatType:$operand);
32943294

32953295
let assemblyFormat = [{
32963296
$operand `:` qualified(type($operand)) `->` qualified(type($result))
@@ -3309,8 +3309,8 @@ def CIR_ComplexImagOp : CIR_Op<"complex.imag", [Pure]> {
33093309
let summary = "Extract the imaginary part of a complex value";
33103310
let description = [{
33113311
`cir.complex.imag` operation takes an operand of `!cir.complex`, `!cir.int`
3312-
or `!cir.float`. If the operand is `!cir.complex`, the imag part of it will
3313-
be returned, otherwise a zero value will be returned.
3312+
`!cir.bool` or `!cir.float`. If the operand is `!cir.complex`, the imag
3313+
part of it will be returned, otherwise a zero value will be returned.
33143314

33153315
Example:
33163316

@@ -3320,8 +3320,8 @@ def CIR_ComplexImagOp : CIR_Op<"complex.imag", [Pure]> {
33203320
```
33213321
}];
33223322

3323-
let results = (outs CIR_AnyIntOrFloatType:$result);
3324-
let arguments = (ins CIR_AnyComplexOrIntOrFloatType:$operand);
3323+
let results = (outs CIR_AnyIntOrBoolOrFloatType:$result);
3324+
let arguments = (ins CIR_AnyComplexOrIntOrBoolOrFloatType:$operand);
33253325

33263326
let assemblyFormat = [{
33273327
$operand `:` qualified(type($operand)) `->` qualified(type($result))
@@ -4168,6 +4168,40 @@ def CIR_ThrowOp : CIR_Op<"throw"> {
41684168
let hasVerifier = 1;
41694169
}
41704170

4171+
//===----------------------------------------------------------------------===//
4172+
// AllocExceptionOp
4173+
//===----------------------------------------------------------------------===//
4174+
4175+
def CIR_AllocExceptionOp : CIR_Op<"alloc.exception"> {
4176+
let summary = "Allocates an exception according to Itanium ABI";
4177+
let description = [{
4178+
Implements a slightly higher level __cxa_allocate_exception:
4179+
4180+
`void *__cxa_allocate_exception(size_t thrown_size);`
4181+
4182+
If the operation fails, the program terminates rather than throw.
4183+
4184+
Example:
4185+
4186+
```mlir
4187+
// if (b == 0) {
4188+
// ...
4189+
// throw "...";
4190+
cir.if %10 {
4191+
%11 = cir.alloc_exception 8 -> !cir.ptr<!void>
4192+
... // store exception content into %11
4193+
cir.throw %11 : !cir.ptr<!cir.ptr<!u8i>>, ...
4194+
```
4195+
}];
4196+
4197+
let arguments = (ins I64Attr:$size);
4198+
let results = (outs Res<CIR_PointerType, "", [MemAlloc<DefaultResource>]>:$addr);
4199+
4200+
let assemblyFormat = [{
4201+
$size `->` qualified(type($addr)) attr-dict
4202+
}];
4203+
}
4204+
41714205
//===----------------------------------------------------------------------===//
41724206
// Atomic operations
41734207
//===----------------------------------------------------------------------===//

clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,22 @@ def CIR_AnyIntOrFloatType : AnyTypeOf<[CIR_AnyFloatType, CIR_AnyIntType],
159159
let cppFunctionName = "isAnyIntegerOrFloatingPointType";
160160
}
161161

162+
def CIR_AnyIntOrBoolOrFloatType
163+
: AnyTypeOf<[CIR_AnyBoolType, CIR_AnyFloatType, CIR_AnyIntType],
164+
"integer, boolean or floating point type"> {
165+
let cppFunctionName = "isAnyIntegerOrBooleanOrFloatingPointType";
166+
}
167+
162168
//===----------------------------------------------------------------------===//
163169
// Complex Type predicates
164170
//===----------------------------------------------------------------------===//
165171

166172
def CIR_AnyComplexType : CIR_TypeBase<"::cir::ComplexType", "complex type">;
167173

168-
def CIR_AnyComplexOrIntOrFloatType : AnyTypeOf<[
169-
CIR_AnyComplexType, CIR_AnyFloatType, CIR_AnyIntType
170-
], "complex, integer or floating point type"> {
171-
let cppFunctionName = "isComplexOrIntegerOrFloatingPointType";
174+
def CIR_AnyComplexOrIntOrBoolOrFloatType
175+
: AnyTypeOf<[CIR_AnyComplexType, CIR_AnyIntOrBoolOrFloatType],
176+
"complex, integer or floating point type"> {
177+
let cppFunctionName = "isComplexOrIntegerOrBoolOrFloatingPointType";
172178
}
173179

174180
//===----------------------------------------------------------------------===//

clang/lib/Basic/Diagnostic.cpp

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -537,33 +537,16 @@ WarningsSpecialCaseList::create(const llvm::MemoryBuffer &Input,
537537
}
538538

539539
void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
540-
// Drop the default section introduced by special case list, we only support
541-
// exact diagnostic group names.
542-
// FIXME: We should make this configurable in the parser instead.
543-
// FIXME: C++20 can use std::erase_if(Sections, [](Section &sec) { return
544-
// sec.SectionStr == "*"; });
545-
llvm::erase_if(Sections, [](Section &sec) { return sec.SectionStr == "*"; });
546-
// Make sure we iterate sections by their line numbers.
547-
std::vector<std::pair<unsigned, const Section *>> LineAndSectionEntry;
548-
LineAndSectionEntry.reserve(Sections.size());
549-
for (const auto &Entry : Sections) {
550-
StringRef DiagName = Entry.SectionStr;
551-
// Each section has a matcher with that section's name, attached to that
552-
// line.
553-
const auto &DiagSectionMatcher = Entry.SectionMatcher;
554-
unsigned DiagLine = 0;
555-
for (const auto &Glob : DiagSectionMatcher->Globs)
556-
if (Glob->Name == DiagName) {
557-
DiagLine = Glob->LineNo;
558-
break;
559-
}
560-
LineAndSectionEntry.emplace_back(DiagLine, &Entry);
561-
}
562-
llvm::sort(LineAndSectionEntry);
563540
static constexpr auto WarningFlavor = clang::diag::Flavor::WarningOrError;
564-
for (const auto &[_, SectionEntry] : LineAndSectionEntry) {
541+
for (const auto &SectionEntry : Sections) {
542+
StringRef DiagGroup = SectionEntry.SectionStr;
543+
if (DiagGroup == "*") {
544+
// Drop the default section introduced by special case list, we only
545+
// support exact diagnostic group names.
546+
// FIXME: We should make this configurable in the parser instead.
547+
continue;
548+
}
565549
SmallVector<diag::kind> GroupDiags;
566-
StringRef DiagGroup = SectionEntry->SectionStr;
567550
if (Diags.getDiagnosticIDs()->getDiagnosticsInGroup(
568551
WarningFlavor, DiagGroup, GroupDiags)) {
569552
StringRef Suggestion =
@@ -576,7 +559,7 @@ void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
576559
for (diag::kind Diag : GroupDiags)
577560
// We're intentionally overwriting any previous mappings here to make sure
578561
// latest one takes precedence.
579-
DiagToSection[Diag] = SectionEntry;
562+
DiagToSection[Diag] = &SectionEntry;
580563
}
581564
}
582565

clang/lib/Basic/SanitizerSpecialCaseList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void SanitizerSpecialCaseList::createSanitizerSections() {
4242
SanitizerMask Mask;
4343

4444
#define SANITIZER(NAME, ID) \
45-
if (S.SectionMatcher->match(NAME)) \
45+
if (S.SectionMatcher.match(NAME)) \
4646
Mask |= SanitizerKind::ID;
4747
#define SANITIZER_GROUP(NAME, ID, ALIAS) SANITIZER(NAME, ID)
4848

clang/lib/CIR/CodeGen/CIRGenCXXABI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class CIRGenCXXABI {
113113
CIRGenFunction &cgf) = 0;
114114

115115
virtual void emitRethrow(CIRGenFunction &cgf, bool isNoReturn) = 0;
116+
virtual void emitThrow(CIRGenFunction &cgf, const CXXThrowExpr *e) = 0;
116117

117118
virtual mlir::Attribute getAddrOfRTTIDescriptor(mlir::Location loc,
118119
QualType ty) = 0;

clang/lib/CIR/CodeGen/CIRGenCleanup.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class alignas(EHScopeStack::ScopeStackAlignment) EHCleanupScope
104104
bool isNormalCleanup() const { return cleanupBits.isNormalCleanup; }
105105

106106
bool isActive() const { return cleanupBits.isActive; }
107+
void setActive(bool isActive) { cleanupBits.isActive = isActive; }
107108

108109
size_t getCleanupSize() const { return cleanupBits.cleanupSize; }
109110
void *getCleanupBuffer() { return this + 1; }
@@ -138,5 +139,13 @@ inline EHScopeStack::iterator EHScopeStack::begin() const {
138139
return iterator(startOfData);
139140
}
140141

142+
inline EHScopeStack::iterator
143+
EHScopeStack::find(stable_iterator savePoint) const {
144+
assert(savePoint.isValid() && "finding invalid savepoint");
145+
assert(savePoint.size <= stable_begin().size &&
146+
"finding savepoint after pop");
147+
return iterator(endOfBuffer - savePoint.size);
148+
}
149+
141150
} // namespace clang::CIRGen
142151
#endif // CLANG_LIB_CIR_CODEGEN_CIRGENCLEANUP_H

0 commit comments

Comments
 (0)