Skip to content

Commit 1b6da0d

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#3310)
2 parents 691d11a + f4a9ab2 commit 1b6da0d

Some content is hidden

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

59 files changed

+1026
-884
lines changed

clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) {
9292
const LangOptions &LO = getLangOpts();
9393

9494
// Match CXXRecordDecl only to store the range of the last non-implicit full
95-
// declaration, to later check whether it's within the typdef itself.
95+
// declaration, to later check whether it's within the typedef itself.
9696
const auto *MatchedTagDecl = Result.Nodes.getNodeAs<TagDecl>(TagDeclName);
9797
if (MatchedTagDecl) {
9898
// It is not sufficient to just track the last TagDecl that we've seen,
@@ -152,7 +152,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) {
152152
StringRef ExtraReference = "";
153153
if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) {
154154
// Each type introduced in a typedef can specify being a reference or
155-
// pointer type seperately, so we need to sigure out if the new using-decl
155+
// pointer type separately, so we need to figure out if the new using-decl
156156
// needs to be to a reference or pointer as well.
157157
const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind(
158158
MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// RUN: %clangxx -fsanitize=realtime %s -o %t
2+
// RUN: %run %t 2>&1 | FileCheck %s
3+
4+
// UNSUPPORTED: ios
5+
6+
// Intent: Ensures that pthread_cond_signal does not segfault under rtsan
7+
// See issue #146120
8+
9+
#include <condition_variable>
10+
#include <future>
11+
#include <mutex>
12+
#include <thread>
13+
14+
#include <iostream>
15+
16+
int main() {
17+
std::cout << "Entry to main!" << std::endl;
18+
19+
20+
// TODO: This is disabled because it does cause a test failure
21+
/*
22+
std::mutex mut;
23+
std::condition_variable cv;
24+
bool go{false};
25+
26+
const auto fut = std::async(std::launch::async, [&] {
27+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
28+
{
29+
std::unique_lock<std::mutex> lock(mut);
30+
go = true;
31+
}
32+
cv.notify_one();
33+
});
34+
35+
std::unique_lock<std::mutex> lock(mut);
36+
// normal wait is fine
37+
// cv.wait(lock, [&] { return go; });
38+
// but timed wait could segfault
39+
40+
// NOTE: When a fix for the pthread_cond issue #146120 is fixed, uncomment this line
41+
//cv.wait_for(lock, std::chrono::milliseconds(200), [&] { return go; });
42+
*/
43+
44+
std::cout << "Exit from main!" << std::endl;
45+
}
46+
47+
// CHECK: Entry to main!
48+
// CHECK-NEXT: Exit from main!

flang-rt/test/NonGtestUnit/lit.cfg.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
config.name = "flang-rt-OldUnit"
99

1010
# suffixes: A list of file extensions to treat as test files.
11-
# On Windows, ".exe" also matches the GTests and will execited redundantly.
12-
config.suffixes = [".test", ".exe"]
11+
config.suffixes = [".test", ".test.exe"]
1312

1413
# test_source_root: The root path where unit test binaries are located.
1514
config.test_source_root = os.path.join(config.flangrt_binary_dir, "unittests")

flang/include/flang/Common/target-rounding.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct Rounding {
2121
// (viz., fail to set the Underflow flag when an inexact product of a
2222
// multiplication is rounded up to a normal number from a subnormal
2323
// in some rounding modes)
24-
#if __x86_64__ || __riscv || __loongarch__
24+
#if __x86_64__ || _M_X64 || __riscv || __loongarch__
2525
bool x86CompatibleBehavior{true};
2626
#else
2727
bool x86CompatibleBehavior{false};

flang/include/flang/Testing/fp-testing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ScopedHostFloatingPointEnvironment {
2727

2828
private:
2929
fenv_t originalFenv_;
30-
#if __x86_64__
30+
#if __x86_64__ || _M_X64
3131
unsigned int originalMxcsr;
3232
#endif
3333
};

flang/lib/Testing/fp-testing.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
#include <cstdio>
1212
#include <cstdlib>
1313
#include <cstring>
14-
#if __x86_64__
14+
#if __x86_64__ || _M_X64
1515
#include <xmmintrin.h>
1616
#endif
1717

1818
using Fortran::common::RealFlag;
1919
using Fortran::common::RoundingMode;
2020

2121
ScopedHostFloatingPointEnvironment::ScopedHostFloatingPointEnvironment(
22-
#if __x86_64__
22+
#if __x86_64__ || _M_X64
2323
bool treatSubnormalOperandsAsZero, bool flushSubnormalResultsToZero
2424
#else
2525
bool, bool
@@ -38,7 +38,7 @@ ScopedHostFloatingPointEnvironment::ScopedHostFloatingPointEnvironment(
3838
std::abort();
3939
}
4040

41-
#if __x86_64__
41+
#if __x86_64__ || _M_X64
4242
originalMxcsr = _mm_getcsr();
4343
unsigned int currentMxcsr{originalMxcsr};
4444
if (treatSubnormalOperandsAsZero) {
@@ -72,7 +72,7 @@ ScopedHostFloatingPointEnvironment::~ScopedHostFloatingPointEnvironment() {
7272
stderr, "fesetenv() failed: %s\n", llvm::sys::StrError(errno).c_str());
7373
std::abort();
7474
}
75-
#if __x86_64__
75+
#if __x86_64__ || _M_X64
7676
_mm_setcsr(originalMxcsr);
7777
#endif
7878
}

flang/test/NonGtestUnit/lit.cfg.py

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

55
config.name = "flang-OldUnit"
66

7-
config.suffixes = [".test"]
7+
config.suffixes = [".test", ".test.exe"]
88

99
config.test_source_root = os.path.join(config.flang_obj_root, "unittests")
1010
config.test_exec_root = config.test_source_root

lld/ELF/Target.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -338,21 +338,23 @@ inline uint64_t overwriteULEB128(uint8_t *bufLoc, uint64_t val) {
338338
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
339339
#endif
340340
#define invokeELFT(f, ...) \
341-
switch (ctx.arg.ekind) { \
342-
case lld::elf::ELF32LEKind: \
343-
f<llvm::object::ELF32LE>(__VA_ARGS__); \
344-
break; \
345-
case lld::elf::ELF32BEKind: \
346-
f<llvm::object::ELF32BE>(__VA_ARGS__); \
347-
break; \
348-
case lld::elf::ELF64LEKind: \
349-
f<llvm::object::ELF64LE>(__VA_ARGS__); \
350-
break; \
351-
case lld::elf::ELF64BEKind: \
352-
f<llvm::object::ELF64BE>(__VA_ARGS__); \
353-
break; \
354-
default: \
355-
llvm_unreachable("unknown ctx.arg.ekind"); \
356-
}
341+
do { \
342+
switch (ctx.arg.ekind) { \
343+
case lld::elf::ELF32LEKind: \
344+
f<llvm::object::ELF32LE>(__VA_ARGS__); \
345+
break; \
346+
case lld::elf::ELF32BEKind: \
347+
f<llvm::object::ELF32BE>(__VA_ARGS__); \
348+
break; \
349+
case lld::elf::ELF64LEKind: \
350+
f<llvm::object::ELF64LE>(__VA_ARGS__); \
351+
break; \
352+
case lld::elf::ELF64BEKind: \
353+
f<llvm::object::ELF64BE>(__VA_ARGS__); \
354+
break; \
355+
default: \
356+
llvm_unreachable("unknown ctx.arg.ekind"); \
357+
} \
358+
} while (0)
357359

358360
#endif

llvm/include/llvm/MC/MCAsmInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class MCStreamer;
3535
class MCSubtargetInfo;
3636
class MCSymbol;
3737
class MCValue;
38+
class Triple;
3839
class raw_ostream;
3940

4041
namespace WinEH {
@@ -490,6 +491,9 @@ class LLVM_ABI MCAsmInfo {
490491
/// syntactically correct.
491492
virtual bool isValidUnquotedName(StringRef Name) const;
492493

494+
virtual void printSwitchToSection(const MCSection &, uint32_t Subsection,
495+
const Triple &, raw_ostream &) const {}
496+
493497
/// Return true if the .section directive should be omitted when
494498
/// emitting \p SectionName. For example:
495499
///

llvm/include/llvm/MC/MCAsmInfoCOFF.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ namespace llvm {
1515

1616
class MCAsmInfoCOFF : public MCAsmInfo {
1717
virtual void anchor();
18+
void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
19+
raw_ostream &) const final;
1820
bool useCodeAlign(const MCSection &Sec) const final;
1921

2022
protected:

0 commit comments

Comments
 (0)