Skip to content

Commit

Permalink
merge main into amd-stg-open
Browse files Browse the repository at this point in the history
Change-Id: If3b11b81b0dd99b11c6ca4efa6e29e2a703f7e0f
  • Loading branch information
ronlieb committed Dec 2, 2023
2 parents c46437d + ff0d8a9 commit b25aa03
Show file tree
Hide file tree
Showing 251 changed files with 13,499 additions and 4,682 deletions.
3 changes: 1 addition & 2 deletions bolt/utils/llvm-bolt-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def run_cmd(cmd, out_f, cfg):
def run_bolt(bolt_path, bolt_args, out_f, cfg):
p2b = os.path.basename(sys.argv[0]) == "perf2bolt" # perf2bolt mode
bd = os.path.basename(sys.argv[0]) == "llvm-boltdiff" # boltdiff mode
hm = sys.argv[1] == "heatmap" # heatmap mode
cmd = ["/usr/bin/time", "-f", "%e %M", bolt_path] + bolt_args
if p2b:
# -ignore-build-id can occur at most once, hence remove it from cmd
Expand All @@ -121,7 +120,7 @@ def run_bolt(bolt_path, bolt_args, out_f, cfg):
cmd += PERF2BOLT_MODE
elif bd:
cmd += BOLTDIFF_MODE
elif not cfg.NO_MINIMIZE and not hm:
elif not cfg.NO_MINIMIZE:
cmd += MINIMIZE_DIFFS
return run_cmd(cmd, out_f, cfg)

Expand Down
2 changes: 1 addition & 1 deletion bolt/utils/nfc-stat-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main():
)
parser.add_argument(
"--check_longer_than",
default=1,
default=2,
type=float,
help="Only warn on tests longer than X seconds for at least one side",
)
Expand Down
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ C++2c Feature Support

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

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


Resolutions to C++ Defect Reports
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
13 changes: 13 additions & 0 deletions clang/include/clang/Basic/arm_sme.td
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,16 @@ let TargetGuard = "sme2" in {

def SVBMOPS : Inst<"svbmops_za32[_{d}]_m", "viPPdd", "iUi", MergeNone, "aarch64_sme_bmops_za32", [IsSharedZA, IsStreaming], [ImmCheck<0, ImmCheck0_3>]>;
}

//
// Spill and fill of ZT0
//
let TargetGuard = "sme2" in {
def SVLDR_ZT : Inst<"svldr_zt", "viQ", "", MergeNone, "aarch64_sme_ldr_zt", [IsOverloadNone, IsStreamingCompatible, IsSharedZA, IsPreservesZA], [ImmCheck<0, ImmCheck0_0>]>;
def SVSTR_ZT : Inst<"svstr_zt", "vi%", "", MergeNone, "aarch64_sme_str_zt", [IsOverloadNone, IsStreamingCompatible, IsSharedZA, IsPreservesZA], [ImmCheck<0, ImmCheck0_0>]>;

//
// Zero ZT0
//
def SVZERO_ZT : Inst<"svzero_zt", "vi", "", MergeNone, "aarch64_sme_zero_zt", [IsOverloadNone, IsStreamingCompatible, IsSharedZA], [ImmCheck<0, ImmCheck0_0>]>;
}
16 changes: 14 additions & 2 deletions clang/include/clang/Driver/Multilib.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,22 @@ class Multilib {
std::string IncludeSuffix;
flags_list Flags;

// Optionally, a multilib can be assigned a string tag indicating that it's
// part of a group of mutually exclusive possibilities. If two or more
// multilibs have the same non-empty value of ExclusiveGroup, then only the
// last matching one of them will be selected.
//
// Setting this to the empty string is a special case, indicating that the
// directory is not mutually exclusive with anything else.
std::string ExclusiveGroup;

public:
/// GCCSuffix, OSSuffix & IncludeSuffix will be appended directly to the
/// sysroot string so they must either be empty or begin with a '/' character.
/// This is enforced with an assert in the constructor.
Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {},
StringRef IncludeSuffix = {},
const flags_list &Flags = flags_list());
StringRef IncludeSuffix = {}, const flags_list &Flags = flags_list(),
StringRef ExclusiveGroup = {});

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

/// Get the exclusive group label.
const std::string &exclusiveGroup() const { return ExclusiveGroup; }

