aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-11-30 20:00:16 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-11-30 20:00:16 +0000
commit703029dbba788f300e679f7512b73257f79499d4 (patch)
tree48e1505ae9e2042296803606d544857eddaf8932
parentfc0a8108a55ae5db3aa0e71a9877bd56f0581728 (diff)
downloadsrc-703029dbba788f300e679f7512b73257f79499d4.tar.gz
src-703029dbba788f300e679f7512b73257f79499d4.zip
-rw-r--r--clang/include/clang/Driver/Options.td3
-rw-r--r--clang/include/clang/Frontend/DependencyOutputOptions.h11
-rw-r--r--clang/include/clang/Frontend/Utils.h11
-rw-r--r--clang/lib/Basic/Targets/OSTargets.h16
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp3
-rw-r--r--clang/lib/Driver/ToolChains/WebAssembly.cpp38
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp4
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp4
-rw-r--r--clang/lib/Format/WhitespaceManager.h2
-rw-r--r--clang/lib/Frontend/DependencyFile.cpp32
-rw-r--r--clang/lib/Lex/ModuleMap.cpp8
-rw-r--r--clang/lib/Sema/SemaOverload.cpp19
-rw-r--r--libcxx/include/__config2
-rw-r--r--libcxx/include/__memory/shared_ptr.h5
-rw-r--r--llvm/lib/ExecutionEngine/JITLink/aarch32.cpp2
-rw-r--r--llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp10
16 files changed, 79 insertions, 91 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index e04f67bdb1fa..37e8c56b2d29 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6079,9 +6079,6 @@ let Flags = [CC1Option, NoDriverOption] in {
def sys_header_deps : Flag<["-"], "sys-header-deps">,
HelpText<"Include system headers in dependency output">,
MarshallingInfoFlag<DependencyOutputOpts<"IncludeSystemHeaders">>;
-def canonical_system_headers : Flag<["-"], "canonical-system-headers">,
- HelpText<"Canonicalize system headers in dependency output">,
- MarshallingInfoFlag<DependencyOutputOpts<"CanonicalSystemHeaders">>;
def module_file_deps : Flag<["-"], "module-file-deps">,
HelpText<"Include module files in dependency output">,
MarshallingInfoFlag<DependencyOutputOpts<"IncludeModuleFiles">>;
diff --git a/clang/include/clang/Frontend/DependencyOutputOptions.h b/clang/include/clang/Frontend/DependencyOutputOptions.h
index e4b26d92647d..621acaaa1359 100644
--- a/clang/include/clang/Frontend/DependencyOutputOptions.h
+++ b/clang/include/clang/Frontend/DependencyOutputOptions.h
@@ -34,8 +34,6 @@ enum ExtraDepKind {
class DependencyOutputOptions {
public:
unsigned IncludeSystemHeaders : 1; ///< Include system header dependencies.
- unsigned
- CanonicalSystemHeaders : 1; ///< canonicalize system header dependencies.
unsigned ShowHeaderIncludes : 1; ///< Show header inclusions (-H).
unsigned UsePhonyTargets : 1; ///< Include phony targets for each
/// dependency, which can avoid some 'make'
@@ -84,11 +82,10 @@ public:
public:
DependencyOutputOptions()
- : IncludeSystemHeaders(0), CanonicalSystemHeaders(0),
- ShowHeaderIncludes(0), UsePhonyTargets(0), AddMissingHeaderDeps(0),
- IncludeModuleFiles(0), ShowSkippedHeaderIncludes(0),
- HeaderIncludeFormat(HIFMT_Textual), HeaderIncludeFiltering(HIFIL_None) {
- }
+ : IncludeSystemHeaders(0), ShowHeaderIncludes(0), UsePhonyTargets(0),
+ AddMissingHeaderDeps(0), IncludeModuleFiles(0),
+ ShowSkippedHeaderIncludes(0), HeaderIncludeFormat(HIFMT_Textual),
+ HeaderIncludeFiltering(HIFIL_None) {}
};
} // end namespace clang
diff --git a/clang/include/clang/Frontend/Utils.h b/clang/include/clang/Frontend/Utils.h
index 8300e45d15fe..143cf4359f00 100644
--- a/clang/include/clang/Frontend/Utils.h
+++ b/clang/include/clang/Frontend/Utils.h
@@ -41,7 +41,6 @@ class ExternalSemaSource;
class FrontendOptions;
class PCHContainerReader;
class Preprocessor;
-class FileManager;
class PreprocessorOptions;
class PreprocessorOutputOptions;
@@ -80,14 +79,11 @@ public:
/// Return true if system files should be passed to sawDependency().
virtual bool needSystemDependencies() { return false; }
- /// Return true if system files should be canonicalized.
- virtual bool shouldCanonicalizeSystemDependencies() { return false; }
-
/// Add a dependency \p Filename if it has not been seen before and
/// sawDependency() returns true.
virtual void maybeAddDependency(StringRef Filename, bool FromModule,
bool IsSystem, bool IsModuleFile,
- FileManager *FileMgr, bool IsMissing);
+ bool IsMissing);
protected:
/// Return true if the filename was added to the list of dependencies, false
@@ -116,10 +112,6 @@ public:
bool sawDependency(StringRef Filename, bool FromModule, bool IsSystem,
bool IsModuleFile, bool IsMissing) final;
- bool shouldCanonicalizeSystemDependencies() override {
- return CanonicalSystemHeaders;
- }
-
protected:
void outputDependencyFile(llvm::raw_ostream &OS);
@@ -129,7 +121,6 @@ private:
std::string OutputFile;
std::vector<std::string> Targets;
bool IncludeSystemHeaders;
- bool CanonicalSystemHeaders;
bool PhonyTarget;
bool AddMissingHeaderDeps;
bool SeenMissingHeader;
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 8f4331b02f3b..cf8cc8e61c49 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -217,6 +217,8 @@ protected:
Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion));
Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
DefineStd(Builder, "unix", Opts);
+ if (this->HasFloat128)
+ Builder.defineMacro("__FLOAT128__");
// On FreeBSD, wchar_t contains the number of the code point as
// used by the character set of the locale. These character sets are
@@ -234,9 +236,11 @@ public:
FreeBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
switch (Triple.getArch()) {
- default:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
+ this->HasFloat128 = true;
+ [[fallthrough]];
+ default:
this->MCountName = ".mcount";
break;
case llvm::Triple::mips:
@@ -425,12 +429,22 @@ protected:
Builder.defineMacro("__unix__");
if (Opts.POSIXThreads)
Builder.defineMacro("_REENTRANT");
+ if (this->HasFloat128)
+ Builder.defineMacro("__FLOAT128__");
}
public:
NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
this->MCountName = "__mcount";
+ switch (Triple.getArch()) {
+ default:
+ break;
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
+ this->HasFloat128 = true;
+ break;
+ }
}
};
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 47ec36b3a8ff..37a07b8f224d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1152,9 +1152,6 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
if (ArgM->getOption().matches(options::OPT_M) ||
ArgM->getOption().matches(options::OPT_MD))
CmdArgs.push_back("-sys-header-deps");
- if (Args.hasFlag(options::OPT_canonical_prefixes,
- options::OPT_no_canonical_prefixes, true))
- CmdArgs.push_back("-canonical-system-headers");
if ((isa<PrecompileJobAction>(JA) &&
!Args.hasArg(options::OPT_fno_module_file_deps)) ||
Args.hasArg(options::OPT_fmodule_file_deps))
diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp
index 36bed3166ff3..2098a68cbc6e 100644
--- a/clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -77,31 +77,43 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddAllArgs(CmdArgs, options::OPT_u);
ToolChain.AddFilePathLibArgs(Args, CmdArgs);
- const char *Crt1 = "crt1.o";
+ bool IsCommand = true;
+ const char *Crt1;
const char *Entry = nullptr;
- // If crt1-command.o exists, it supports new-style commands, so use it.
- // Otherwise, use the old crt1.o. This is a temporary transition measure.
- // Once WASI libc no longer needs to support LLVM versions which lack
- // support for new-style command, it can make crt1.o the same as
- // crt1-command.o. And once LLVM no longer needs to support WASI libc
- // versions before that, it can switch to using crt1-command.o.
- if (ToolChain.GetFilePath("crt1-command.o") != "crt1-command.o")
- Crt1 = "crt1-command.o";
+ // When -shared is specified, use the reactor exec model unless
+ // specified otherwise.
+ if (Args.hasArg(options::OPT_shared))
+ IsCommand = false;
if (const Arg *A = Args.getLastArg(options::OPT_mexec_model_EQ)) {
StringRef CM = A->getValue();
if (CM == "command") {
- // Use default values.
+ IsCommand = true;
} else if (CM == "reactor") {
- Crt1 = "crt1-reactor.o";
- Entry = "_initialize";
+ IsCommand = false;
} else {
ToolChain.getDriver().Diag(diag::err_drv_invalid_argument_to_option)
<< CM << A->getOption().getName();
}
}
- if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, options::OPT_shared))
+
+ if (IsCommand) {
+ // If crt1-command.o exists, it supports new-style commands, so use it.
+ // Otherwise, use the old crt1.o. This is a temporary transition measure.
+ // Once WASI libc no longer needs to support LLVM versions which lack
+ // support for new-style command, it can make crt1.o the same as
+ // crt1-command.o. And once LLVM no longer needs to support WASI libc
+ // versions before that, it can switch to using crt1-command.o.
+ Crt1 = "crt1.o";
+ if (ToolChain.GetFilePath("crt1-command.o") != "crt1-command.o")
+ Crt1 = "crt1-command.o";
+ } else {
+ Crt1 = "crt1-reactor.o";
+ Entry = "_initialize";
+ }
+
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles))
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(Crt1)));
if (Entry) {
CmdArgs.push_back(Args.MakeArgString("--entry"));
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 4a1fc08455e5..c52fe12e7ffd 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3065,8 +3065,8 @@ void TokenAnnotator::setCommentLineLevels(
// If the comment is currently aligned with the line immediately following
// it, that's probably intentional and we should keep it.
- if (NextNonCommentLine && !NextNonCommentLine->First->Finalized &&
- Line->isComment() && NextNonCommentLine->First->NewlinesBefore <= 1 &&
+ if (NextNonCommentLine && NextNonCommentLine->First->NewlinesBefore < 2 &&
+ Line->isComment() && !isClangFormatOff(Line->First->TokenText) &&
NextNonCommentLine->First->OriginalColumn ==
Line->First->OriginalColumn) {
const bool PPDirectiveOrImportStmt =
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index c1016c44a74a..ddb55c4d853a 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1263,6 +1263,8 @@ void WhitespaceManager::alignArrayInitializersRightJustified(
auto Offset = std::distance(Cells.begin(), CellIter);
for (const auto *Next = CellIter->NextColumnElement; Next;
Next = Next->NextColumnElement) {
+ if (RowCount >= CellDescs.CellCounts.size())
+ break;
auto *Start = (Cells.begin() + RowCount * CellDescs.CellCounts[0]);
auto *End = Start + Offset;
ThisNetWidth = getNetWidth(Start, End, CellDescs.InitialSpaces);
@@ -1324,7 +1326,7 @@ void WhitespaceManager::alignArrayInitializersLeftJustified(
auto Offset = std::distance(Cells.begin(), CellIter);
for (const auto *Next = CellIter->NextColumnElement; Next;
Next = Next->NextColumnElement) {
- if (RowCount > CellDescs.CellCounts.size())
+ if (RowCount >= CellDescs.CellCounts.size())
break;
auto *Start = (Cells.begin() + RowCount * CellDescs.CellCounts[0]);
auto *End = Start + Offset;
diff --git a/clang/lib/Format/WhitespaceManager.h b/clang/lib/Format/WhitespaceManager.h
index df7e9add1cd4..69398fe41150 100644
--- a/clang/lib/Format/WhitespaceManager.h
+++ b/clang/lib/Format/WhitespaceManager.h
@@ -317,7 +317,7 @@ private:
auto Offset = std::distance(CellStart, CellStop);
for (const auto *Next = CellStop->NextColumnElement; Next;
Next = Next->NextColumnElement) {
- if (RowCount > MaxRowCount)
+ if (RowCount >= MaxRowCount)
break;
auto Start = (CellStart + RowCount * CellCount);
auto End = Start + Offset;
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index 44268e71dc24..fb56eb225c83 100644
--- a/clang/lib/Frontend/DependencyFile.cpp
+++ b/clang/lib/Frontend/DependencyFile.cpp
@@ -49,7 +49,6 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
DepCollector.maybeAddDependency(
llvm::sys::path::remove_leading_dotslash(*Filename),
/*FromModule*/ false, isSystem(FileType), /*IsModuleFile*/ false,
- &PP.getFileManager(),
/*IsMissing*/ false);
}
@@ -57,11 +56,9 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
SrcMgr::CharacteristicKind FileType) override {
StringRef Filename =
llvm::sys::path::remove_leading_dotslash(SkippedFile.getName());
- DepCollector.maybeAddDependency(Filename,
- /*FromModule=*/false,
+ DepCollector.maybeAddDependency(Filename, /*FromModule=*/false,
/*IsSystem=*/isSystem(FileType),
/*IsModuleFile=*/false,
- &PP.getFileManager(),
/*IsMissing=*/false);
}
@@ -72,11 +69,9 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
StringRef RelativePath, const Module *Imported,
SrcMgr::CharacteristicKind FileType) override {
if (!File)
- DepCollector.maybeAddDependency(FileName,
- /*FromModule*/ false,
+ DepCollector.maybeAddDependency(FileName, /*FromModule*/ false,
/*IsSystem*/ false,
/*IsModuleFile*/ false,
- &PP.getFileManager(),
/*IsMissing*/ true);
// Files that actually exist are handled by FileChanged.
}
@@ -88,11 +83,9 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
return;
StringRef Filename =
llvm::sys::path::remove_leading_dotslash(File->getName());
- DepCollector.maybeAddDependency(Filename,
- /*FromModule=*/false,
+ DepCollector.maybeAddDependency(Filename, /*FromModule=*/false,
/*IsSystem=*/isSystem(FileType),
/*IsModuleFile=*/false,
- &PP.getFileManager(),
/*IsMissing=*/false);
}
@@ -108,11 +101,9 @@ struct DepCollectorMMCallbacks : public ModuleMapCallbacks {
void moduleMapFileRead(SourceLocation Loc, const FileEntry &Entry,
bool IsSystem) override {
StringRef Filename = Entry.getName();
- DepCollector.maybeAddDependency(Filename,
- /*FromModule*/ false,
+ DepCollector.maybeAddDependency(Filename, /*FromModule*/ false,
/*IsSystem*/ IsSystem,
/*IsModuleFile*/ false,
- /*FileMgr*/ nullptr,
/*IsMissing*/ false);
}
};
@@ -128,10 +119,8 @@ struct DepCollectorASTListener : public ASTReaderListener {
}
void visitModuleFile(StringRef Filename,
serialization::ModuleKind Kind) override {
- DepCollector.maybeAddDependency(Filename,
- /*FromModule*/ true,
+ DepCollector.maybeAddDependency(Filename, /*FromModule*/ true,
/*IsSystem*/ false, /*IsModuleFile*/ true,
- /*FileMgr*/ nullptr,
/*IsMissing*/ false);
}
bool visitInputFile(StringRef Filename, bool IsSystem,
@@ -145,7 +134,7 @@ struct DepCollectorASTListener : public ASTReaderListener {
Filename = FE->getName();
DepCollector.maybeAddDependency(Filename, /*FromModule*/ true, IsSystem,
- /*IsModuleFile*/ false, /*FileMgr*/ nullptr,
+ /*IsModuleFile*/ false,
/*IsMissing*/ false);
return true;
}
@@ -155,15 +144,9 @@ struct DepCollectorASTListener : public ASTReaderListener {
void DependencyCollector::maybeAddDependency(StringRef Filename,
bool FromModule, bool IsSystem,
bool IsModuleFile,
- FileManager *FileMgr,
bool IsMissing) {
- if (sawDependency(Filename, FromModule, IsSystem, IsModuleFile, IsMissing)) {
- if (IsSystem && FileMgr && shouldCanonicalizeSystemDependencies()) {
- if (auto F = FileMgr->getFile(Filename))
- Filename = FileMgr->getCanonicalName(*F);
- }
+ if (sawDependency(Filename, FromModule, IsSystem, IsModuleFile, IsMissing))
addDependency(Filename);
- }
}
bool DependencyCollector::addDependency(StringRef Filename) {
@@ -211,7 +194,6 @@ DependencyFileGenerator::DependencyFileGenerator(
const DependencyOutputOptions &Opts)
: OutputFile(Opts.OutputFile), Targets(Opts.Targets),
IncludeSystemHeaders(Opts.IncludeSystemHeaders),
- CanonicalSystemHeaders(Opts.CanonicalSystemHeaders),
PhonyTarget(Opts.UsePhonyTargets),
AddMissingHeaderDeps(Opts.AddMissingHeaderDeps), SeenMissingHeader(false),
IncludeModuleFiles(Opts.IncludeModuleFiles),
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 5a1b0a918caa..6a5699dd484e 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -2481,9 +2481,9 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken,
<< FixItHint::CreateReplacement(CurrModuleDeclLoc, "framework module");
}
-static int compareModuleHeaders(const Module::Header *A,
- const Module::Header *B) {
- return A->NameAsWritten.compare(B->NameAsWritten);
+static bool compareModuleHeaders(const Module::Header &A,
+ const Module::Header &B) {
+ return A.NameAsWritten < B.NameAsWritten;
}
/// Parse an umbrella directory declaration.
@@ -2546,7 +2546,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) {
}
// Sort header paths so that the pcm doesn't depend on iteration order.
- llvm::array_pod_sort(Headers.begin(), Headers.end(), compareModuleHeaders);
+ std::stable_sort(Headers.begin(), Headers.end(), compareModuleHeaders);
for (auto &Header : Headers)
Map.addHeader(ActiveModule, std::move(Header), ModuleMap::TextualHeader);
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index a3d9abb15377..aef8dc58a48d 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -957,18 +957,13 @@ static bool shouldAddReversedEqEq(Sema &S, SourceLocation OpLoc,
return true;
}
// Otherwise the search scope is the namespace scope of which F is a member.
- LookupResult NonMembers(S, NotEqOp, OpLoc,
- Sema::LookupNameKind::LookupOperatorName);
- S.LookupName(NonMembers,
- S.getScopeForContext(EqFD->getEnclosingNamespaceContext()));
- NonMembers.suppressDiagnostics();
- for (NamedDecl *Op : NonMembers) {
- auto *FD = Op->getAsFunction();
- if(auto* UD = dyn_cast<UsingShadowDecl>(Op))
- FD = UD->getUnderlyingDecl()->getAsFunction();
- if (FunctionsCorrespond(S.Context, EqFD, FD) &&
- declaresSameEntity(cast<Decl>(EqFD->getDeclContext()),
- cast<Decl>(Op->getDeclContext())))
+ for (NamedDecl *Op : EqFD->getEnclosingNamespaceContext()->lookup(NotEqOp)) {
+ auto *NotEqFD = Op->getAsFunction();
+ if (auto *UD = dyn_cast<UsingShadowDecl>(Op))
+ NotEqFD = UD->getUnderlyingDecl()->getAsFunction();
+ if (FunctionsCorrespond(S.Context, EqFD, NotEqFD) && S.isVisible(NotEqFD) &&
+ declaresSameEntity(cast<Decl>(EqFD->getEnclosingNamespaceContext()),
+ cast<Decl>(Op->getLexicalDeclContext())))
return false;
}
return true;
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 10c056f313ff..221bb8ff868b 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -40,7 +40,7 @@
// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
// defined to XXYYZZ.
-# define _LIBCPP_VERSION 170005
+# define _LIBCPP_VERSION 170006
# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index dce44a7b3732..a5bae83e0b61 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -1134,7 +1134,8 @@ private:
__alloc_.~_Alloc();
size_t __size = __unbounded_array_control_block::__bytes_for(__count_);
_AlignedStorage* __storage = reinterpret_cast<_AlignedStorage*>(this);
- allocator_traits<_StorageAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*__storage), __size);
+ allocator_traits<_StorageAlloc>::deallocate(
+ __tmp, _PointerTraits::pointer_to(*__storage), __size / sizeof(_AlignedStorage));
}
_LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
@@ -1217,7 +1218,7 @@ private:
_ControlBlockAlloc __tmp(__alloc_);
__alloc_.~_Alloc();
- allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), sizeof(*this));
+ allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, _PointerTraits::pointer_to(*this), 1);
}
_LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
diff --git a/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp b/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
index ffc3950cdec8..83829dde0508 100644
--- a/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
@@ -173,7 +173,7 @@ bool checkRegister(const ThumbRelocation &R, HalfWords Reg) {
}
template <EdgeKind_aarch32 Kind>
-bool writeRegister(WritableThumbRelocation &R, HalfWords Reg) {
+void writeRegister(WritableThumbRelocation &R, HalfWords Reg) {
static constexpr HalfWords Mask = FixupInfo<Kind>::RegMask;
assert((Mask.Hi & Reg.Hi) == Reg.Hi && (Mask.Hi & Reg.Hi) == Reg.Hi &&
"Value bits exceed bit range of given mask");
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index aa20409da4e2..901204043b3c 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -991,12 +991,12 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
unsigned TrailingOnes = llvm::countr_one(Mask);
if (ShAmt >= TrailingOnes)
break;
- // If the mask has 32 trailing ones, use SRLIW.
+ // If the mask has 32 trailing ones, use SRLI on RV32 or SRLIW on RV64.
if (TrailingOnes == 32) {
- SDNode *SRLIW =
- CurDAG->getMachineNode(RISCV::SRLIW, DL, VT, N0->getOperand(0),
- CurDAG->getTargetConstant(ShAmt, DL, VT));
- ReplaceNode(Node, SRLIW);
+ SDNode *SRLI = CurDAG->getMachineNode(
+ Subtarget->is64Bit() ? RISCV::SRLIW : RISCV::SRLI, DL, VT,
+ N0->getOperand(0), CurDAG->getTargetConstant(ShAmt, DL, VT));
+ ReplaceNode(Node, SRLI);
return;
}