Skip to content

Commit 50eecd0

Browse files
committed
Merge tag 'llvmorg-17.0.0-rc3' into rustc/17.0-2023-07-29
LLVM 17.0.0-rc3 Release
2 parents 1833c2b + 5bd2c0c commit 50eecd0

File tree

125 files changed

+5790
-1212
lines changed

Some content is hidden

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

125 files changed

+5790
-1212
lines changed

clang-tools-extra/clangd/SystemIncludeExtractor.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ struct DriverArgs {
136136
}
137137
}
138138

139+
// Downgrade objective-c++-header (used in clangd's fallback flags for .h
140+
// files) to c++-header, as some drivers may fail to run the extraction
141+
// command if it contains `-xobjective-c++-header` and objective-c++ support
142+
// is not installed.
143+
// In practice, we don't see different include paths for the two on
144+
// clang+mac, which is the most common objectve-c compiler.
145+
if (Lang == "objective-c++-header") {
146+
Lang = "c++-header";
147+
}
148+
139149
// If language is not explicit in the flags, infer from the file.
140150
// This is important as we want to cache each language separately.
141151
if (Lang.empty()) {

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,6 @@ Modified Compiler Flags
309309
directory (``/tmp`` on \*NIX systems, if none of the environment variables
310310
TMPDIR, TMP, and TEMP are specified).
311311

312-
- ``-ffat-lto-objects`` can now be used to emit object files with both object
313-
code and LLVM bitcode. Previously this flag was ignored for GCC compatibility.
314-
(`See related patch <https://reviews.llvm.org/D146777>`_).
315-
316312
Removed Compiler Flags
317313
-------------------------
318314
- The deprecated flag `-fmodules-ts` is removed. Please use ``-std=c++20``
@@ -481,7 +477,6 @@ Bug Fixes in This Version
481477
instantiated in one module and whose definition is instantiated in another
482478
module may end up with members associated with the wrong declaration of the
483479
class, which can result in miscompiles in some cases.
484-
485480
- Added a new diagnostic warning group
486481
``-Wdeprecated-redundant-constexpr-static-def``, under the existing
487482
``-Wdeprecated`` group. This controls warnings about out-of-line definitions
@@ -704,6 +699,9 @@ Bug Fixes in This Version
704699
(`#64005 <https://github.com/llvm/llvm-project/issues/64005>_`)
705700
- Fix crash on nested templated class with template function call.
706701
(`#61159 <https://github.com/llvm/llvm-project/issues/61159>_`)
702+
- Fix a hang on valid C code passing a function type as an argument to
703+
``typeof`` to form a function declaration.
704+
(`#64713 <https://github.com/llvm/llvm-project/issues/64713>_`)
707705

708706
Bug Fixes to Compiler Builtins
709707
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ CODEGENOPT(PrepareForThinLTO , 1, 0) ///< Set when -flto=thin is enabled on the
165165
///< compile step.
166166
CODEGENOPT(LTOUnit, 1, 0) ///< Emit IR to support LTO unit features (CFI, whole
167167
///< program vtable opt).
168-
CODEGENOPT(FatLTO, 1, 0) ///< Set when -ffat-lto-objects is enabled.
169168
CODEGENOPT(EnableSplitLTOUnit, 1, 0) ///< Enable LTO unit splitting to support
170169
/// CFI and traditional whole program
171170
/// devirtualization that require whole

clang/include/clang/Driver/Options.td

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,11 +2375,6 @@ def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
23752375
Flags<[CoreOption, CC1Option]>, Group<f_Group>,
23762376
HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">,
23772377
MarshallingInfoString<CodeGenOpts<"ThinLinkBitcodeFile">>;
2378-
defm fat_lto_objects : BoolFOption<"fat-lto-objects",
2379-
CodeGenOpts<"FatLTO">, DefaultFalse,
2380-
PosFlag<SetTrue, [CC1Option], "Enable">,
2381-
NegFlag<SetFalse, [CC1Option], "Disable">,
2382-
BothFlags<[CC1Option], " fat LTO object support">>;
23832378
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
23842379
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CoreOption]>,
23852380
HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit)">,
@@ -5097,6 +5092,10 @@ def mretpoline_external_thunk : Flag<["-"], "mretpoline-external-thunk">, Group<
50975092
def mno_retpoline_external_thunk : Flag<["-"], "mno-retpoline-external-thunk">, Group<m_x86_Features_Group>;
50985093
def mvzeroupper : Flag<["-"], "mvzeroupper">, Group<m_x86_Features_Group>;
50995094
def mno_vzeroupper : Flag<["-"], "mno-vzeroupper">, Group<m_x86_Features_Group>;
5095+
def mno_gather : Flag<["-"], "mno-gather">, Group<m_x86_Features_Group>,
5096+
HelpText<"Disable generation of gather instructions in auto-vectorization(x86 only)">;
5097+
def mno_scatter : Flag<["-"], "mno-scatter">, Group<m_x86_Features_Group>,
5098+
HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
51005099