LLVM_DUMP_METHOD void dump() const;
/// print summary of the Multilib
void print(raw_ostream &OS) const;
Expand Down
13 changes: 8 additions & 5 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -3174,7 +3174,8 @@ def fno_ms_compatibility : Flag<["-"], "fno-ms-compatibility">, Group<f_Group>,
def fno_objc_legacy_dispatch : Flag<["-"], "fno-objc-legacy-dispatch">, Group<f_Group>;
def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group<f_Group>,
Visibility<[ClangOption, CC1Option]>;
def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>;
def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>,
Visibility<[ClangOption, FlangOption]>;
defm operator_names : BoolFOption<"operator-names",
LangOpts<"CXXOperatorNames">, Default<cplusplus.KeyPath>,
NegFlag<SetFalse, [], [ClangOption, CC1Option],
Expand Down Expand Up @@ -3300,6 +3301,7 @@ defm objc_avoid_heapify_local_blocks : BoolFOption<"objc-avoid-heapify-local-blo
BothFlags<[], [CC1Option], " to avoid heapifying local blocks">>;

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

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


def dependent_lib : Joined<["--"], "dependent-lib=">,
HelpText<"Add dependent library">,
Expand Down
5 changes: 5 additions & 0 deletions clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -3937,6 +3937,11 @@ class Sema final {
APValue &Value, CCEKind CCE,
NamedDecl *Dest = nullptr);

ExprResult
EvaluateConvertedConstantExpression(Expr *E, QualType T, APValue &Value,
CCEKind CCE, bool RequireInt,
const APValue &PreNarrowingValue);

/// Abstract base class used to perform a contextual implicit
/// conversion from an expression to any type passing a filter.
class ContextualImplicitConverter {
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/CodeGen/CGCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5637,6 +5637,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
BundleList);
EmitBlock(Cont);
}
if (CI->getCalledFunction() && CI->getCalledFunction()->hasName() &&
CI->getCalledFunction()->getName().startswith("_Z4sqrt")) {
SetSqrtFPAccuracy(CI);
}
if (callOrInvoke)
*callOrInvoke = CI;

Expand Down
108 changes: 98 additions & 10 deletions clang/lib/Driver/Multilib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "clang/Driver/Multilib.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/Version.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
Expand All @@ -29,9 +30,10 @@ using namespace driver;
using namespace llvm::sys;

