Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit ab47d36

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:e8a656376857 into amd-gfx:bc4e29b082d5
Local branch amd-gfx bc4e29b Merged main:c135f6ffe254 into amd-gfx:09b941d45305 Remote branch main e8a6563 Fix-forward RegAllocFast: Avoid using temporary DiagnosticInfo llvm#120184 (llvm#120268)
2 parents bc4e29b + e8a6563 commit ab47d36

File tree

49 files changed

+713
-179
lines changed

Some content is hidden

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

49 files changed

+713
-179
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
@@ -3463,6 +3463,9 @@ defm diagnostics_show_line_numbers : BoolFOption<"diagnostics-show-line-numbers"
34633463
NegFlag<SetFalse, [], [ClangOption, CC1Option],
34643464
"Show line numbers in diagnostic code snippets">,
34653465
PosFlag<SetTrue>>;
3466+
def fno_realloc_lhs : Flag<["-"], "fno-realloc-lhs">, Group<f_Group>,
3467+
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">,
3468+
Visibility<[FlangOption, FC1Option]>;
34663469
def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group<f_Group>,
34673470
HelpText<"Disable the use of stack protectors">;
34683471
def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>,
@@ -4296,6 +4299,9 @@ defm stack_size_section : BoolFOption<"stack-size-section",
42964299
PosFlag<SetTrue, [], [ClangOption, CC1Option],
42974300
"Emit section containing metadata on function stack sizes">,
42984301
NegFlag<SetFalse>>;
4302+
def frealloc_lhs : Flag<["-"], "frealloc-lhs">, Group<f_Group>,
4303+
Visibility<[FlangOption, FC1Option]>,
4304+
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">;
42994305
def fstack_usage : Flag<["-"], "fstack-usage">, Group<f_Group>,
43004306
HelpText<"Emit .su file containing information on function stack sizes">;
43014307
def stack_usage_file : Separate<["-"], "stack-usage-file">,
@@ -6775,7 +6781,6 @@ defm real_4_real_8 : BooleanFFlag<"real-4-real-8">, Group<gfortran_Group>;
67756781
defm real_8_real_10 : BooleanFFlag<"real-8-real-10">, Group<gfortran_Group>;
67766782
defm real_8_real_16 : BooleanFFlag<"real-8-real-16">, Group<gfortran_Group>;
67776783
defm real_8_real_4 : BooleanFFlag<"real-8-real-4">, Group<gfortran_Group>;
6778-
defm realloc_lhs : BooleanFFlag<"realloc-lhs">, Group<gfortran_Group>;
67796784
defm recursive : BooleanFFlag<"recursive">, Group<gfortran_Group>;
67806785
defm repack_arrays : BooleanFFlag<"repack-arrays">, Group<gfortran_Group>;
67816786
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/lib/Format/ContinuationIndenter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,10 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
826826
for (const auto *Prev = &Tok; Prev; Prev = Prev->Previous) {
827827
if (Prev->is(TT_TemplateString) && Prev->opensScope())
828828
return true;
829-
if (Prev->is(TT_TemplateString) && Prev->closesScope())
829+
if (Prev->opensScope() ||
830+
(Prev->is(TT_TemplateString) && Prev->closesScope())) {
830831
break;
832+
}
831833
}
832834
return false;
833835
};

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]],

clang/unittests/Format/FormatTestJS.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,13 @@ TEST_F(FormatTestJS, TemplateStringMultiLineExpression) {
21612161
" aaaa: aaaaa,\n"
21622162
" bbbb: bbbbb,\n"
21632163
" })}`;");
2164+
2165+
verifyFormat("`${\n"
2166+
" (\n"
2167+
" FOOFOOFOOFOO____FOO_FOO_FO_FOO_FOOO -\n"
2168+
" (barbarbarbar____bar_bar_bar_bar_bar_bar +\n"
2169+
" bar_bar_bar_barbarbar___bar_bar_bar + 1),\n"
2170+
" )}`;");
21642171
}
21652172

21662173
TEST_F(FormatTestJS, TemplateStringASI) {

flang/include/flang/Lower/LoweringOptions.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,11 @@ ENUM_LOWERINGOPT(Underscoring, unsigned, 1, 1)
3838
/// (i.e. wraps around as two's complement). Off by default.
3939
ENUM_LOWERINGOPT(IntegerWrapAround, unsigned, 1, 0)
4040

41+
/// If true (default), follow Fortran 2003 rules for (re)allocating
42+
/// the allocatable on the left side of the intrinsic assignment,
43+
/// if LHS and RHS have mismatching shapes/types.
44+
/// If false, assume that the shapes/types/allocation-status match.
45+
ENUM_LOWERINGOPT(ReallocateLHS, unsigned, 1, 1)
46+
4147
#undef LOWERINGOPT
4248
#undef ENUM_LOWERINGOPT

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,11 @@ bool CompilerInvocation::createFromArgs(
13781378
invoc.getDiagnosticOpts().Remarks.push_back(a->getValue());
13791379
}
13801380

1381+
// -frealloc-lhs is the default.
1382+
if (!args.hasFlag(clang::driver::options::OPT_frealloc_lhs,
1383+
clang::driver::options::OPT_fno_realloc_lhs, true))
1384+
invoc.loweringOpts.setReallocateLHS(false);
1385+
13811386
success &= parseFrontendArgs(invoc.getFrontendOpts(), args, diags);
13821387
parseTargetArgs(invoc.getTargetOpts(), args);
13831388
parsePreprocessorArgs(invoc.getPreprocessorOpts(), args);

0 commit comments

Comments
 (0)