Skip to content

Commit eac8954

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merge llvm/main into amd-debug
2 parents 2946108 + bd6ed29 commit eac8954

File tree

41 files changed

+585
-118
lines changed

Some content is hidden

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

41 files changed

+585
-118
lines changed

clang/test/C/C2y/n3364.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -verify -std=c2y -ffreestanding -Wall -pedantic -emit-llvm -o - %s
2-
// RUN: %clang_cc1 -verify -ffreestanding -Wall -pedantic -emit-llvm -o - %s
1+
// RUN: %clang_cc1 -verify -std=c2y -ffreestanding -Wall -pedantic -emit-llvm -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -verify -ffreestanding -Wall -pedantic -emit-llvm -o - %s | FileCheck %s
33
// expected-no-diagnostics
44

55
/* WG14 N3364: Yes
@@ -23,20 +23,20 @@
2323
float f1 = FLT_SNAN;
2424
float f2 = +FLT_SNAN;
2525
float f3 = -FLT_SNAN;
26-
// CHECK: @f1 = {{.*}}global float 0x7FF0000020000000
27-
// CHECK: @f2 = {{.*}}global float 0x7FF0000020000000
28-
// CHECK: @f3 = {{.*}}global float 0xFFF0000020000000
26+
// CHECK: @f1 = {{.*}}global float 0x7FF4000000000000
27+
// CHECK: @f2 = {{.*}}global float 0x7FF4000000000000
28+
// CHECK: @f3 = {{.*}}global float 0xFFF4000000000000
2929

3030
double d1 = DBL_SNAN;
3131
double d2 = +DBL_SNAN;
3232
double d3 = -DBL_SNAN;
33-
// CHECK: @d1 = {{.*}}global double 0x7FF0000000000001
34-
// CHECK: @d2 = {{.*}}global double 0x7FF0000000000001
35-
// CHECK: @d3 = {{.*}}global double 0xFFF0000000000001
33+
// CHECK: @d1 = {{.*}}global double 0x7FF4000000000000
34+
// CHECK: @d2 = {{.*}}global double 0x7FF4000000000000
35+
// CHECK: @d3 = {{.*}}global double 0xFFF4000000000000
3636

3737
long double ld1 = LDBL_SNAN;
3838
long double ld2 = +LDBL_SNAN;
3939
long double ld3 = -LDBL_SNAN;
40-
// CHECK: @ld1 = {{.*}}global {{double 0x7FF0000000000001|x86_fp80 0xK7FFF8000000000000001|fp128 0xL00000000000000017FFF000000000000}}
41-
// CHECK: @ld2 = {{.*}}global {{double 0x7FF0000000000001|x86_fp80 0xK7FFF8000000000000001|fp128 0xL00000000000000017FFF000000000000}}
42-
// CHECK: @ld3 = {{.*}}global {{double 0xFFF0000000000001|x86_fp80 0xKFFFF8000000000000001|fp128 0xL0000000000000001FFFF000000000000}}
40+
// CHECK: @ld1 = {{.*}}global {{double 0x7FF4000000000000|x86_fp80 0xK7FFFA000000000000000|fp128 0xL00000000000000007FFF400000000000}}
41+
// CHECK: @ld2 = {{.*}}global {{double 0x7FF4000000000000|x86_fp80 0xK7FFFA000000000000000|fp128 0xL00000000000000007FFF400000000000}}
42+
// CHECK: @ld3 = {{.*}}global {{double 0xFFF4000000000000|x86_fp80 0xKFFFFA000000000000000|fp128 0xL0000000000000000FFFF400000000000}}

clang/tools/driver/cc1as_main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ getOutputStream(StringRef Path, DiagnosticsEngine &Diags, bool Binary) {
417417
}
418418

419419
static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
420-
DiagnosticsEngine &Diags) {
420+
DiagnosticsEngine &Diags,
421+
IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
421422
// Get the target specific parser.
422423
std::string Error;
423424
const Target *TheTarget = TargetRegistry::lookupTarget(Opts.Triple, Error);
@@ -440,6 +441,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
440441
// Record the location of the include directories so that the lexer can find
441442
// it later.
442443
SrcMgr.setIncludeDirs(Opts.IncludePaths);
444+
SrcMgr.setVirtualFileSystem(VFS);
443445

444446
std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(Opts.Triple));
445447
assert(MRI && "Unable to create target register info!");
@@ -632,8 +634,9 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
632634
}
633635

634636
static bool ExecuteAssembler(AssemblerInvocation &Opts,
635-
DiagnosticsEngine &Diags) {
636-
bool Failed = ExecuteAssemblerImpl(Opts, Diags);
637+
DiagnosticsEngine &Diags,
638+
IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
639+
bool Failed = ExecuteAssemblerImpl(Opts, Diags, VFS);
637640

638641
// Delete output file if there were errors.
639642
if (Failed) {
@@ -714,7 +717,7 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
714717
}
715718

716719
// Execute the invocation, unless there were parsing errors.
717-
bool Failed = Diags.hasErrorOccurred() || ExecuteAssembler(Asm, Diags);
720+
bool Failed = Diags.hasErrorOccurred() || ExecuteAssembler(Asm, Diags, VFS);
718721

719722
// If any timers were active but haven't been destroyed yet, print their
720723
// results now.

libc/config/baremetal/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,10 @@
3838
"LIBC_CONF_MATH_OPTIMIZATIONS": {
3939
"value": "(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES)"
4040
}
41+
},
42+
"general": {
43+
"LIBC_ADD_NULL_CHECKS": {
44+
"value": false
45+
}
4146
}
4247
}

lldb/source/Host/macosx/objcxx/Host.mm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,13 +1221,12 @@ static Status LaunchProcessPosixSpawn(const char *exe_path,
12211221
//
12221222
using posix_spawnattr_set_use_sec_transition_shims_np_t =
12231223
int (*)(posix_spawnattr_t *attr, uint32_t flags);
1224-
auto posix_spawnattr_set_use_sec_transition_shims_np_fn =
1224+
auto posix_spawnattr_enable_memory_tagging_fn =
12251225
(posix_spawnattr_set_use_sec_transition_shims_np_t)dlsym(
12261226
RTLD_DEFAULT, "posix_spawnattr_set_use_sec_transition_shims_np");
1227-
if (posix_spawnattr_set_use_sec_transition_shims_np_fn) {
1228-
error =
1229-
Status(posix_spawnattr_set_use_sec_transition_shims_np_fn(&attr, 0),
1230-
eErrorTypePOSIX);
1227+
if (posix_spawnattr_enable_memory_tagging_fn) {
1228+
error = Status(posix_spawnattr_enable_memory_tagging_fn(&attr, 0),
1229+
eErrorTypePOSIX);
12311230
if (error.Fail()) {
12321231
LLDB_LOG(log,
12331232
"error: {0}, "

llvm/include/llvm/ADT/StringSwitch.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class StringSwitch {
6666

6767
// Case-sensitive case matchers
6868
StringSwitch &Case(StringLiteral S, T Value) {
69-
CaseImpl(Value, S);
69+
CaseImpl(S, Value);
7070
return *this;
7171
}
7272

@@ -86,68 +86,68 @@ class StringSwitch {
8686

8787
StringSwitch &Cases(std::initializer_list<StringLiteral> CaseStrings,
8888
T Value) {
89-
return CasesImpl(Value, CaseStrings);
89+
return CasesImpl(CaseStrings, Value);
9090
}
9191

9292
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, T Value) {
93-
return CasesImpl(Value, {S0, S1});
93+
return CasesImpl({S0, S1}, Value);
9494
}
9595

9696
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
9797
T Value) {
98-
return CasesImpl(Value, {S0, S1, S2});
98+
return CasesImpl({S0, S1, S2}, Value);
9999
}
100100

101101
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
102102
StringLiteral S3, T Value) {
103-
return CasesImpl(Value, {S0, S1, S2, S3});
103+
return CasesImpl({S0, S1, S2, S3}, Value);
104104
}
105105

106106
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
107107
StringLiteral S3, StringLiteral S4, T Value) {
108-
return CasesImpl(Value, {S0, S1, S2, S3, S4});
108+
return CasesImpl({S0, S1, S2, S3, S4}, Value);
109109
}
110110

111111
[[deprecated("Pass cases in std::initializer_list instead")]]
112112
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
113113
StringLiteral S3, StringLiteral S4, StringLiteral S5,
114114
T Value) {
115-
return CasesImpl(Value, {S0, S1, S2, S3, S4, S5});
115+
return CasesImpl({S0, S1, S2, S3, S4, S5}, Value);
116116
}
117117

118118
[[deprecated("Pass cases in std::initializer_list instead")]]
119119
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
120120
StringLiteral S3, StringLiteral S4, StringLiteral S5,
121121
StringLiteral S6, T Value) {
122-
return CasesImpl(Value, {S0, S1, S2, S3, S4, S5, S6});
122+
return CasesImpl({S0, S1, S2, S3, S4, S5, S6}, Value);
123123
}
124124

125125
[[deprecated("Pass cases in std::initializer_list instead")]]
126126
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
127127
StringLiteral S3, StringLiteral S4, StringLiteral S5,
128128
StringLiteral S6, StringLiteral S7, T Value) {
129-
return CasesImpl(Value, {S0, S1, S2, S3, S4, S5, S6, S7});
129+
return CasesImpl({S0, S1, S2, S3, S4, S5, S6, S7}, Value);
130130
}
131131

132132
[[deprecated("Pass cases in std::initializer_list instead")]]
133133
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
134134
StringLiteral S3, StringLiteral S4, StringLiteral S5,
135135
StringLiteral S6, StringLiteral S7, StringLiteral S8,
136136
T Value) {
137-
return CasesImpl(Value, {S0, S1, S2, S3, S4, S5, S6, S7, S8});
137+
return CasesImpl({S0, S1, S2, S3, S4, S5, S6, S7, S8}, Value);
138138
}
139139

140140
[[deprecated("Pass cases in std::initializer_list instead")]]
141141
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
142142
StringLiteral S3, StringLiteral S4, StringLiteral S5,
143143
StringLiteral S6, StringLiteral S7, StringLiteral S8,
144144
StringLiteral S9, T Value) {
145-
return CasesImpl(Value, {S0, S1, S2, S3, S4, S5, S6, S7, S8, S9});
145+
return CasesImpl({S0, S1, S2, S3, S4, S5, S6, S7, S8, S9}, Value);
146146
}
147147

148148
// Case-insensitive case matchers.
149149
StringSwitch &CaseLower(StringLiteral S, T Value) {
150-
CaseLowerImpl(Value, S);
150+
CaseLowerImpl(S, Value);
151151
return *this;
152152
}
153153

@@ -167,26 +167,26 @@ class StringSwitch {
167167

168168
StringSwitch &CasesLower(std::initializer_list<StringLiteral> CaseStrings,
169169
T Value) {
170-
return CasesLowerImpl(Value, CaseStrings);
170+
return CasesLowerImpl(CaseStrings, Value);
171171
}
172172

173173
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, T Value) {
174-
return CasesLowerImpl(Value, {S0, S1});
174+
return CasesLowerImpl({S0, S1}, Value);
175175
}
176176

177177
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
178178
T Value) {
179-
return CasesLowerImpl(Value, {S0, S1, S2});
179+
return CasesLowerImpl({S0, S1, S2}, Value);
180180
}
181181

182182
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
183183
StringLiteral S3, T Value) {
184-
return CasesLowerImpl(Value, {S0, S1, S2, S3});
184+
return CasesLowerImpl({S0, S1, S2, S3}, Value);
185185
}
186186

187187
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
188188
StringLiteral S3, StringLiteral S4, T Value) {
189-
return CasesLowerImpl(Value, {S0, S1, S2, S3, S4});
189+
return CasesLowerImpl({S0, S1, S2, S3, S4}, Value);
190190
}
191191

192192
[[nodiscard]] R Default(T Value) {
@@ -207,7 +207,7 @@ class StringSwitch {
207207

208208
private:
209209
// Returns true when `Str` matches the `S` argument, and stores the result.
210-
bool CaseImpl(T &Value, StringLiteral S) {
210+
bool CaseImpl(StringLiteral S, T &Value) {
211211
if (!Result && Str == S) {
212212
Result = std::move(Value);
213213
return true;
@@ -217,28 +217,28 @@ class StringSwitch {
217217

218218
// Returns true when `Str` matches the `S` argument (case-insensitive), and
219219
// stores the result.
220-
bool CaseLowerImpl(T &Value, StringLiteral S) {
220+
bool CaseLowerImpl(StringLiteral S, T &Value) {
221221
if (!Result && Str.equals_insensitive(S)) {
222222
Result = std::move(Value);
223223
return true;
224224
}
225225
return false;
226226
}
227227

228-
StringSwitch &CasesImpl(T &Value,
229-
std::initializer_list<StringLiteral> Cases) {
228+
StringSwitch &CasesImpl(std::initializer_list<StringLiteral> Cases,
229+
T &Value) {
230230
// Stop matching after the string is found.
231231
for (StringLiteral S : Cases)
232-
if (CaseImpl(Value, S))
232+
if (CaseImpl(S, Value))
233233
break;
234234
return *this;
235235
}
236236

237-
StringSwitch &CasesLowerImpl(T &Value,
238-
std::initializer_list<StringLiteral> Cases) {
237+
StringSwitch &CasesLowerImpl(std::initializer_list<StringLiteral> Cases,
238+
T &Value) {
239239
// Stop matching after the string is found.
240240
for (StringLiteral S : Cases)
241-
if (CaseLowerImpl(Value, S))
241+
if (CaseLowerImpl(S, Value))
242242
break;
243243
return *this;
244244
}

llvm/include/llvm/Analysis/StaticDataProfileInfo.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,18 @@ class StaticDataProfileInfo {
6060
LLVM_ABI StaticDataHotness getConstantHotnessUsingProfileCount(
6161
const Constant *C, const ProfileSummaryInfo *PSI, uint64_t Count) const;
6262

63+
/// Return the hotness based on section prefix \p SectionPrefix.
64+
LLVM_ABI StaticDataHotness getSectionHotnessUsingDataAccessProfile(
65+
std::optional<StringRef> SectionPrefix) const;
66+
6367
/// Return the string representation of the hotness enum \p Hotness.
6468
LLVM_ABI StringRef hotnessToStr(StaticDataHotness Hotness) const;
6569

70+
bool EnableDataAccessProf = false;
71+
6672
public:
67-
StaticDataProfileInfo() = default;
73+
StaticDataProfileInfo(bool EnableDataAccessProf)
74+
: EnableDataAccessProf(EnableDataAccessProf) {}
6875

6976
/// If \p Count is not nullopt, add it to the profile count of the constant \p
7077
/// C in a saturating way, and clamp the count to \p getInstrMaxCountValue if
@@ -73,14 +80,10 @@ class StaticDataProfileInfo {
7380
LLVM_ABI void addConstantProfileCount(const Constant *C,
7481
std::optional<uint64_t> Count);
7582

76-
/// Return a section prefix for the constant \p C based on its profile count.
77-
/// - If a constant doesn't have a counter, return an empty string.
78-
/// - Otherwise,
79-
/// - If it has a hot count, return "hot".
80-
/// - If it is seen by unprofiled function, return an empty string.
81-
/// - If it has a cold count, return "unlikely".
82-
/// - Otherwise (e.g. it's used by lukewarm functions), return an empty
83-
/// string.
83+
/// Given a constant \p C, returns a section prefix.
84+
/// If \p C is a global variable, the section prefix is the bigger one
85+
/// between its existing section prefix and its use profile count. Otherwise,
86+
/// the section prefix is based on its use profile count.
8487
LLVM_ABI StringRef getConstantSectionPrefix(
8588
const Constant *C, const ProfileSummaryInfo *PSI) const;
8689
};

llvm/include/llvm/CodeGen/AsmPrinter.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define LLVM_CODEGEN_ASMPRINTER_H
1717

1818
#include "llvm/ADT/DenseMap.h"
19+
#include "llvm/ADT/IntrusiveRefCntPtr.h"
1920
#include "llvm/ADT/MapVector.h"
2021
#include "llvm/ADT/SmallSet.h"
2122
#include "llvm/ADT/SmallVector.h"
@@ -87,6 +88,10 @@ namespace remarks {
8788
class RemarkStreamer;
8889
}
8990

91+
namespace vfs {
92+
class FileSystem;
93+
}
94+
9095
/// This class is intended to be used as a driving class for all asm writers.
9196
class LLVM_ABI AsmPrinter : public MachineFunctionPass {
9297
public:
@@ -105,6 +110,9 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
105110
/// generating (such as the current section etc).
106111
std::unique_ptr<MCStreamer> OutStreamer;
107112

113+
/// The VFS to resolve asm include directives.
114+
IntrusiveRefCntPtr<vfs::FileSystem> VFS;
115+
108116
/// The current machine function.
109117
MachineFunction *MF = nullptr;
110118

llvm/include/llvm/IR/CFG.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ template <class Ptr, class USE_iterator> // Predecessor Iterator
4242
class PredIterator {
4343
public:
4444
using iterator_category = std::forward_iterator_tag;
45-
using value_type = Ptr;
45+
using value_type = Ptr *;
4646
using difference_type = std::ptrdiff_t;
47-
using pointer = Ptr *;
47+
using pointer = Ptr **;
4848
using reference = Ptr *;
4949

5050
protected:
@@ -141,7 +141,8 @@ class SuccIterator
141141
std::random_access_iterator_tag, BlockT, int,
142142
BlockT *, BlockT *> {
143143
public:
144-
using difference_type = int;
144+
using value_type = BlockT *;
145+
using difference_type = std::ptrdiff_t;
145146
using pointer = BlockT *;
146147
using reference = BlockT *;
147148

0 commit comments

Comments
 (0)