Skip to content

Commit 7e00bdd

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:fd1a0b0ee4d8 into amd-gfx:21aa606b362c
Local branch amd-gfx 21aa606 Merged main:cfbf0a500f17 into amd-gfx:4a56624c1a7e Remote branch main fd1a0b0 nfc, add test case for llvm-symbolizer on XCOFF
2 parents 21aa606 + fd1a0b0 commit 7e00bdd

Some content is hidden

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

46 files changed

+1223
-183
lines changed

clang/lib/Driver/ToolChains/DragonFly.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
5656
const InputInfoList &Inputs,
5757
const ArgList &Args,
5858
const char *LinkingOutput) const {
59-
const Driver &D = getToolChain().getDriver();
59+
const auto &ToolChain = static_cast<const DragonFly &>(getToolChain());
60+
const Driver &D = ToolChain.getDriver();
6061
ArgStringList CmdArgs;
6162

6263
if (!D.SysRoot.empty())
@@ -115,21 +116,24 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
115116
Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
116117
}
117118

118-
Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group});
119+
Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
120+
options::OPT_s, options::OPT_t, options::OPT_r});
121+
ToolChain.AddFilePathLibArgs(Args, CmdArgs);
119122

120123
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
121124

122125
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
123126
options::OPT_r)) {
124-
SmallString<128> Dir(D.SysRoot);
125-
llvm::sys::path::append(Dir, "/usr/lib/gcc80");
126-
CmdArgs.push_back(Args.MakeArgString("-L" + Dir));
127-
128127
if (!Args.hasArg(options::OPT_static)) {
129128
CmdArgs.push_back("-rpath");
130129
CmdArgs.push_back("/usr/lib/gcc80");
131130
}
132131

132+
// Use the static OpenMP runtime with -static-openmp
133+
bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
134+
!Args.hasArg(options::OPT_static);
135+
addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
136+
133137
if (D.CCCIsCXX()) {
134138
if (getToolChain().ShouldLinkCXXStdlib(Args))
135139
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,8 +1967,9 @@ void UnwrappedLineParser::parseStructuralElement(
19671967
auto I = Line->Tokens.begin(), E = Line->Tokens.end();
19681968
while (I != E && I->Tok->is(tok::comment))
19691969
++I;
1970-
while (I != E && Style.isVerilog() && I->Tok->is(tok::hash))
1971-
++I;
1970+
if (Style.isVerilog())
1971+
while (I != E && I->Tok->is(tok::hash))
1972+
++I;
19721973
return I != E && (++I == E);
19731974
};
19741975
if (OneTokenSoFar()) {

clang/test/Driver/dragonfly.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: FileCheck -input-file %t.log %s
33

44
// CHECK: "-cc1" "-triple" "x86_64-pc-dragonfly"
5-
// CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=gnu" "--enable-new-dtags" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}gcc{{.*}}" "-rpath" "{{.*}}gcc{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"
5+
// CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=gnu" "--enable-new-dtags" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L{{.*}}/../lib" "-L/usr/lib" "-L/usr/lib/gcc80" "{{.*}}.o" "-rpath" "{{.*}}gcc80{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"
66

77
// Check x86_64-unknown-dragonfly, X86_64
88
// RUN: %clang -### %s 2>&1 --target=x86_64-unknown-dragonfly \
@@ -15,7 +15,8 @@
1515
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crt1.o"
1616
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crti.o"
1717
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80{{/|\\\\}}crtbegin.o"
18-
// CHECK-LD-X86_64-SAME: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80" "-rpath" "/usr/lib/gcc80" "-lc" "-lgcc" "--as-needed" "-lgcc_pic" "--no-as-needed"
18+
// CHECK-LD-X86_64-SAME: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib" "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80"
19+
// CHECK-LD-X86_64-SAME: "-rpath" "/usr/lib/gcc80" "-lc" "-lgcc" "--as-needed" "-lgcc_pic" "--no-as-needed"
1920
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}gcc80{{/|\\\\}}crtend.o"
2021
// CHECK-LD-X86_64-SAME: "[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}crtn.o"
2122

@@ -26,3 +27,8 @@
2627
// RELOCATABLE-NOT: "-dynamic-linker"
2728
// RELOCATABLE-NOT: "-l
2829
// RELOCATABLE-NOT: {{.*}}crt{{[^./]+}}.o
30+
31+
// Check that the new linker flags are passed to DragonFly
32+
// RUN: %clang --target=x86_64-unknown-dragonfly -s -t -### %s 2>&1 \
33+
// RUN: | FileCheck --check-prefix=CHECK-LD-FLAGS %s
34+
// CHECK-LD-FLAGS: ld{{.*}}" "{{.*}}" "-s" "-t"

clang/test/Driver/fopenmp.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
1414
// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
1515
// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
16+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
17+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
18+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
1619
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
1720
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
1821
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
@@ -90,6 +93,19 @@
9093
// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
9194
// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
9295
//
96+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
97+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
98+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
99+
//
100+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
101+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
102+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
103+
// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC
104+
//
105+
// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
106+
// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
107+
// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
108+
//
93109
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
94110
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
95111
// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5MD
@@ -136,7 +152,7 @@
136152
// CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
137153
//
138154
// CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC: "{{.*}}ld{{(.exe)?}}"
139-
// For x86 Gnu, the driver passes -static, while FreeBSD, NetBSD and OpenBSD pass -Bstatic
155+
// For x86 Gnu, the driver passes -static, while FreeBSD, NetBSD, OpenBSD and DragonFly pass -Bstatic
140156
// CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC: "-{{B?}}static" {{.*}} "-liomp5"
141157
// CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC-NOT: "-Bdynamic"
142158
//
@@ -157,6 +173,7 @@
157173
// RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
158174
// RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
159175
// RUN: %clang -target x86_64-openbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
176+
// RUN: %clang -target x86_64-dragonfly -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
160177
// RUN: %clang -target x86_64-windows-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANYMD
161178
//
162179
// CHECK-LD-ANY: "{{.*}}ld{{(.exe)?}}"

libc/config/linux/aarch64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ set(TARGET_PUBLIC_HEADERS
22
libc.include.assert
33
libc.include.ctype
44
libc.include.errno
5+
libc.include.features
56
libc.include.fenv
67
libc.include.inttypes
78
libc.include.math

libc/config/linux/riscv/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
libc.include.dirent
55
libc.include.errno
66
libc.include.fcntl
7+
libc.include.features
78
libc.include.fenv
89
libc.include.inttypes
910
libc.include.math

libc/config/linux/x86_64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
libc.include.dirent
55
libc.include.errno
66
libc.include.fcntl
7+
libc.include.features
78
libc.include.fenv
89
libc.include.inttypes
910
libc.include.math

libc/include/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ add_gen_header(
4646
.llvm-libc-types.mode_t
4747
)
4848

49+
add_gen_header(
50+
features
51+
DEF_FILE features.h.def
52+
GEN_HDR features.h
53+
DEPENDS
54+
.llvm_libc_common_h
55+
.llvm-libc-macros.features_macros
56+
)
57+
4958
add_gen_header(
5059
fenv
5160
DEF_FILE fenv.h.def

libc/include/features.h.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===-- C standard library header features.h -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_FEATURES_H
10+
#define LLVM_LIBC_FEATURES_H
11+
12+
#include <__llvm-libc-common.h>
13+
#include <llvm-libc-macros/features-macros.h>
14+
15+
%%public_api()
16+
17+
#endif // LLVM_LIBC_FEATURES_H

libc/include/llvm-libc-macros/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ add_macro_header(
4646
fcntl-macros.h
4747
)
4848

49+
add_macro_header(
50+
features_macros
51+
HDR
52+
features-macros.h
53+
)
54+
4955
add_macro_header(
5056
fenv_macros
5157
HDR
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Definition of macros from features.h ------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef __LLVM_LIBC_MACROS_FEATURES_MACROS_H
10+
#define __LLVM_LIBC_MACROS_FEATURES_MACROS_H
11+
12+
#define __LLVM_LIBC__ 1
13+
14+
#endif // __LLVM_LIBC_MACROS_FEATURES_MACROS_H

lld/test/ELF/debug-dead-reloc.s

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,47 @@
55

66
# RUN: echo '.globl _start; _start: call group' | llvm-mc -filetype=obj -triple=x86_64 - -o %t.o
77
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t1.o
8-
# RUN: ld.lld --gc-sections %t.o %t1.o %t1.o -o %t
8+
# RUN: ld.lld --emit-relocs --gc-sections %t.o %t1.o %t1.o -o %t
99
# RUN: llvm-objdump -s %t | FileCheck %s
10+
# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=REL
1011

1112
# CHECK: Contents of section .debug_loc:
1213
# CHECK-NEXT: 0000 01000000 00000000 01000000 00000000
13-
# CHECK-NEXT: Contents of section .debug_ranges:
14+
# CHECK: Contents of section .debug_ranges:
1415
# CHECK-NEXT: 0000 01000000 00000000 01000000 00000000
15-
# CHECK-NEXT: Contents of section .debug_addr:
16+
# CHECK: Contents of section .debug_addr:
1617
# CHECK-NEXT: 0000 {{.*}}000 00000000 {{.*}}000 00000000
1718
# CHECK-NEXT: 0010 00000000 00000000 {{.*}}000 00000000
18-
# CHECK-NEXT: Contents of section .debug_foo:
19+
# CHECK: Contents of section .debug_foo:
1920
# CHECK-NEXT: 0000 00000000 00000000 08000000 00000000
2021
# CHECK-NEXT: 0010 00000000 00000000 08000000 00000000
2122

23+
# REL: Relocations [
24+
# REL-NEXT: .rela.text {
25+
# REL-NEXT: 0x201121 R_X86_64_PLT32 group 0xFFFFFFFFFFFFFFFC
26+
# REL-NEXT: }
27+
# REL-NEXT: .rela.debug_loc {
28+
# REL-NEXT: 0x0 R_X86_64_NONE - 0x8
29+
# REL-NEXT: 0x8 R_X86_64_NONE - 0x8
30+
# REL-NEXT: }
31+
# REL-NEXT: .rela.debug_ranges {
32+
# REL-NEXT: 0x0 R_X86_64_NONE - 0x10
33+
# REL-NEXT: 0x8 R_X86_64_NONE - 0x10
34+
# REL-NEXT: }
35+
# REL-NEXT: .rela.debug_addr {
36+
# REL-NEXT: 0x0 R_X86_64_64 .text 0x1D
37+
# REL-NEXT: 0x8 R_X86_64_64 group 0x20
38+
# REL-NEXT: 0x10 R_X86_64_NONE - 0x18
39+
# REL-NEXT: 0x18 R_X86_64_64 group 0x20
40+
# REL-NEXT: }
41+
# REL-NEXT: .rela.debug_foo {
42+
# REL-NEXT: 0x0 R_X86_64_NONE - 0x8
43+
# REL-NEXT: 0x8 R_X86_64_NONE - 0x8
44+
# REL-NEXT: 0x10 R_X86_64_NONE - 0x8
45+
# REL-NEXT: 0x18 R_X86_64_NONE - 0x8
46+
# REL-NEXT: }
47+
# REL-NEXT: ]
48+
2249
## -z dead-reloc-in-nonalloc= can override the tombstone value.
2350
# RUN: ld.lld --gc-sections -z dead-reloc-in-nonalloc=.debug_loc=42 %t.o %t1.o %t1.o -o %t42
2451
# RUN: llvm-objdump -s %t42 | FileCheck %s --check-prefix=OVERRIDE

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 477935
19+
#define LLVM_MAIN_REVISION 477951
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/AsmParser/LLLexer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ lltok::Kind LLLexer::LexDollar() {
279279
if (CurChar == '"') {
280280
StrVal.assign(TokStart + 2, CurPtr - 1);
281281
UnEscapeLexed(StrVal);
282-
if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
282+
if (StringRef(StrVal).contains(0)) {
283283
Error("Null bytes are not allowed in names");
284284
return lltok::Error;
285285
}
@@ -362,7 +362,7 @@ lltok::Kind LLLexer::LexVar(lltok::Kind Var, lltok::Kind VarID) {
362362
if (CurChar == '"') {
363363
StrVal.assign(TokStart+2, CurPtr-1);
364364
UnEscapeLexed(StrVal);
365-
if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
365+
if (StringRef(StrVal).contains(0)) {
366366
Error("Null bytes are not allowed in names");
367367
return lltok::Error;
368368
}
@@ -397,7 +397,7 @@ lltok::Kind LLLexer::LexQuote() {
397397

398398
if (CurPtr[0] == ':') {
399399
++CurPtr;
400-
if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
400+
if (StringRef(StrVal).contains(0)) {
401401
Error("Null bytes are not allowed in names");
402402
kind = lltok::Error;
403403
} else {

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2646,7 +2646,7 @@ Expected<Value *> BitcodeReader::recordValue(SmallVectorImpl<uint64_t> &Record,
26462646
Value *V = ValueList[ValueID];
26472647

26482648
StringRef NameStr(ValueName.data(), ValueName.size());
2649-
if (NameStr.find_first_of(0) != StringRef::npos)
2649+
if (NameStr.contains(0))
26502650
return error("Invalid value name");
26512651
V->setName(NameStr);
26522652
auto *GO = dyn_cast<GlobalObject>(V);

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ void AsmPrinter::emitPCSections(const MachineFunction &MF) {
15241524
const size_t OptStart = SecWithOpt.find('!'); // likely npos
15251525
const StringRef Sec = SecWithOpt.substr(0, OptStart);
15261526
const StringRef Opts = SecWithOpt.substr(OptStart); // likely empty
1527-
ConstULEB128 = Opts.find('C') != StringRef::npos;
1527+
ConstULEB128 = Opts.contains('C');
15281528
#ifndef NDEBUG
15291529
for (char O : Opts)
15301530
assert((O == '!' || O == 'C') && "Invalid !pcsections options");

llvm/lib/IR/Value.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ void Value::setNameImpl(const Twine &NewName) {
330330

331331
SmallString<256> NameData;
332332
StringRef NameRef = NeedNewName ? NewName.toStringRef(NameData) : "";
333-
assert(NameRef.find_first_of(0) == StringRef::npos &&
334-
"Null bytes are not allowed in names");
333+
assert(!NameRef.contains(0) && "Null bytes are not allowed in names");
335334

336335
// Name isn't changing?
337336
if (getName() == NameRef)

llvm/lib/Support/UnicodeNameToCodepoint.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,7 @@ static std::optional<char32_t> nameToCodepoint(StringRef Name, bool Strict,
387387
std::reverse(Buffer.begin(), Buffer.end());
388388
// UAX44-LM2. Ignore case, whitespace, underscore ('_'), and all medial
389389
// hyphens except the hyphen in U+1180 HANGUL JUNGSEONG O-E.
390-
if (!Strict && Value == 0x116c &&
391-
Name.find_insensitive("O-E") != StringRef::npos) {
390+
if (!Strict && Value == 0x116c && Name.contains_insensitive("O-E")) {
392391
Buffer = "HANGUL JUNGSEONG O-E";
393392
Value = 0x1180;
394393
}

llvm/lib/Support/Unix/Memory.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ void Memory::InvalidateInstructionCache(const void *Addr, size_t Len) {
237237
for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
238238
asm volatile("icbi 0, %0" : : "r"(Line));
239239
asm volatile("isync");
240-
#elif (defined(__arm__) || defined(__aarch64__) || defined(__mips__)) && \
240+
#elif (defined(__arm__) || defined(__aarch64__) || defined(__loongarch__) || \
241+
defined(__mips__)) && \
241242
defined(__GNUC__)
242243
// FIXME: Can we safely always call this for __GNUC__ everywhere?
243244
const char *Start = static_cast<const char *>(Addr);

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7488,7 +7488,7 @@ bool AArch64AsmParser::parseAuthExpr(const MCExpr *&Res, SMLoc &EndLoc) {
74887488
// Look for '_sym@AUTH' ...
74897489
if (Tok.is(AsmToken::Identifier) && Tok.getIdentifier().endswith("@AUTH")) {
74907490
StringRef SymName = Tok.getIdentifier().drop_back(strlen("@AUTH"));
7491-
if (SymName.find('@') != StringRef::npos)
7491+
if (SymName.contains('@'))
74927492
return TokError(
74937493
"combination of @AUTH with other modifiers not supported");
74947494
Res = MCSymbolRefExpr::create(Ctx.getOrCreateSymbol(SymName), Ctx);

llvm/lib/Target/LoongArch/LoongArch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ bool lowerLoongArchMachineOperandToMCOperand(const MachineOperand &MO,
3636
FunctionPass *createLoongArchExpandAtomicPseudoPass();
3737
FunctionPass *createLoongArchISelDag(LoongArchTargetMachine &TM);
3838
FunctionPass *createLoongArchPreRAExpandPseudoPass();
39+
FunctionPass *createLoongArchExpandPseudoPass();
3940
void initializeLoongArchDAGToDAGISelPass(PassRegistry &);
4041
void initializeLoongArchExpandAtomicPseudoPass(PassRegistry &);
4142
void initializeLoongArchPreRAExpandPseudoPass(PassRegistry &);
43+
void initializeLoongArchExpandPseudoPass(PassRegistry &);
4244
} // end namespace llvm
4345

4446
#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCH_H

llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,11 @@ bool LoongArchExpandAtomicPseudo::expandAtomicCmpXchg(
571571
BuildMI(LoopTailMBB, DL, TII->get(LoongArch::B)).addMBB(DoneMBB);
572572
}
573573

574-
AtomicOrdering Ordering =
574+
AtomicOrdering FailureOrdering =
575575
static_cast<AtomicOrdering>(MI.getOperand(IsMasked ? 6 : 5).getImm());
576576
int hint;
577577

578-
switch (Ordering) {
578+
switch (FailureOrdering) {
579579
case AtomicOrdering::Acquire:
580580
case AtomicOrdering::AcquireRelease:
581581
case AtomicOrdering::SequentiallyConsistent:

0 commit comments

Comments
 (0)