Skip to content

Commit b25aa03

Browse files
committed
merge main into amd-stg-open
Change-Id: If3b11b81b0dd99b11c6ca4efa6e29e2a703f7e0f
2 parents c46437d + ff0d8a9 commit b25aa03

File tree

251 files changed

+13499
-4682
lines changed

Some content is hidden

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

251 files changed

+13499
-4682
lines changed

bolt/utils/llvm-bolt-wrapper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def run_cmd(cmd, out_f, cfg):
112112
def run_bolt(bolt_path, bolt_args, out_f, cfg):
113113
p2b = os.path.basename(sys.argv[0]) == "perf2bolt" # perf2bolt mode
114114
bd = os.path.basename(sys.argv[0]) == "llvm-boltdiff" # boltdiff mode
115-
hm = sys.argv[1] == "heatmap" # heatmap mode
116115
cmd = ["/usr/bin/time", "-f", "%e %M", bolt_path] + bolt_args
117116
if p2b:
118117
# -ignore-build-id can occur at most once, hence remove it from cmd
@@ -121,7 +120,7 @@ def run_bolt(bolt_path, bolt_args, out_f, cfg):
121120
cmd += PERF2BOLT_MODE
122121
elif bd:
123122
cmd += BOLTDIFF_MODE
124-
elif not cfg.NO_MINIMIZE and not hm:
123+
elif not cfg.NO_MINIMIZE:
125124
cmd += MINIMIZE_DIFFS
126125
return run_cmd(cmd, out_f, cfg)
127126

bolt/utils/nfc-stat-parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def main():
1919
)
2020
parser.add_argument(
2121
"--check_longer_than",
22-
default=1,
22+
default=2,
2323
type=float,
2424
help="Only warn on tests longer than X seconds for at least one side",
2525
)

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ C++2c Feature Support
189189

190190
- Implemented `P2864R2 Remove Deprecated Arithmetic Conversion on Enumerations From C++26 <https://wg21.link/P2864R2>`_.
191191

192+
- Implemented `P2361R6 Template parameter initialization <https://wg21.link/P2308R1>`_.
193+
This change is applied as a DR in all language modes.
194+
192195

193196
Resolutions to C++ Defect Reports
194197
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/arm_sme.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,16 @@ let TargetGuard = "sme2" in {
314314

315315
def SVBMOPS : Inst<"svbmops_za32[_{d}]_m", "viPPdd", "iUi", MergeNone, "aarch64_sme_bmops_za32", [IsSharedZA, IsStreaming], [ImmCheck<0, ImmCheck0_3>]>;
316316
}
317+
318+
//
319+
// Spill and fill of ZT0
320+
//
321+
let TargetGuard = "sme2" in {
322+
def SVLDR_ZT : Inst<"svldr_zt", "viQ", "", MergeNone, "aarch64_sme_ldr_zt", [IsOverloadNone, IsStreamingCompatible, IsSharedZA, IsPreservesZA], [ImmCheck<0, ImmCheck0_0>]>;
323+
def SVSTR_ZT : Inst<"svstr_zt", "vi%", "", MergeNone, "aarch64_sme_str_zt", [IsOverloadNone, IsStreamingCompatible, IsSharedZA, IsPreservesZA], [ImmCheck<0, ImmCheck0_0>]>;
324+
325+
//
326+
// Zero ZT0
327+
//
328+
def SVZERO_ZT : Inst<"svzero_zt", "vi", "", MergeNone, "aarch64_sme_zero_zt", [IsOverloadNone, IsStreamingCompatible, IsSharedZA], [ImmCheck<0, ImmCheck0_0>]>;
329+
}

clang/include/clang/Driver/Multilib.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,22 @@ class Multilib {
3939
std::string IncludeSuffix;
4040
flags_list Flags;
4141

42+
// Optionally, a multilib can be assigned a string tag indicating that it's
43+
// part of a group of mutually exclusive possibilities. If two or more
44+
// multilibs have the same non-empty value of ExclusiveGroup, then only the
45+
// last matching one of them will be selected.
46+
//
47+
// Setting this to the empty string is a special case, indicating that the
48+
// directory is not mutually exclusive with anything else.
49+
std::string ExclusiveGroup;
50+
4251
public:
4352
/// GCCSuffix, OSSuffix & IncludeSuffix will be appended directly to the
4453
/// sysroot string so they must either be empty or begin with a '/' character.
4554
/// This is enforced with an assert in the constructor.
4655
Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {},
47-
StringRef IncludeSuffix = {},
48-
const flags_list &Flags = flags_list());
56+
StringRef IncludeSuffix = {}, const flags_list &Flags = flags_list(),
57+
StringRef ExclusiveGroup = {});
4958

