Skip to content

Commit 0eb76b4

Browse files
committed
Merge remote-tracking branch upstream/main
Signed-off-by: Sarnie, Nick <[email protected]>
2 parents 1c53aaa + 4c2a46f commit 0eb76b4

File tree

169 files changed

+5013
-1467
lines changed

Some content is hidden

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

169 files changed

+5013
-1467
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.
333333
foreach(lang C;CXX;ASM)
334334
# TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
335335
# These should be addressed and removed over time.
336-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
336+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" -D_LIBCPP_PRINT=1")
337337
if(NOT ${target} STREQUAL "aarch64-none-elf")
338338
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mthumb")
339339
endif()
@@ -394,7 +394,7 @@ foreach(target riscv32-unknown-elf)
394394
foreach(lang C;CXX;ASM)
395395
# TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
396396
# These should be addressed and removed over time.
397-
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
397+
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -march=rv32imafc -mabi=ilp32f -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
398398
endforeach()
399399
foreach(type SHARED;MODULE;EXE)
400400
set(RUNTIMES_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3465,6 +3465,9 @@ defm diagnostics_show_line_numbers : BoolFOption<"diagnostics-show-line-numbers"
34653465
NegFlag<SetFalse, [], [ClangOption, CC1Option],
34663466
"Show line numbers in diagnostic code snippets">,
34673467
PosFlag<SetTrue>>;
3468+
def fno_realloc_lhs : Flag<["-"], "fno-realloc-lhs">, Group<f_Group>,
3469+
HelpText<"An allocatable left-hand side of an intrinsic assignment is assumed to be allocated and match the shape/type of the right-hand side">,
3470+
Visibility<[FlangOption, FC1Option]>;
34683471
def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group<f_Group>,
34693472
HelpText<"Disable the use of stack protectors">;
34703473
def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>,
@@ -4298,6 +4301,9 @@ defm stack_size_section : BoolFOption<"stack-size-section",
42984301
PosFlag<SetTrue, [], [ClangOption, CC1Option],
42994302
"Emit section containing metadata on function stack sizes">,
43004303
NegFlag<SetFalse>>;
4304+
def frealloc_lhs : Flag<["-"], "frealloc-lhs">, Group<f_Group>,
4305+
Visibility<[FlangOption, FC1Option]>,
4306+
HelpText<"If an allocatable left-hand side of an intrinsic assignment is unallocated or its shape/type does not match the right-hand side, then it is automatically (re)allocated">;
43014307
def fstack_usage : Flag<["-"], "fstack-usage">, Group<f_Group>,
43024308
HelpText<"Emit .su file containing information on function stack sizes">;
43034309
def stack_usage_file : Separate<["-"], "stack-usage-file">,
@@ -6777,7 +6783,6 @@ defm real_4_real_8 : BooleanFFlag<"real-4-real-8">, Group<gfortran_Group>;
67776783
defm real_8_real_10 : BooleanFFlag<"real-8-real-10">, Group<gfortran_Group>;
67786784
defm real_8_real_16 : BooleanFFlag<"real-8-real-16">, Group<gfortran_Group>;
67796785
defm real_8_real_4 : BooleanFFlag<"real-8-real-4">, Group<gfortran_Group>;
6780-
defm realloc_lhs : BooleanFFlag<"realloc-lhs">, Group<gfortran_Group>;
67816786
defm recursive : BooleanFFlag<"recursive">, Group<gfortran_Group>;
67826787
defm repack_arrays : BooleanFFlag<"repack-arrays">, Group<gfortran_Group>;
67836788
defm second_underscore : BooleanFFlag<"second-underscore">, Group<gfortran_Group>;

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,20 +2995,21 @@ llvm::DIType *CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
29952995
if (!ID)
29962996
return nullptr;
29972997

2998+
auto RuntimeLang =
2999+
static_cast<llvm::dwarf::SourceLanguage>(TheCU->getSourceLanguage());
3000+
29983001
// Return a forward declaration if this type was imported from a clang module,
29993002
// and this is not the compile unit with the implementation of the type (which
30003003
// may contain hidden ivars).
30013004
if (DebugTypeExtRefs && ID->isFromASTFile() && ID->getDefinition() &&
30023005
!ID->getImplementation())
3003-
return DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
3004-
ID->getName(),
3005-
getDeclContextDescriptor(ID), Unit, 0);
3006+
return DBuilder.createForwardDecl(
3007+
llvm::dwarf::DW_TAG_structure_type, ID->getName(),
3008+
getDeclContextDescriptor(ID), Unit, 0, RuntimeLang);
30063009