Multilib::Multilib(StringRef GCCSuffix, StringRef OSSuffix,
StringRef IncludeSuffix, const flags_list &Flags)
StringRef IncludeSuffix, const flags_list &Flags,
StringRef ExclusiveGroup)
: GCCSuffix(GCCSuffix), OSSuffix(OSSuffix), IncludeSuffix(IncludeSuffix),
Flags(Flags) {
Flags(Flags), ExclusiveGroup(ExclusiveGroup) {
assert(GCCSuffix.empty() ||
(StringRef(GCCSuffix).front() == '/' && GCCSuffix.size() > 1));
assert(OSSuffix.empty() ||
Expand Down Expand Up @@ -96,13 +98,37 @@ bool MultilibSet::select(const Multilib::flags_list &Flags,
llvm::SmallVector<Multilib> &Selected) const {
llvm::StringSet<> FlagSet(expandFlags(Flags));
Selected.clear();
llvm::copy_if(Multilibs, std::back_inserter(Selected),
[&FlagSet](const Multilib &M) {
for (const std::string &F : M.flags())
if (!FlagSet.contains(F))
return false;
return true;
});

// Decide which multilibs we're going to select at all.
llvm::DenseSet<StringRef> ExclusiveGroupsSelected;
for (const Multilib &M : llvm::reverse(Multilibs)) {
// If this multilib doesn't match all our flags, don't select it.
if (!llvm::all_of(M.flags(), [&FlagSet](const std::string &F) {
return FlagSet.contains(F);
}))
continue;

const std::string &group = M.exclusiveGroup();
if (!group.empty()) {
// If this multilib has the same ExclusiveGroup as one we've already
// selected, skip it. We're iterating in reverse order, so the group
// member we've selected already is preferred.
//
// Otherwise, add the group name to the set of groups we've already
// selected a member of.
auto [It, Inserted] = ExclusiveGroupsSelected.insert(group);
if (!Inserted)
continue;
}

// Select this multilib.
Selected.push_back(M);
}

// We iterated in reverse order, so now put Selected back the right way
// round.
std::reverse(Selected.begin(), Selected.end());

return !Selected.empty();
}

Expand Down Expand Up @@ -138,10 +164,39 @@ static const VersionTuple MultilibVersionCurrent(1, 0);
struct MultilibSerialization {
std::string Dir;
std::vector<std::string> Flags;
std::string Group;
};

enum class MultilibGroupType {
/*
* The only group type currently supported is 'Exclusive', which indicates a
* group of multilibs of which at most one may be selected.
*/
Exclusive,

/*
* Future possibility: a second group type indicating a set of library
* directories that are mutually _dependent_ rather than mutually exclusive:
* if you include one you must include them all.
*
* It might also be useful to allow groups to be members of other groups, so
* that a mutually exclusive group could contain a mutually dependent set of
* library directories, or vice versa.
*
* These additional features would need changes in the implementation, but
* the YAML schema is set up so they can be added without requiring changes
* in existing users' multilib.yaml files.
*/
};

struct MultilibGroupSerialization {
std::string Name;
MultilibGroupType Type;
};

struct MultilibSetSerialization {
llvm::VersionTuple MultilibVersion;
std::vector<MultilibGroupSerialization> Groups;
std::vector<MultilibSerialization> Multilibs;
std::vector<MultilibSet::FlagMatcher> FlagMatchers;
};
Expand All @@ -152,6 +207,7 @@ template <> struct llvm::yaml::MappingTraits<MultilibSerialization> {
static void mapping(llvm::yaml::IO &io, MultilibSerialization &V) {
io.mapRequired("Dir", V.Dir);
io.mapRequired("Flags", V.Flags);
io.mapOptional("Group", V.Group);
}
static std::string validate(IO &io, MultilibSerialization &V) {
if (StringRef(V.Dir).starts_with("/"))
Expand All @@ -160,6 +216,19 @@ template <> struct llvm::yaml::MappingTraits<MultilibSerialization> {
}
};

template <> struct llvm::yaml::ScalarEnumerationTraits<MultilibGroupType> {
static void enumeration(IO &io, MultilibGroupType &Val) {
io.enumCase(Val, "Exclusive", MultilibGroupType::Exclusive);
}
};

template <> struct llvm::yaml::MappingTraits<MultilibGroupSerialization> {
static void mapping(llvm::yaml::IO &io, MultilibGroupSerialization &V) {
io.mapRequired("Name", V.Name);
io.mapRequired("Type", V.Type);
}
};

template <> struct llvm::yaml::MappingTraits<MultilibSet::FlagMatcher> {
static void mapping(llvm::yaml::IO &io, MultilibSet::FlagMatcher &M) {
io.mapRequired("Match", M.Match);
Expand All @@ -180,6 +249,7 @@ template <> struct llvm::yaml::MappingTraits<MultilibSetSerialization> {
static void mapping(llvm::yaml::IO &io, MultilibSetSerialization &M) {
io.mapRequired("MultilibVersion", M.MultilibVersion);
io.mapRequired("Variants", M.Multilibs);
io.mapOptional("Groups", M.Groups);
io.mapOptional("Mappings", M.FlagMatchers);
}
static std::string validate(IO &io, MultilibSetSerialization &M) {
Expand All @@ -191,11 +261,25 @@ template <> struct llvm::yaml::MappingTraits<MultilibSetSerialization> {
if (M.MultilibVersion.getMinor() > MultilibVersionCurrent.getMinor())
return "multilib version " + M.MultilibVersion.getAsString() +
" is unsupported";
for (const MultilibSerialization &Lib : M.Multilibs) {
if (!Lib.Group.empty()) {
bool Found = false;
for (const MultilibGroupSerialization &Group : M.Groups)
if (Group.Name == Lib.Group) {
Found = true;
break;
}
if (!Found)
return "multilib \"" + Lib.Dir +
"\" specifies undefined group name \"" + Lib.Group + "\"";
}
}
return std::string{};
}
};

LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSerialization)
LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSet::FlagMatcher)

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

return MultilibSet(std::move(Multilibs), std::move(MS.FlagMatchers));
Expand Down
Loading

0 comments on commit b25aa03

Please sign in to comment.