Skip to content

Commit cf37bdb

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:a384cd5012b857f2464fff21c39d032632af1515 into amd-gfx:5aaffd43ea2e
Local branch amd-gfx 5aaffd4 Merged main:a1f1371fdc7d9af9edf32339dcfebada96d937a5 into amd-gfx:45668192a2fc Remote branch main a384cd5 [X86][BF16] Add subvec_zero_lowering patterns (llvm#76507)
2 parents 5aaffd4 + a384cd5 commit cf37bdb

File tree

100 files changed

+1518
-554
lines changed

Some content is hidden

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

100 files changed

+1518
-554
lines changed

clang/docs/ClangFormat.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,27 @@ An easy way to create the ``.clang-format`` file is:
131131
132132
Available style options are described in :doc:`ClangFormatStyleOptions`.
133133

134+
You can create ``.clang-format-ignore`` files to make ``clang-format`` ignore
135+
certain files. A ``.clang-format-ignore`` file consists of patterns of file path
136+
names. It has the following format:
137+
138+
* A blank line is skipped.
139+
* Leading and trailing spaces of a line are trimmed.
140+
* A line starting with a hash (``#``) is a comment.
141+
* A non-comment line is a single pattern.
142+
* The slash (``/``) is used as the directory separator.
143+
* A pattern is relative to the directory of the ``.clang-format-ignore`` file
144+
(or the root directory if the pattern starts with a slash).
145+
* Patterns follow the rules specified in `POSIX 2.13.1, 2.13.2, and Rule 1 of
146+
2.13.3 <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/
147+
V3_chap02.html#tag_18_13>`_.
148+
* A pattern is negated if it starts with a bang (``!``).
149+
150+
To match all files in a directory, use e.g. ``foo/bar/*``. To match all files in
151+
the directory of the ``.clang-format-ignore`` file, use ``*``.
152+
Multiple ``.clang-format-ignore`` files are supported similar to the
153+
``.clang-format`` files, with a lower directory level file voiding the higher
154+
level ones.
134155

135156
Vim Integration
136157
===============

clang/docs/LibASTMatchersTutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Okay. Now we'll build Clang!
5050
5151
cd ~/clang-llvm
5252
mkdir build && cd build
53-
cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_BUILD_TESTS=ON # Enable tests; default is off.
53+
cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_TESTS=ON
5454
ninja
5555
ninja check # Test LLVM only.
5656
ninja clang-test # Test Clang only.

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ clang-format
10411041
- Add ``BreakAdjacentStringLiterals`` option.
10421042
- Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property
10431043
attributes (like ``nonatomic, strong, nullable``).
1044+
- Add ``.clang-format-ignore`` files.
10441045

10451046
libclang
10461047
--------
@@ -1126,9 +1127,11 @@ Improvements
11261127
^^^^^^^^^^^^
11271128

11281129
- Improved the ``unix.StdCLibraryFunctions`` checker by modeling more
1129-
functions like ``send``, ``recv``, ``readlink`` and ``errno`` behavior.
1130+
functions like ``send``, ``recv``, ``readlink``, ``fflush`` and
1131+
``errno`` behavior.
11301132
(`52ac71f92d38 <https://github.com/llvm/llvm-project/commit/52ac71f92d38f75df5cb88e9c090ac5fd5a71548>`_,
11311133
`#71373 <https://github.com/llvm/llvm-project/pull/71373>`_,
1134+
`#76557 <https://github.com/llvm/llvm-project/pull/76557>`_,
11321135
`#71392 <https://github.com/llvm/llvm-project/pull/71392>`_)
11331136

11341137
- Fixed a false negative for when accessing a nonnull property (ObjC).

clang/include/clang/Basic/riscv_sifive_vector.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ multiclass RVVVFWMACCBuiltinSet<list<list<string>> suffixes_prototypes> {
109109
Name = NAME,
110110
HasMasked = false,
111111
Log2LMUL = [-2, -1, 0, 1, 2] in
112-
defm NAME : RVVOutOp1Op2BuiltinSet<NAME, "b", suffixes_prototypes>;
112+
defm NAME : RVVOutOp1Op2BuiltinSet<NAME, "y", suffixes_prototypes>;
113113
}
114114

115115
multiclass RVVVQMACCDODBuiltinSet<list<list<string>> suffixes_prototypes> {

clang/include/clang/Basic/riscv_vector_common.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// x: float16_t (half)
4242
// f: float32_t (float)
4343
// d: float64_t (double)
44-
// b: bfloat16_t (bfloat16)
44+
// y: bfloat16_t (bfloat16)
4545
//
4646
// This way, given an LMUL, a record with a TypeRange "sil" will cause the
4747
// definition of 3 builtins. Each type "t" in the TypeRange (in this example

clang/lib/Format/ContinuationIndenter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
398398
}
399399
if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
400400
(Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) &&
401-
Style.isCpp() &&
401+
State.Line->First->isNot(TT_AttributeSquare) && Style.isCpp() &&
402402
// FIXME: This is a temporary workaround for the case where clang-format
403403
// sets BreakBeforeParameter to avoid bin packing and this creates a
404404
// completely unnecessary line break after a template type that isn't

clang/lib/Format/MatchFilePath.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ using namespace llvm;
1919
namespace clang {
2020
namespace format {
2121

22-
// Check whether `FilePath` matches `Pattern` based on POSIX (1003.1-2008)
23-
// 2.13.1, 2.13.2, and Rule 1 of 2.13.3.
22+
// Check whether `FilePath` matches `Pattern` based on POSIX 2.13.1, 2.13.2, and
23+
// Rule 1 of 2.13.3.
2424
bool matchFilePath(StringRef Pattern, StringRef FilePath) {
2525
assert(!Pattern.empty());
2626
assert(!FilePath.empty());

clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,14 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
22442244
.ArgConstraint(NotNull(ArgNo(0)))
22452245
.ArgConstraint(NotNull(ArgNo(1))));
22462246

2247+
// int fflush(FILE *stream);
2248+
addToFunctionSummaryMap(
2249+
"fflush", Signature(ArgTypes{FilePtrTy}, RetType{IntTy}),
2250+
Summary(NoEvalCall)
2251+
.Case(ReturnsZero, ErrnoMustNotBeChecked, GenericSuccessMsg)
2252+
.Case({ReturnValueCondition(WithinRange, SingleValue(EOFv))},
2253+
ErrnoNEZeroIrrelevant, GenericFailureMsg));
2254+
22472255
// long ftell(FILE *stream);
22482256
// From 'The Open Group Base Specifications Issue 7, 2018 edition':
22492257
// "The ftell() function shall not change the setting of errno if

clang/lib/Support/RISCVVIntrinsicUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void RVVType::initBuiltinStr() {
203203
}
204204
break;
205205
case ScalarTypeKind::BFloat:
206-
BuiltinStr += "b";
206+
BuiltinStr += "y";
207207
break;
208208
default:
209209
llvm_unreachable("ScalarType is invalid!");

clang/test/Analysis/stream-errno.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,29 @@ void check_fileno(void) {
222222
}
223223
if (errno) {} // expected-warning{{An undefined value may be read from 'errno'}}
224224
}
225+
226+
void check_fflush_opened_file(void) {
227+
FILE *F = tmpfile();
228+
if (!F)
229+
return;
230+
int N = fflush(F);
231+
if (N == EOF) {
232+
clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
233+
if (errno) {} // no-warning
234+
} else {
235+
clang_analyzer_eval(N == 0); // expected-warning{{TRUE}}
236+
if (errno) {} // expected-warning{{An undefined value may be read from 'errno'}}
237+
}
238+
fclose(F);
239+
}
240+
241+
void check_fflush_all(void) {
242+
int N = fflush(NULL);
243+
if (N == 0) {
244+
if (errno) {} // expected-warning{{An undefined value may be read from 'errno'}}
245+
} else {
246+
clang_analyzer_eval(N == EOF); // expected-warning{{TRUE}}
247+
clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
248+
if (errno) {} // no-warning
249+
}
250+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: rm -rf %t.dir
2+
// RUN: mkdir -p %t.dir/level1/level2
3+
4+
// RUN: cd %t.dir
5+
// RUN: echo "*" > .clang-format-ignore
6+
// RUN: echo "level*/*.c*" >> .clang-format-ignore
7+
// RUN: echo "*/*2/foo.*" >> .clang-format-ignore
8+
// RUN: touch foo.cc
9+
// RUN: clang-format -verbose .clang-format-ignore foo.cc 2> %t.stderr
10+
// RUN: not grep Formatting %t.stderr
11+
12+
// RUN: cd level1
13+
// RUN: touch bar.cc baz.c
14+
// RUN: clang-format -verbose bar.cc baz.c 2> %t.stderr
15+
// RUN: not grep Formatting %t.stderr
16+
17+
// RUN: cd level2
18+
// RUN: touch foo.c foo.js
19+
// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
20+
// RUN: not grep Formatting %t.stderr
21+
22+
// RUN: touch .clang-format-ignore
23+
// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
24+
// RUN: grep "Formatting \[1/2] foo.c" %t.stderr
25+
// RUN: grep "Formatting \[2/2] foo.js" %t.stderr
26+
27+
// RUN: echo "*.js" > .clang-format-ignore
28+
// RUN: clang-format -verbose foo.c foo.js 2> %t.stderr
29+
// RUN: grep "Formatting \[1/2] foo.c" %t.stderr
30+
// RUN: not grep "Formatting \[2/2] foo.js" %t.stderr
31+
32+
// RUN: cd ../../..
33+
// RUN: rm -rf %t.dir

clang/test/Preprocessor/riscv-target-features.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
// CHECK-NOT: __riscv_zfa {{.*$}}
119119
// CHECK-NOT: __riscv_zfbfmin {{.*$}}
120120
// CHECK-NOT: __riscv_zicfilp {{.*$}}
121+
// CHECK-NOT: __riscv_zicfiss {{.*$}}
121122
// CHECK-NOT: __riscv_zicond {{.*$}}
122123
// CHECK-NOT: __riscv_zimop {{.*$}}
123124
// CHECK-NOT: __riscv_zcmop {{.*$}}
@@ -1287,3 +1288,11 @@
12871288
// RUN: %clang --target=riscv64-unknown-linux-gnu -march=rv64i -E -dM %s \
12881289
// RUN: -munaligned-access -o - | FileCheck %s --check-prefix=CHECK-MISALIGNED-FAST
12891290
// CHECK-MISALIGNED-FAST: __riscv_misaligned_fast 1
1291+
1292+
// RUN: %clang -target riscv32 -menable-experimental-extensions \
1293+
// RUN: -march=rv32izicfiss0p4 -x c -E -dM %s \
1294+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZICFISS-EXT %s
1295+
// RUN: %clang -target riscv64 -menable-experimental-extensions \
1296+
// RUN: -march=rv64izicfiss0p4 -x c -E -dM %s \
1297+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZICFISS-EXT %s
1298+
// CHECK-ZICFISS-EXT: __riscv_zicfiss 4000{{$}}

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
///
1313
//===----------------------------------------------------------------------===//
1414

15+
#include "../../lib/Format/MatchFilePath.h"
1516
#include "clang/Basic/Diagnostic.h"
1617
#include "clang/Basic/DiagnosticOptions.h"
1718
#include "clang/Basic/FileManager.h"
@@ -570,6 +571,69 @@ static int dumpConfig(bool IsSTDIN) {
570571
return 0;
571572
}
572573

574+
// Check whether `FilePath` is ignored according to the nearest
575+
// .clang-format-ignore file based on the rules below:
576+
// - A blank line is skipped.
577+
// - Leading and trailing spaces of a line are trimmed.
578+
// - A line starting with a hash (`#`) is a comment.
579+
// - A non-comment line is a single pattern.
580+
// - The slash (`/`) is used as the directory separator.
581+
// - A pattern is relative to the directory of the .clang-format-ignore file (or
582+
// the root directory if the pattern starts with a slash).
583+
// - A pattern is negated if it starts with a bang (`!`).
584+
static bool isIgnored(StringRef FilePath) {
585+
using namespace llvm::sys::fs;
586+
if (!is_regular_file(FilePath))
587+
return false;
588+
589+
using namespace llvm::sys::path;
590+
SmallString<128> Path, AbsPath{FilePath};
591+
592+
make_absolute(AbsPath);
593+
remove_dots(AbsPath, /*remove_dot_dot=*/true);
594+
595+
StringRef IgnoreDir{AbsPath};
596+
do {
597+
IgnoreDir = parent_path(IgnoreDir);
598+
if (IgnoreDir.empty())
599+
return false;
600+
601+
Path = IgnoreDir;
602+
append(Path, ".clang-format-ignore");
603+
} while (!is_regular_file(Path));
604+
605+
std::ifstream IgnoreFile{Path.c_str()};
606+
if (!IgnoreFile.good())
607+
return false;
608+
609+
const auto Pathname = convert_to_slash(AbsPath);
610+
for (std::string Line; std::getline(IgnoreFile, Line);) {
611+
auto Pattern = StringRef(Line).trim();
612+
if (Pattern.empty() || Pattern[0] == '#')
613+
continue;
614+
615+
const bool IsNegated = Pattern[0] == '!';
616+
if (IsNegated)
617+
Pattern = Pattern.drop_front();
618+
619+
if (Pattern.empty())
620+
continue;
621+
622+
Pattern = Pattern.ltrim();
623+
if (Pattern[0] != '/') {
624+
Path = convert_to_slash(IgnoreDir);
625+
append(Path, Style::posix, Pattern);
626+
remove_dots(Path, /*remove_dot_dot=*/true, Style::posix);
627+
Pattern = Path.str();
628+
}
629+
630+
if (clang::format::matchFilePath(Pattern, Pathname) == !IsNegated)
631+
return true;
632+
}
633+
634+
return false;
635+
}
636+
573637
int main(int argc, const char **argv) {
574638
llvm::InitLLVM X(argc, argv);
575639

@@ -618,11 +682,14 @@ int main(int argc, const char **argv) {
618682
unsigned FileNo = 1;
619683
bool Error = false;
620684
for (const auto &FileName : FileNames) {
685+
const bool IsSTDIN = FileName == "-";
686+
if (!IsSTDIN && isIgnored(FileName))
687+
continue;
621688
if (Verbose) {
622689
errs() << "Formatting [" << FileNo++ << "/" << FileNames.size() << "] "
623690
<< FileName << "\n";
624691
}
625-
Error |= clang::format::format(FileName, FileName == "-");
692+
Error |= clang::format::format(FileName, IsSTDIN);
626693
}
627694
return Error ? 1 : 0;
628695
}

clang/unittests/Format/FormatTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26295,6 +26295,8 @@ TEST_F(FormatTest, BreakAfterAttributes) {
2629526295
constexpr StringRef Code("[[maybe_unused]] const int i;\n"
2629626296
"[[foo([[]])]] [[maybe_unused]]\n"
2629726297
"int j;\n"
26298+
"[[maybe_unused]]\n"
26299+
"foo<int> k;\n"
2629826300
"[[nodiscard]] inline int f(int &i);\n"
2629926301
"[[foo([[]])]] [[nodiscard]]\n"
2630026302
"int g(int &i);\n"
@@ -26315,6 +26317,7 @@ TEST_F(FormatTest, BreakAfterAttributes) {
2631526317
Style.BreakAfterAttributes = FormatStyle::ABS_Never;
2631626318
verifyFormat("[[maybe_unused]] const int i;\n"
2631726319
"[[foo([[]])]] [[maybe_unused]] int j;\n"
26320+
"[[maybe_unused]] foo<int> k;\n"
2631826321
"[[nodiscard]] inline int f(int &i);\n"
2631926322
"[[foo([[]])]] [[nodiscard]] int g(int &i);\n"
2632026323
"[[nodiscard]] inline int f(int &i) {\n"
@@ -26332,6 +26335,8 @@ TEST_F(FormatTest, BreakAfterAttributes) {
2633226335
"const int i;\n"
2633326336
"[[foo([[]])]] [[maybe_unused]]\n"
2633426337
"int j;\n"
26338+
"[[maybe_unused]]\n"
26339+
"foo<int> k;\n"
2633526340
"[[nodiscard]]\n"
2633626341
"inline int f(int &i);\n"
2633726342
"[[foo([[]])]] [[nodiscard]]\n"

clang/utils/TableGen/RISCVVEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static BasicType ParseBasicType(char c) {
151151
case 'd':
152152
return BasicType::Float64;
153153
break;
154-
case 'b':
154+
case 'y':
155155
return BasicType::BFloat16;
156156
break;
157157
default:

compiler-rt/lib/asan/asan_linux.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size,
140140
internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
141141
return 0;
142142
# endif
143+
# if SANITIZER_FREEBSD
144+
// Ignore vDSO.
145+
if (internal_strcmp(info->dlpi_name, "[vdso]") == 0)
146+
return 0;
147+
# endif
143148

144149
*name = info->dlpi_name;
145150
return 1;

compiler-rt/lib/builtins/cpu_model/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ static const char *getAMDProcessorTypeAndSubtype(unsigned Family,
676676
case 25:
677677
CPU = "znver3";
678678
*Type = AMDFAM19H;
679-
if ((Model >= 0x00 && Model <= 0x0f) || (Model >= 0x20 && Model <= 0x2f) ||
679+
if ((Model <= 0x0f) || (Model >= 0x20 && Model <= 0x2f) ||
680680
(Model >= 0x30 && Model <= 0x3f) || (Model >= 0x40 && Model <= 0x4f) ||
681681
(Model >= 0x50 && Model <= 0x5f)) {
682682
// Family 19h Models 00h-0Fh (Genesis, Chagall) Zen 3

libc/cmake/modules/prepare_libc_gpu_build.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ endif()
55

66
# Set up the target architectures to build the GPU libc for.
77
set(all_amdgpu_architectures "gfx700;gfx701;gfx801;gfx803;gfx900;gfx902;gfx906"
8-
"gfx908;gfx90a;gfx90c;gfx940;gfx1010;gfx1030"
9-
"gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036"
8+
"gfx908;gfx90a;gfx90c;gfx940;gfx941;gfx942"
9+
"gfx1010;gfx1030;gfx1031;gfx1032;gfx1033;gfx1034"
10+
"gfx1035;gfx1036"
1011
"gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151")
1112
set(all_nvptx_architectures "sm_35;sm_37;sm_50;sm_52;sm_53;sm_60;sm_61;sm_62"
1213
"sm_70;sm_72;sm_75;sm_80;sm_86;sm_89;sm_90")

libc/src/math/gpu/vendor/amdgpu/platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9010;
7272
extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9012;
7373
#elif defined(__gfx940__)
7474
extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9400;
75+
#elif defined(__gfx941__)
76+
extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9401;
77+
#elif defined(__gfx942__)
78+
extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9402;
7579
#elif defined(__gfx1010__)
7680
extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10100;
7781
#elif defined(__gfx1011__)

0 commit comments

Comments
 (0)