51015100
// These are legacy user-facing driver-level option spellings. They are always
51025101
// aliases for options that are spelled using the more common Unix / GNU flag
@@ -5162,6 +5161,7 @@ defm caller_saves : BooleanFFlag<"caller-saves">, Group<clang_ignored_gcc_optimi
51625161
defm reorder_blocks : BooleanFFlag<"reorder-blocks">, Group<clang_ignored_gcc_optimization_f_Group>;
51635162
defm branch_count_reg : BooleanFFlag<"branch-count-reg">, Group<clang_ignored_gcc_optimization_f_Group>;
51645163
defm default_inline : BooleanFFlag<"default-inline">, Group<clang_ignored_gcc_optimization_f_Group>;
5164+
defm fat_lto_objects : BooleanFFlag<"fat-lto-objects">, Group<clang_ignored_gcc_optimization_f_Group>;
51655165
defm float_store : BooleanFFlag<"float-store">, Group<clang_ignored_gcc_optimization_f_Group>;
51665166
defm friend_injection : BooleanFFlag<"friend-injection">, Group<clang_ignored_f_Group>;
51675167
defm function_attribute_list : BooleanFFlag<"function-attribute-list">, Group<clang_ignored_f_Group>;
@@ -7152,6 +7152,10 @@ def _SLASH_QIntel_jcc_erratum : CLFlag<"QIntel-jcc-erratum">,
71527152
Alias<mbranches_within_32B_boundaries>;
71537153
def _SLASH_arm64EC : CLFlag<"arm64EC">,
71547154
HelpText<"Set build target to arm64ec">;
7155+
def : CLFlag<"Qgather-">, Alias<mno_gather>,
7156+
HelpText<"Disable generation of gather instructions in auto-vectorization(x86 only)">;
7157+
def : CLFlag<"Qscatter-">, Alias<mno_scatter>,
7158+
HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
71557159

71567160
// Non-aliases:
71577161

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include "llvm/Target/TargetOptions.h"
5656
#include "llvm/TargetParser/SubtargetFeature.h"
5757
#include "llvm/TargetParser/Triple.h"
58-
#include "llvm/Transforms/IPO/EmbedBitcodePass.h"
5958
#include "llvm/Transforms/IPO/LowerTypeTests.h"
6059
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
6160
#include "llvm/Transforms/InstCombine/InstCombine.h"
@@ -1016,12 +1015,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10161015
});
10171016
}
10181017

1019-
bool IsThinOrUnifiedLTO = IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO);
1020-
if (CodeGenOpts.FatLTO) {
1021-
MPM = PB.buildFatLTODefaultPipeline(Level, IsThinOrUnifiedLTO,
1022-
IsThinOrUnifiedLTO ||
1023-
shouldEmitRegularLTOSummary());
1024-
} else if (IsThinOrUnifiedLTO) {
1018+
if (IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO)) {
10251019
MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
10261020
} else if (IsLTO) {
10271021
MPM = PB.buildLTOPreLinkDefaultPipeline(Level);
@@ -1077,21 +1071,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10771071
EmitLTOSummary));
10781072
}
10791073
}
1080-
if (CodeGenOpts.FatLTO) {
1081-
// Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
1082-
// uses a different action than Backend_EmitBC or Backend_EmitLL.
1083-
bool IsThinOrUnifiedLTO =
1084-
CodeGenOpts.PrepareForThinLTO ||
1085-
(CodeGenOpts.PrepareForLTO && CodeGenOpts.UnifiedLTO);
1086-
if (!TheModule->getModuleFlag("ThinLTO"))
1087-
TheModule->addModuleFlag(Module::Error, "ThinLTO",
1088-
uint32_t(IsThinOrUnifiedLTO));
1089-
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
1090-
TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
1091-
uint32_t(CodeGenOpts.EnableSplitLTOUnit));
1092-
if (CodeGenOpts.UnifiedLTO && !TheModule->getModuleFlag("UnifiedLTO"))
1093-
TheModule->addModuleFlag(Module::Error, "UnifiedLTO", uint32_t(1));
1094-
}
10951074

