Skip to content

Commit d8e679b

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:848336db8a6e into amd-gfx:a0a5f1ce3cdd
Local branch amd-gfx a0a5f1c Merged main:9d10fbbb299e into amd-gfx:accfac824752 Remote branch main 848336d [ExecutionEngine] Use llvm::is_contained (NFC)
2 parents a0a5f1c + 848336d commit d8e679b

File tree

124 files changed

+5846
-888
lines changed

Some content is hidden

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

124 files changed

+5846
-888
lines changed

bolt/lib/Passes/ValidateMemRefs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ bool ValidateMemRefs::checkAndFixJTReference(BinaryFunction &BF, MCInst &Inst,
3434
if (!JT)
3535
return false;
3636

37-
const bool IsLegitAccess = llvm::any_of(
38-
JT->Parents, [&](const BinaryFunction *Parent) { return Parent == &BF; });
37+
const bool IsLegitAccess = llvm::is_contained(JT->Parents, &BF);
3938
if (IsLegitAccess)
4039
return true;
4140

clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,12 @@ def main():
180180
if yaml:
181181
parser.add_argument(
182182
"-export-fixes",
183-
metavar="FILE",
183+
metavar="FILE_OR_DIRECTORY",
184184
dest="export_fixes",
185-
help="Create a yaml file to store suggested fixes in, "
186-
"which can be applied with clang-apply-replacements.",
185+
help="A directory or a yaml file to store suggested fixes in, "
186+
"which can be applied with clang-apply-replacements. If the "
187+
"parameter is a directory, the fixes of each compilation unit are "
188+
"stored in individual yaml files in the directory.",
187189
)
188190
parser.add_argument(
189191
"-extra-arg",
@@ -258,9 +260,25 @@ def main():
258260
max_task_count = multiprocessing.cpu_count()
259261
max_task_count = min(len(lines_by_file), max_task_count)
260262

261-
tmpdir = None
262-
if yaml and args.export_fixes:
263-
tmpdir = tempfile.mkdtemp()
263+
combine_fixes = False
264+
export_fixes_dir = None
265+
delete_fixes_dir = False
266+
if args.export_fixes is not None:
267+
# if a directory is given, create it if it does not exist
268+
if args.export_fixes.endswith(os.path.sep) and not os.path.isdir(
269+
args.export_fixes
270+
):
271+
os.makedirs(args.export_fixes)
272+
273+
if not os.path.isdir(args.export_fixes) and yaml:
274+
combine_fixes = True
275+
276+
if os.path.isdir(args.export_fixes):
277+
export_fixes_dir = args.export_fixes
278+
279+
if combine_fixes:
280+
export_fixes_dir = tempfile.mkdtemp()
281+
delete_fixes_dir = True
264282

265283
# Tasks for clang-tidy.
266284
task_queue = queue.Queue(max_task_count)
@@ -302,10 +320,10 @@ def main():
302320
# Run clang-tidy on files containing changes.
303321
command = [args.clang_tidy_binary]
304322
command.append("-line-filter=" + line_filter_json)
305-
if yaml and args.export_fixes:
323+
if args.export_fixes is not None:
306324
# Get a temporary file. We immediately close the handle so clang-tidy can
307325
# overwrite it.
308-
(handle, tmp_name) = tempfile.mkstemp(suffix=".yaml", dir=tmpdir)
326+
(handle, tmp_name) = tempfile.mkstemp(suffix=".yaml", dir=export_fixes_dir)
309327
os.close(handle)
310328
command.append("-export-fixes=" + tmp_name)
311329
command.extend(common_clang_tidy_args)
@@ -324,17 +342,17 @@ def main():
324342
if failed_files:
325343
return_code = 1
326344

327-
if yaml and args.export_fixes:
345+
if combine_fixes:
328346
print("Writing fixes to " + args.export_fixes + " ...")
329347
try:
330-
merge_replacement_files(tmpdir, args.export_fixes)
348+
merge_replacement_files(export_fixes_dir, args.export_fixes)
331349
except:
332350
sys.stderr.write("Error exporting fixes.\n")
333351
traceback.print_exc()
334352
return_code = 1
335353

336-
if tmpdir:
337-
shutil.rmtree(tmpdir)
354+
if delete_fixes_dir:
355+
shutil.rmtree(export_fixes_dir)
338356
sys.exit(return_code)
339357

340358

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,12 @@ def main():
308308
if yaml:
309309
parser.add_argument(
310310
"-export-fixes",
311-
metavar="filename",
311+
metavar="file_or_directory",
312312
dest="export_fixes",
313-
help="Create a yaml file to store suggested fixes in, "
314-
"which can be applied with clang-apply-replacements.",
313+
help="A directory or a yaml file to store suggested fixes in, "
314+
"which can be applied with clang-apply-replacements. If the "
315+
"parameter is a directory, the fixes of each compilation unit are "
316+
"stored in individual yaml files in the directory.",
315317
)
316318
parser.add_argument(
317319
"-j",
@@ -384,14 +386,30 @@ def main():
384386

385387
clang_tidy_binary = find_binary(args.clang_tidy_binary, "clang-tidy", build_path)
386388

387-
tmpdir = None
388389
if args.fix:
389390
clang_apply_replacements_binary = find_binary(
390391
args.clang_apply_replacements_binary, "clang-apply-replacements", build_path
391392
)
392393

393-
if args.fix or (yaml and args.export_fixes):
394-
tmpdir = tempfile.mkdtemp()
394+
combine_fixes = False
395+
export_fixes_dir = None
396+
delete_fixes_dir = False
397+
if args.export_fixes is not None:
398+
# if a directory is given, create it if it does not exist
399+
if args.export_fixes.endswith(os.path.sep) and not os.path.isdir(
400+
args.export_fixes
401+
):
402+
os.makedirs(args.export_fixes)
403+
404+
if not os.path.isdir(args.export_fixes) and yaml:
405+
combine_fixes = True
406+
407+
if os.path.isdir(args.export_fixes):
408+
export_fixes_dir = args.export_fixes
409+
410+
if export_fixes_dir is None and (args.fix or combine_fixes):
411+
export_fixes_dir = tempfile.mkdtemp()
412+
delete_fixes_dir = True
395413

396414
try:
397415
invocation = get_tidy_invocation(
@@ -450,7 +468,7 @@ def main():
450468
args=(
451469
args,
452470
clang_tidy_binary,
453-
tmpdir,
471+
export_fixes_dir,
454472
build_path,
455473
task_queue,
456474
lock,
@@ -474,14 +492,14 @@ def main():
474492
# This is a sad hack. Unfortunately subprocess goes
475493
# bonkers with ctrl-c and we start forking merrily.
476494
print("\nCtrl-C detected, goodbye.")
477-
if tmpdir:
478-
shutil.rmtree(tmpdir)
495+
if delete_fixes_dir:
496+
shutil.rmtree(export_fixes_dir)
479497
os.kill(0, 9)
480498

481-
if yaml and args.export_fixes:
499+
if combine_fixes:
482500
print("Writing fixes to " + args.export_fixes + " ...")
483501
try:
484-
merge_replacement_files(tmpdir, args.export_fixes)
502+
merge_replacement_files(export_fixes_dir, args.export_fixes)
485503
except:
486504
print("Error exporting fixes.\n", file=sys.stderr)
487505
traceback.print_exc()
@@ -490,14 +508,14 @@ def main():
490508
if args.fix:
491509
print("Applying fixes ...")
492510
try:
493-
apply_fixes(args, clang_apply_replacements_binary, tmpdir)
511+
apply_fixes(args, clang_apply_replacements_binary, export_fixes_dir)
494512
except:
495513
print("Error applying fixes.\n", file=sys.stderr)
496514
traceback.print_exc()
497515
return_code = 1
498516

499-
if tmpdir:
500-
shutil.rmtree(tmpdir)
517+
if delete_fixes_dir:
518+
shutil.rmtree(export_fixes_dir)
501519
sys.exit(return_code)
502520

503521

clang-tools-extra/clangd/SystemIncludeExtractor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ extractSystemIncludesAndTarget(const DriverArgs &InputArgs,
376376
auto Path = llvm::StringRef(*BuiltinHeaders).trim();
377377
if (!Path.empty() && llvm::sys::path::is_absolute(Path)) {
378378
auto Size = Info->SystemIncludes.size();
379-
llvm::erase_if(Info->SystemIncludes,
380-
[&](llvm::StringRef Entry) { return Path == Entry; });
379+
llvm::erase_value(Info->SystemIncludes, Path);
381380
vlog("System includes extractor: builtin headers {0} {1}", Path,
382381
(Info->SystemIncludes.size() != Size)
383382
? "excluded"

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ Improvements to clang-tidy
120120

121121
- Improved :program:`clang-tidy-diff.py` script. It now returns exit code `1`
122122
if any :program:`clang-tidy` subprocess exits with a non-zero code or if
123-
exporting fixes fails.
123+
exporting fixes fails. It now accepts a directory as a value for
124+
`-export-fixes` to export individual yaml files for each compilation unit.
125+
126+
- Improved :program:`run-clang-tidy.py` script. It now accepts a directory
127+
as a value for `-export-fixes` to export individual yaml files for each
128+
compilation unit.
124129

125130
New checks
126131
^^^^^^^^^^

clang/docs/tools/clang-formatted-files.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6813,7 +6813,6 @@ llvm/lib/Target/X86/X86LoadValueInjectionRetHardening.cpp
68136813
llvm/lib/Target/X86/X86LowerAMXIntrinsics.cpp
68146814
llvm/lib/Target/X86/X86LowerAMXType.cpp
68156815
llvm/lib/Target/X86/X86LowerTileCopy.cpp
6816-
llvm/lib/Target/X86/X86PreAMXConfig.cpp
68176816
llvm/lib/Target/X86/X86PreTileConfig.cpp
68186817
llvm/lib/Target/X86/X86RegisterBankInfo.h
68196818
llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp

clang/include/clang/Basic/riscv_sifive_vector.td

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,27 @@ let SupportOverloading = false in {
103103
defm sf_vc_v_fvw : RVVVCIXBuiltinSet<["si"], "UwKzUwUvFe", [-1, 0, 2, 3], UseGPR=0>;
104104
}
105105
}
106+
107+
multiclass RVVVQMACCBuiltinSet<list<list<string>> suffixes_prototypes> {
108+
let OverloadedName = NAME,
109+
Name = NAME,
110+
HasMasked = false,
111+
Log2LMUL = [0, 1, 2, 3] in
112+
defm NAME : RVVOutOp1Op2BuiltinSet<NAME, "i", suffixes_prototypes>;
113+
}
114+
115+
let UnMaskedPolicyScheme = HasPolicyOperand in
116+
let RequiredFeatures = ["Xsfvqmaccdod"] in {
117+
defm sf_vqmaccu_2x8x2 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)SUv(FixedSEW:8)Uv"]]>;
118+
defm sf_vqmacc_2x8x2 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)Sv(FixedSEW:8)v"]]>;
119+
defm sf_vqmaccus_2x8x2 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)SUv(FixedSEW:8)v"]]>;
120+
defm sf_vqmaccsu_2x8x2 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)Sv(FixedSEW:8)Uv"]]>;
121+
}
122+
123+
let UnMaskedPolicyScheme = HasPolicyOperand in
124+
let RequiredFeatures = ["Xsfvqmaccqoq"] in {
125+
defm sf_vqmaccu_4x8x4 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)SUv(FixedSEW:8)Uv"]]>;
126+
defm sf_vqmacc_4x8x4 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)Sv(FixedSEW:8)v"]]>;
127+
defm sf_vqmaccus_4x8x4 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)SUv(FixedSEW:8)v"]]>;
128+
defm sf_vqmaccsu_4x8x4 : RVVVQMACCBuiltinSet<[["", "v", "vv(FixedSEW:8)Sv(FixedSEW:8)Uv"]]>;
129+
}