5059
/// Get the detected GCC installation path suffix for the multi-arch
5160
/// target variant. Always starts with a '/', unless empty
@@ -63,6 +72,9 @@ class Multilib {
6372
/// All elements begin with either '-' or '!'
6473
const flags_list &flags() const { return Flags; }
6574

75+
/// Get the exclusive group label.
76+
const std::string &exclusiveGroup() const { return ExclusiveGroup; }
77+
6678
LLVM_DUMP_METHOD void dump() const;
6779
/// print summary of the Multilib
6880
void print(raw_ostream &OS) const;

clang/include/clang/Driver/Options.td

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3174,7 +3174,8 @@ def fno_ms_compatibility : Flag<["-"], "fno-ms-compatibility">, Group<f_Group>,
31743174
def fno_objc_legacy_dispatch : Flag<["-"], "fno-objc-legacy-dispatch">, Group<f_Group>;
31753175
def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group<f_Group>,
31763176
Visibility<[ClangOption, CC1Option]>;
3177-
def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>;
3177+
def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>,
3178+
Visibility<[ClangOption, FlangOption]>;
31783179
defm operator_names : BoolFOption<"operator-names",
31793180
LangOpts<"CXXOperatorNames">, Default<cplusplus.KeyPath>,
31803181
NegFlag<SetFalse, [], [ClangOption, CC1Option],
@@ -3300,6 +3301,7 @@ defm objc_avoid_heapify_local_blocks : BoolFOption<"objc-avoid-heapify-local-blo
33003301
BothFlags<[], [CC1Option], " to avoid heapifying local blocks">>;
33013302

33023303
def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, Group<f_Group>,
3304+
Visibility<[ClangOption, FlangOption]>,
33033305
HelpText<"Omit the frame pointer from functions that don't need it. "
33043306
"Some stack unwinding cases, such as profilers and sanitizers, may prefer specifying -fno-omit-frame-pointer. "
33053307
"On many targets, -O1 and higher omit the frame pointer by default. "
@@ -6894,10 +6896,6 @@ def new_struct_path_tbaa : Flag<["-"], "new-struct-path-tbaa">,
68946896
def mdebug_pass : Separate<["-"], "mdebug-pass">,
68956897
HelpText<"Enable additional debug output">,
68966898
MarshallingInfoString<CodeGenOpts<"DebugPass">>;
6897-
def mframe_pointer_EQ : Joined<["-"], "mframe-pointer=">,
6898-
HelpText<"Specify which frame pointers to retain.">, Values<"all,non-leaf,none">,
6899-
NormalizedValuesScope<"CodeGenOptions::FramePointerKind">, NormalizedValues<["All", "NonLeaf", "None"]>,
6900-
MarshallingInfoEnum<CodeGenOpts<"FramePointer">, "None">;
69016899
def mabi_EQ_ieeelongdouble : Flag<["-"], "mabi=ieeelongdouble">,
69026900
HelpText<"Use IEEE 754 quadruple-precision for long double">,
69036901
MarshallingInfoFlag<LangOpts<"PPCIEEELongDouble">>;
@@ -7508,6 +7506,11 @@ def pic_is_pie : Flag<["-"], "pic-is-pie">,
75087506
HelpText<"File is for a position independent executable">,
75097507
MarshallingInfoFlag<LangOpts<"PIE">>;
75107508

7509+
def mframe_pointer_EQ : Joined<["-"], "mframe-pointer=">,
7510+
HelpText<"Specify which frame pointers to retain.">, Values<"all,non-leaf,none">,
7511+
NormalizedValuesScope<"CodeGenOptions::FramePointerKind">, NormalizedValues<["All", "NonLeaf", "None"]>,
7512+
MarshallingInfoEnum<CodeGenOpts<"FramePointer">, "None">;
7513+
75117514

75127515
def dependent_lib : Joined<["--"], "dependent-lib=">,
75137516
HelpText<"Add dependent library">,

clang/include/clang/Sema/Sema.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3937,6 +3937,11 @@ class Sema final {
39373937
APValue &Value, CCEKind CCE,
39383938
NamedDecl *Dest = nullptr);
39393939

3940+
ExprResult
3941+
EvaluateConvertedConstantExpression(Expr *E, QualType T, APValue &Value,
3942+
CCEKind CCE, bool RequireInt,
3943+
const APValue &PreNarrowingValue);
3944+
39403945
/// Abstract base class used to perform a contextual implicit
39413946
/// conversion from an expression to any type passing a filter.
39423947
class ContextualImplicitConverter {

clang/lib/CodeGen/CGCall.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5637,6 +5637,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
56375637
BundleList);
56385638
EmitBlock(Cont);
56395639
}
5640+
if (CI->getCalledFunction() && CI->getCalledFunction()->hasName() &&
5641+
CI->getCalledFunction()->getName().startswith("_Z4sqrt")) {
5642+
SetSqrtFPAccuracy(CI);
5643+
}
56405644
if (callOrInvoke)
56415645
*callOrInvoke = CI;
56425646