10961075
// Now that we have all of the passes ready, run them.
10971076
{

clang/lib/CodeGen/CGCXXABI.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,7 @@ void CGCXXABI::setCXXDestructorDLLStorage(llvm::GlobalValue *GV,
312312
llvm::GlobalValue::LinkageTypes CGCXXABI::getCXXDestructorLinkage(
313313
GVALinkage Linkage, const CXXDestructorDecl *Dtor, CXXDtorType DT) const {
314314
// Delegate back to CGM by default.
315-
return CGM.getLLVMLinkageForDeclarator(Dtor, Linkage,
316-
/*IsConstantVariable=*/false);
315+
return CGM.getLLVMLinkageForDeclarator(Dtor, Linkage);
317316
}
318317

319318
bool CGCXXABI::NeedsVTTParameter(GlobalDecl GD) {

clang/lib/CodeGen/CGCall.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "CGCall.h"
1515
#include "ABIInfo.h"
16+
#include "ABIInfoImpl.h"
1617
#include "CGBlocks.h"
1718
#include "CGCXXABI.h"
1819
#include "CGCleanup.h"
@@ -5759,9 +5760,14 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
57595760
DestIsVolatile = false;
57605761
}
57615762

5762-
// If the value is offset in memory, apply the offset now.
5763-
Address StorePtr = emitAddressAtOffset(*this, DestPtr, RetAI);
5764-
CreateCoercedStore(CI, StorePtr, DestIsVolatile, *this);
5763+
// An empty record can overlap other data (if declared with
5764+
// no_unique_address); omit the store for such types - as there is no
5765+
// actual data to store.
5766+
if (!isEmptyRecord(getContext(), RetTy, true)) {
5767+
// If the value is offset in memory, apply the offset now.
5768+
Address StorePtr = emitAddressAtOffset(*this, DestPtr, RetAI);
5769+
CreateCoercedStore(CI, StorePtr, DestIsVolatile, *this);
5770+
}
57655771

57665772
return convertTempToRValue(DestPtr, RetTy, SourceLocation());
57675773
}

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,14 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
391391
SourceManager &SM = CGM.getContext().getSourceManager();
392392
StringRef FileName;
393393
FileID FID;
394+
std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo;
394395

395396
if (Loc.isInvalid()) {
396397
// The DIFile used by the CU is distinct from the main source file. Call
397398
// createFile() below for canonicalization if the source file was specified
398399
// with an absolute path.
399400
FileName = TheCU->getFile()->getFilename();
401+
CSInfo = TheCU->getFile()->getChecksum();
400402
} else {
401403
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
402404
FileName = PLoc.getFilename();
@@ -417,13 +419,14 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
417419
return cast<llvm::DIFile>(V);
418420
}
419421

422+
// Put Checksum at a scope where it will persist past the createFile call.
420423
SmallString<64> Checksum;
421-
422-
std::optional<llvm::DIFile::ChecksumKind> CSKind =
424+
if (!CSInfo) {
425+
std::optional<llvm::DIFile::ChecksumKind> CSKind =
423426
computeChecksum(FID, Checksum);
424-
std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo;
425-
if (CSKind)
426-
CSInfo.emplace(*CSKind, Checksum);
427+
if (CSKind)
428+
CSInfo.emplace(*CSKind, Checksum);
429+
}
427430
return createFile(FileName, CSInfo, getSource(SM, SM.getFileID(Loc)));
428431
}
429432

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class CGDebugInfo {
148148
llvm::BumpPtrAllocator DebugInfoNames;
149149
StringRef CWDName;
150150

151-
llvm::StringMap<llvm::TrackingMDRef> DIFileCache;
151+
llvm::DenseMap<const char *, llvm::TrackingMDRef> DIFileCache;
152152
llvm::DenseMap<const FunctionDecl *, llvm::TrackingMDRef> SPCache;
153153
/// Cache declarations relevant to DW_TAG_imported_declarations (C++
154154
/// using declarations and global alias variables) that aren't covered

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void CodeGenFunction::EmitVarDecl(const VarDecl &D) {
202202
return;
203203

204204
llvm::GlobalValue::LinkageTypes Linkage =
205-
CGM.getLLVMLinkageVarDefinition(&D, /*IsConstant=*/false);
205+
CGM.getLLVMLinkageVarDefinition(&D);
206206

207207
// FIXME: We need to force the emission/use of a guard variable for
208208
// some variables even if we can constant-evaluate them because

0 commit comments

Comments
 (0)