30073010
// Get overall information about the record type for the debug info.
30083011
llvm::DIFile *DefUnit = getOrCreateFile(ID->getLocation());
30093012
unsigned Line = getLineNumber(ID->getLocation());
3010-
auto RuntimeLang =
3011-
static_cast<llvm::dwarf::SourceLanguage>(TheCU->getSourceLanguage());
30123013

30133014
// If this is just a forward declaration return a special forward-declaration
30143015
// debug type since we won't be able to lay out the entire type.

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ void Flang::addFortranDialectOptions(const ArgList &Args,
5555
options::OPT_fdefault_double_8,
5656
options::OPT_flarge_sizes,
5757
options::OPT_fno_automatic,
58-
options::OPT_fhermetic_module_files});
58+
options::OPT_fhermetic_module_files,
59+
options::OPT_frealloc_lhs,
60+
options::OPT_fno_realloc_lhs});
5961
}
6062

6163
void Flang::addPreprocessingOptions(const ArgList &Args,

clang/runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
122122
COMPONENT compiler-rt)
123123

124124
# Add top-level targets that build specific compiler-rt runtimes.
125-
set(COMPILER_RT_RUNTIMES fuzzer asan builtins dfsan lsan msan profile tsan ubsan ubsan-minimal)
125+
set(COMPILER_RT_RUNTIMES fuzzer asan builtins dfsan lsan msan profile tsan tysan ubsan ubsan-minimal)
126126
foreach(runtime ${COMPILER_RT_RUNTIMES})
127127
get_ext_project_build_command(build_runtime_cmd ${runtime})
128128
add_custom_target(${runtime}

clang/test/Modules/ExtDebugInfo.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ int foo(ObjCClass *c) {
7575

7676
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
7777
// CHECK-SAME: scope: ![[MOD]],
78-
// CHECK-SAME: flags: DIFlagFwdDecl)
78+
// CHECK-SAME: flags: DIFlagFwdDecl,
79+
// CHECK-SAME: runtimeLang: DW_LANG_ObjC)
7980

8081
// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
8182
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,

clang/test/Modules/ModuleDebugInfo.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
4141
// CHECK-SAME: scope: ![[MODULE]],
42+
// CHECK-SAME: runtimeLang: DW_LANG_ObjC
4243

4344
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
4445
// CHECK-SAME: scope: ![[MODULE]],

compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ else()
8585
set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64} ${S390X}
8686
${LOONGARCH64} ${RISCV64})
8787
endif()
88+
set(ALL_TYSAN_SUPPORTED_ARCH ${X86_64} ${ARM64})
8889
set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
8990
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
9091
${LOONGARCH64})