clang/include/clang/Support/RISCVVIntrinsicUtils.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,16 @@ enum RVVRequire : uint16_t {
485485
RVV_REQ_RV64 = 1 << 0,
486486
RVV_REQ_ZvfhminOrZvfh = 1 << 1,
487487
RVV_REQ_Xsfvcp = 1 << 2,
488-
RVV_REQ_Zvbb = 1 << 3,
489-
RVV_REQ_Zvbc = 1 << 4,
490-
RVV_REQ_Zvkb = 1 << 5,
491-
RVV_REQ_Zvkg = 1 << 6,
492-
RVV_REQ_Zvkned = 1 << 7,
493-
RVV_REQ_Zvknha = 1 << 8,
494-
RVV_REQ_Zvksed = 1 << 9,
495-
RVV_REQ_Zvksh = 1 << 10,
488+
RVV_REQ_Xsfvqmaccdod = 1 << 3,
489+
RVV_REQ_Xsfvqmaccqoq = 1 << 4,
490+
RVV_REQ_Zvbb = 1 << 5,
491+
RVV_REQ_Zvbc = 1 << 6,
492+
RVV_REQ_Zvkb = 1 << 7,
493+
RVV_REQ_Zvkg = 1 << 8,
494+
RVV_REQ_Zvkned = 1 << 9,
495+
RVV_REQ_Zvknha = 1 << 10,
496+
RVV_REQ_Zvksed = 1 << 11,
497+
RVV_REQ_Zvksh = 1 << 12,
496498

497499
LLVM_MARK_AS_BITMASK_ENUM(RVV_REQ_Zvksh)
498500
};