clang/lib/Driver/Multilib.cpp

Lines changed: 98 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "clang/Driver/Multilib.h"
1010
#include "clang/Basic/LLVM.h"
1111
#include "clang/Basic/Version.h"
12+
#include "llvm/ADT/DenseSet.h"
1213
#include "llvm/ADT/SmallString.h"
1314
#include "llvm/ADT/StringRef.h"
1415
#include "llvm/Support/Compiler.h"
@@ -29,9 +30,10 @@ using namespace driver;
2930
using namespace llvm::sys;
3031

3132
Multilib::Multilib(StringRef GCCSuffix, StringRef OSSuffix,
32-
StringRef IncludeSuffix, const flags_list &Flags)
33+
StringRef IncludeSuffix, const flags_list &Flags,
34+
StringRef ExclusiveGroup)
3335
: GCCSuffix(GCCSuffix), OSSuffix(OSSuffix), IncludeSuffix(IncludeSuffix),
34-
Flags(Flags) {
36+
Flags(Flags), ExclusiveGroup(ExclusiveGroup) {
3537
assert(GCCSuffix.empty() ||
3638
(StringRef(GCCSuffix).front() == '/' && GCCSuffix.size() > 1));
3739
assert(OSSuffix.empty() ||
@@ -96,13 +98,37 @@ bool MultilibSet::select(const Multilib::flags_list &Flags,
9698
llvm::SmallVector<Multilib> &Selected) const {
9799
llvm::StringSet<> FlagSet(expandFlags(Flags));
98100
Selected.clear();
99-
llvm::copy_if(Multilibs, std::back_inserter(Selected),
100-
[&FlagSet](const Multilib &M) {
101-
for (const std::string &F : M.flags())
102-
if (!FlagSet.contains(F))
103-
return false;
104-
return true;
105-
});
101+
102+
// Decide which multilibs we're going to select at all.
103+
llvm::DenseSet<StringRef> ExclusiveGroupsSelected;
104+
for (const Multilib &M : llvm::reverse(Multilibs)) {
105+
// If this multilib doesn't match all our flags, don't select it.
106+
if (!llvm::all_of(M.flags(), [&FlagSet](const std::string &F) {
107+
return FlagSet.contains(F);
108+
}))
109+
continue;
110+
111+
const std::string &group = M.exclusiveGroup();
112+
if (!group.empty()) {
113+
// If this multilib has the same ExclusiveGroup as one we've already
114+
// selected, skip it. We're iterating in reverse order, so the group
115+
// member we've selected already is preferred.
116+
//
117+
// Otherwise, add the group name to the set of groups we've already
118+
// selected a member of.
119+
auto [It, Inserted] = ExclusiveGroupsSelected.insert(group);
120+
if (!Inserted)
121+
continue;
122+
}
123+
124+
// Select this multilib.
125+
Selected.push_back(M);
126+
}
127+
128+
// We iterated in reverse order, so now put Selected back the right way
129+
// round.
130+
std::reverse(Selected.begin(), Selected.end());
131+
106132
return !Selected.empty();
107133
}
108134

@@ -138,10 +164,39 @@ static const VersionTuple MultilibVersionCurrent(1, 0);
138164
struct MultilibSerialization {
139165
std::string Dir;
140166
std::vector<std::string> Flags;
167+
std::string Group;
168+
};
169+
170+
enum class MultilibGroupType {
171+
/*
172+
* The only group type currently supported is 'Exclusive', which indicates a
173+
* group of multilibs of which at most one may be selected.
174+
*/
175+
Exclusive,
176+
177+
/*
178+
* Future possibility: a second group type indicating a set of library
179+
* directories that are mutually _dependent_ rather than mutually exclusive:
180+
* if you include one you must include them all.
181+
*
182+
* It might also be useful to allow groups to be members of other groups, so
183+
* that a mutually exclusive group could contain a mutually dependent set of
184+
* library directories, or vice versa.
185+
*
186+
* These additional features would need changes in the implementation, but
187+
* the YAML schema is set up so they can be added without requiring changes
188+
* in existing users' multilib.yaml files.
189+
*/
190+
};
191+
192+
struct MultilibGroupSerialization {
193+
std::string Name;
194+
MultilibGroupType Type;
141195
};
142196

143197
struct MultilibSetSerialization {
144198
llvm::VersionTuple MultilibVersion;
199+
std::vector<MultilibGroupSerialization> Groups;
145200
std::vector<MultilibSerialization> Multilibs;
146201
std::vector<MultilibSet::FlagMatcher> FlagMatchers;
147202
};
@@ -152,6 +207,7 @@ template <> struct llvm::yaml::MappingTraits<MultilibSerialization> {
152207
static void mapping(llvm::yaml::IO &io, MultilibSerialization &V) {
153208
io.mapRequired("Dir", V.Dir);
154209
io.mapRequired("Flags", V.Flags);
210+
io.mapOptional("Group", V.Group);
155211
}
156212
static std::string validate(IO &io, MultilibSerialization &V) {
157213
if (StringRef(V.Dir).starts_with("/"))
@@ -160,6 +216,19 @@ template <> struct llvm::yaml::MappingTraits<MultilibSerialization> {
160216
}
161217
};
162218

219+
template <> struct llvm::yaml::ScalarEnumerationTraits<MultilibGroupType> {
220+
static void enumeration(IO &io, MultilibGroupType &Val) {
221+
io.enumCase(Val, "Exclusive", MultilibGroupType::Exclusive);
222+
}
223+
};
224+
225+
template <> struct llvm::yaml::MappingTraits<MultilibGroupSerialization> {
226+
static void mapping(llvm::yaml::IO &io, MultilibGroupSerialization &V) {
227+
io.mapRequired("Name", V.Name);
228+
io.mapRequired("Type", V.Type);
229+
}
230+
};
231+
163232
template <> struct llvm::yaml::MappingTraits<MultilibSet::FlagMatcher> {
164233
static void mapping(llvm::yaml::IO &io, MultilibSet::FlagMatcher &M) {
165234
io.mapRequired("Match", M.Match);
@@ -180,6 +249,7 @@ template <> struct llvm::yaml::MappingTraits<MultilibSetSerialization> {
180249
static void mapping(llvm::yaml::IO &io, MultilibSetSerialization &M) {
181250
io.mapRequired("MultilibVersion", M.MultilibVersion);
182251
io.mapRequired("Variants", M.Multilibs);
252+
io.mapOptional("Groups", M.Groups);
183253
io.mapOptional("Mappings", M.FlagMatchers);
184254
}
185255
static std::string validate(IO &io, MultilibSetSerialization &M) {
@@ -191,11 +261,25 @@ template <> struct llvm::yaml::MappingTraits<MultilibSetSerialization> {
191261
if (M.MultilibVersion.getMinor() > MultilibVersionCurrent.getMinor())
192262
return "multilib version " + M.MultilibVersion.getAsString() +
193263
" is unsupported";
264+
for (const MultilibSerialization &Lib : M.Multilibs) {
265+
if (!Lib.Group.empty()) {
266+
bool Found = false;
267+
for (const MultilibGroupSerialization &Group : M.Groups)
268+
if (Group.Name == Lib.Group) {
269+
Found = true;
270+
break;
271+
}
272+
if (!Found)
273+
return "multilib \"" + Lib.Dir +
274+
"\" specifies undefined group name \"" + Lib.Group + "\"";
275+
}
276+
}
194277
return std::string{};
195278
}
196279
};
197280

198281
LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSerialization)
282+
LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
199283
LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSet::FlagMatcher)
200284

201285
llvm::ErrorOr<MultilibSet>
@@ -214,7 +298,11 @@ MultilibSet::parseYaml(llvm::MemoryBufferRef Input,
214298
std::string Dir;
215299
if (M.Dir != ".")
216300
Dir = "/" + M.Dir;
217-
Multilibs.emplace_back(Dir, Dir, Dir, M.Flags);
301+
// We transfer M.Group straight into the ExclusiveGroup parameter for the
302+
// Multilib constructor. If we later support more than one type of group,
303+
// we'll have to look up the group name in MS.Groups, check its type, and
304+
// decide what to do here.
305+
Multilibs.emplace_back(Dir, Dir, Dir, M.Flags, M.Group);
218306
}
219307

220308
return MultilibSet(std::move(Multilibs), std::move(MS.FlagMatchers));

0 commit comments

Comments
 (0)