compiler-rt/cmake/config-ix.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ if(APPLE)
458458
set(SANITIZER_COMMON_SUPPORTED_OS osx)
459459
set(PROFILE_SUPPORTED_OS osx)
460460
set(TSAN_SUPPORTED_OS osx)
461+
set(TYSAN_SUPPORTED_OS osx)
461462
set(XRAY_SUPPORTED_OS osx)
462463
set(FUZZER_SUPPORTED_OS osx)
463464
set(ORC_SUPPORTED_OS)
@@ -593,6 +594,7 @@ if(APPLE)
593594
list(APPEND FUZZER_SUPPORTED_OS ${platform})
594595
list(APPEND ORC_SUPPORTED_OS ${platform})
595596
list(APPEND UBSAN_SUPPORTED_OS ${platform})
597+
list(APPEND TYSAN_SUPPORTED_OS ${platform})
596598
list(APPEND LSAN_SUPPORTED_OS ${platform})
597599
list(APPEND STATS_SUPPORTED_OS ${platform})
598600
endif()
@@ -651,6 +653,9 @@ if(APPLE)
651653
list_intersect(CTX_PROFILE_SUPPORTED_ARCH
652654
ALL_CTX_PROFILE_SUPPORTED_ARCH
653655
SANITIZER_COMMON_SUPPORTED_ARCH)
656+
list_intersect(TYSAN_SUPPORTED_ARCH
657+
ALL_TYSAN_SUPPORTED_ARCH
658+
SANITIZER_COMMON_SUPPORTED_ARCH)
654659
list_intersect(TSAN_SUPPORTED_ARCH
655660
ALL_TSAN_SUPPORTED_ARCH
656661
SANITIZER_COMMON_SUPPORTED_ARCH)
@@ -703,6 +708,7 @@ else()
703708
filter_available_targets(PROFILE_SUPPORTED_ARCH ${ALL_PROFILE_SUPPORTED_ARCH})
704709
filter_available_targets(CTX_PROFILE_SUPPORTED_ARCH ${ALL_CTX_PROFILE_SUPPORTED_ARCH})
705710
filter_available_targets(TSAN_SUPPORTED_ARCH ${ALL_TSAN_SUPPORTED_ARCH})
711+
filter_available_targets(TYSAN_SUPPORTED_ARCH ${ALL_TYSAN_SUPPORTED_ARCH})
706712
filter_available_targets(UBSAN_SUPPORTED_ARCH ${ALL_UBSAN_SUPPORTED_ARCH})
707713
filter_available_targets(SAFESTACK_SUPPORTED_ARCH
708714
${ALL_SAFESTACK_SUPPORTED_ARCH})
@@ -748,7 +754,7 @@ if(COMPILER_RT_SUPPORTED_ARCH)
748754
endif()
749755
message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}")
750756

751-
set(ALL_SANITIZERS asan;rtsan;dfsan;msan;hwasan;tsan;safestack;cfi;scudo_standalone;ubsan_minimal;gwp_asan;nsan;asan_abi)
757+
set(ALL_SANITIZERS asan;rtsan;dfsan;msan;hwasan;tsan;tysan;safestack;cfi;scudo_standalone;ubsan_minimal;gwp_asan;nsan;asan_abi)
752758
set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING
753759
"sanitizers to build if supported on the target (all;${ALL_SANITIZERS})")
754760
list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")
@@ -843,6 +849,13 @@ else()
843849
set(COMPILER_RT_HAS_CTX_PROFILE FALSE)
844850
endif()
845851

852+
if (COMPILER_RT_HAS_SANITIZER_COMMON AND TYSAN_SUPPORTED_ARCH AND
853+
OS_NAME MATCHES "Linux|Darwin")
854+
set(COMPILER_RT_HAS_TYSAN TRUE)
855+
else()
856+
set(COMPILER_RT_HAS_TYSAN FALSE)
857+
endif()
858+
846859
if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH)
847860
if (OS_NAME MATCHES "Linux|Darwin|FreeBSD|NetBSD")
848861
set(COMPILER_RT_HAS_TSAN TRUE)

compiler-rt/lib/builtins/fp_div_impl.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ static __inline fp_t __divXf3__(fp_t a, fp_t b) {
334334
// Suppose 1/b - P * 2^-W < x < 1/b + P * 2^-W
335335
x_UQ0 -= RECIPROCAL_PRECISION;
336336
// Now 1/b - (2*P) * 2^-W < x < 1/b
337-
// FIXME Is x_UQ0 still >= 0.5?
338337

339338
rep_t quotient_UQ1, dummy;
340339
wideMultiply(x_UQ0, aSignificand << 1, &quotient_UQ1, &dummy);
@@ -344,6 +343,12 @@ static __inline fp_t __divXf3__(fp_t a, fp_t b) {
344343
// adjust it to be in [1.0, 2.0) as UQ1.SB.
345344
rep_t residualLo;
346345
if (quotient_UQ1 < (implicitBit << 1)) {
346+
if (quotient_UQ1 < implicitBit) {
347+
// In a rare case where quotient is < 0.5, we can adjust the quotient and
348+
// the written exponent, and then treat them the same way as in [0.5, 1.0)
349+
quotient_UQ1 <<= 1;
350+
writtenExponent -= 1;
351+
}
347352
// Highest bit is 0, so just reinterpret quotient_UQ1 as UQ1.SB,
348353
// effectively doubling its value as well as its error estimation.
349354
residualLo = (aSignificand << (significandBits + 1)) - quotient_UQ1 * bSignificand;

0 commit comments

Comments
 (0)