clang/lib/Driver/Multilib.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@ MultilibSet::expandFlags(const Multilib::flags_list &InFlags) const {
122122

123123
const llvm::Regex Regex(RegexString);
124124
assert(Regex.isValid());
125-
if (llvm::find_if(InFlags, [&Regex](StringRef F) {
126-
return Regex.match(F);
127-
}) != InFlags.end()) {
125+
if (llvm::any_of(InFlags,
126+
[&Regex](StringRef F) { return Regex.match(F); })) {
128127
Result.insert(M.Flags.begin(), M.Flags.end());
129128
}
130129
}

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5244,11 +5244,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
52445244

52455245
auto findMacroDefinition = [&](const std::string &Macro) {
52465246
auto MacroDefs = Args.getAllArgValues(options::OPT_D);
5247-
return std::find_if(MacroDefs.begin(), MacroDefs.end(),
5248-
[&](const std::string &M) {
5249-
return M == Macro ||
5250-
M.find(Macro + '=') != std::string::npos;
5251-
}) != MacroDefs.end();
5247+
return llvm::any_of(MacroDefs, [&](const std::string &M) {
5248+
return M == Macro || M.find(Macro + '=') != std::string::npos;
5249+
});
52525250
};
52535251

52545252
// _UNIX03_WITHDRAWN is required for libcxx & porting.

clang/lib/Sema/SemaRISCVVectorLookup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ void RISCVIntrinsicManagerImpl::ConstructRVVIntrinsics(
205205
static const std::pair<const char *, RVVRequire> FeatureCheckList[] = {
206206
{"64bit", RVV_REQ_RV64},
207207
{"xsfvcp", RVV_REQ_Xsfvcp},
208+
{"xsfvqmaccdod", RVV_REQ_Xsfvqmaccdod},
209+
{"xsfvqmaccqoq", RVV_REQ_Xsfvqmaccqoq},
208210
{"experimental-zvbb", RVV_REQ_Zvbb},
209211
{"experimental-zvbc", RVV_REQ_Zvbc},
210212
{"experimental-zvkb", RVV_REQ_Zvkb},
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
2+
// REQUIRES: riscv-registered-target
3+
// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +xsfvqmaccdod \
4+
// RUN: -disable-O0-optnone -emit-llvm %s -o - | opt -S -passes=mem2reg | \
5+
// RUN: FileCheck --check-prefix=CHECK-RV64 %s
6+
7+
#include <sifive_vector.h>
8+
9+
// CHECK-RV64-LABEL: define dso_local <vscale x 2 x i32> @test_sf_vqmacc_2x8x2_i32m1
10+
// CHECK-RV64-SAME: (<vscale x 2 x i32> [[VD:%.*]], <vscale x 8 x i8> [[VS1:%.*]], <vscale x 8 x i8> [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
11+
// CHECK-RV64-NEXT: entry:
12+
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 2 x i32> @llvm.riscv.sf.vqmacc.2x8x2.nxv2i32.nxv8i8.nxv8i8.i64(<vscale x 2 x i32> [[VD]], <vscale x 8 x i8> [[VS1]], <vscale x 8 x i8> [[VS2]], i64 [[VL]], i64 3)
13+
// CHECK-RV64-NEXT: ret <vscale x 2 x i32> [[TMP0]]
14+
//
15+
vint32m1_t test_sf_vqmacc_2x8x2_i32m1(vint32m1_t vd, vint8m1_t vs1, vint8m1_t vs2, size_t vl) {
16+
return __riscv_sf_vqmacc_2x8x2_i32m1(vd, vs1, vs2, vl);
17+
}
18+
19+
// CHECK-RV64-LABEL: define dso_local <vscale x 4 x i32> @test_sf_vqmacc_2x8x2_i32m2
20+
// CHECK-RV64-SAME: (<vscale x 4 x i32> [[VD:%.*]], <vscale x 8 x i8> [[VS1:%.*]], <vscale x 16 x i8> [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
21+
// CHECK-RV64-NEXT: entry:
22+
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 4 x i32> @llvm.riscv.sf.vqmacc.2x8x2.nxv4i32.nxv8i8.nxv16i8.i64(<vscale x 4 x i32> [[VD]], <vscale x 8 x i8> [[VS1]], <vscale x 16 x i8> [[VS2]], i64 [[VL]], i64 3)
23+
// CHECK-RV64-NEXT: ret <vscale x 4 x i32> [[TMP0]]
24+
//
25+
vint32m2_t test_sf_vqmacc_2x8x2_i32m2(vint32m2_t vd, vint8m1_t vs1, vint8m2_t vs2, size_t vl) {
26+
return __riscv_sf_vqmacc_2x8x2_i32m2(vd, vs1, vs2, vl);
27+
}
28+
29+
// CHECK-RV64-LABEL: define dso_local <vscale x 8 x i32> @test_sf_vqmacc_2x8x2_i32m4
30+
// CHECK-RV64-SAME: (<vscale x 8 x i32> [[VD:%.*]], <vscale x 8 x i8> [[VS1:%.*]], <vscale x 32 x i8> [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
31+
// CHECK-RV64-NEXT: entry:
32+
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 8 x i32> @llvm.riscv.sf.vqmacc.2x8x2.nxv8i32.nxv8i8.nxv32i8.i64(<vscale x 8 x i32> [[VD]], <vscale x 8 x i8> [[VS1]], <vscale x 32 x i8> [[VS2]], i64 [[VL]], i64 3)
33+
// CHECK-RV64-NEXT: ret <vscale x 8 x i32> [[TMP0]]
34+
//
35+
vint32m4_t test_sf_vqmacc_2x8x2_i32m4(vint32m4_t vd, vint8m1_t vs1, vint8m4_t vs2, size_t vl) {
36+
return __riscv_sf_vqmacc_2x8x2_i32m4(vd, vs1, vs2, vl);
37+
}
38+
39+
// CHECK-RV64-LABEL: define dso_local <vscale x 16 x i32> @test_sf_vqmacc_2x8x2_i32m8
40+
// CHECK-RV64-SAME: (<vscale x 16 x i32> [[VD:%.*]], <vscale x 8 x i8> [[VS1:%.*]], <vscale x 64 x i8> [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
41+
// CHECK-RV64-NEXT: entry:
42+
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x i32> @llvm.riscv.sf.vqmacc.2x8x2.nxv16i32.nxv8i8.nxv64i8.i64(<vscale x 16 x i32> [[VD]], <vscale x 8 x i8> [[VS1]], <vscale x 64 x i8> [[VS2]], i64 [[VL]], i64 3)
43+
// CHECK-RV64-NEXT: ret <vscale x 16 x i32> [[TMP0]]
44+
//
45+
vint32m8_t test_sf_vqmacc_2x8x2_i32m8(vint32m8_t vd, vint8m1_t vs1, vint8m8_t vs2, size_t vl) {
46+
return __riscv_sf_vqmacc_2x8x2_i32m8(vd, vs1, vs2, vl);
47+
}

0 commit comments

Comments
 (0)