Skip to content

Commit

Permalink
Merged master:340c376b87c into amd-gfx:e4f18c6a7d7
Browse files Browse the repository at this point in the history
Local branch amd-gfx e4f18c6 Merged master:2d3b8cc83fe into amd-gfx:73e365b16db
Remote branch master 340c376 [lldb] Fix a CMake warning typo. NFC.
  • Loading branch information
Sw authored and Sw committed Jul 13, 2020
2 parents e4f18c6 + 340c376 commit 3a1737a
Show file tree
Hide file tree
Showing 60 changed files with 35,413 additions and 269 deletions.
3 changes: 1 addition & 2 deletions clang-tools-extra/clangd/CompileCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ CommandMangler CommandMangler::forTests() {
}

void CommandMangler::adjust(std::vector<std::string> &Cmd) const {
// FIXME: remove const_cast once unique_function is const-compatible.
for (auto &Edit : const_cast<Config &>(Config::current()).CompileFlags.Edits)
for (auto &Edit : Config::current().CompileFlags.Edits)
Edit(Cmd);

// Check whether the flag exists, either as -flag or -flag=*
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clangd/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ struct Config {
/// Controls how the compile command for the current file is determined.
struct {
// Edits to apply to the compile command, in sequence.
// FIXME: these functions need to be const-callable. For now, const_cast.
std::vector<llvm::unique_function<void(std::vector<std::string> &)>> Edits;
std::vector<llvm::unique_function<void(std::vector<std::string> &) const>>
Edits;
} CompileFlags;
};

Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/AST/ExprCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,7 @@ class LambdaExpr final : public Expr,

/// Const iterator that walks over the capture initialization
/// arguments.
/// FIXME: This interface is prone to being used incorrectly.
using const_capture_init_iterator = Expr *const *;

/// Retrieve the initialization expressions for this lambda's captures.
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3629,7 +3629,7 @@ bool Expr::HasSideEffects(const ASTContext &Ctx,
case LambdaExprClass: {
const LambdaExpr *LE = cast<LambdaExpr>(this);
for (Expr *E : LE->capture_inits())
if (E->HasSideEffects(Ctx, IncludePossibleEffects))
if (E && E->HasSideEffects(Ctx, IncludePossibleEffects))
return true;
return false;
}
Expand Down
1 change: 1 addition & 0 deletions clang/unittests/AST/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ add_clang_unittest(ASTTests
DeclTest.cpp
EvaluateAsRValueTest.cpp
ExternalASTSourceTest.cpp
HasSideEffectsTest.cpp
NamedDeclPrinterTest.cpp
RecursiveASTVisitorTest.cpp
SizelessTypesTest.cpp
Expand Down
86 changes: 86 additions & 0 deletions clang/unittests/AST/HasSideEffectsTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//===- unittest/AST/HasSideEffectsTest.cpp --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cassert>

using namespace clang;

namespace {
class ProcessASTAction : public clang::ASTFrontendAction {
public:
ProcessASTAction(llvm::unique_function<void(clang::ASTContext &)> Process)
: Process(std::move(Process)) {
assert(this->Process);
}

std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) {
class Consumer : public ASTConsumer {
public:
Consumer(llvm::function_ref<void(ASTContext &CTx)> Process)
: Process(Process) {}

void HandleTranslationUnit(ASTContext &Ctx) override { Process(Ctx); }

private:
llvm::function_ref<void(ASTContext &CTx)> Process;
};

return std::make_unique<Consumer>(Process);
}

private:
llvm::unique_function<void(clang::ASTContext &)> Process;
};

class RunHasSideEffects
: public RecursiveASTVisitor<RunHasSideEffects> {
public:
RunHasSideEffects(ASTContext& Ctx)
: Ctx(Ctx) {}

bool VisitLambdaExpr(LambdaExpr *LE) {
LE->HasSideEffects(Ctx);
return true;
}

ASTContext& Ctx;
};
} // namespace

TEST(HasSideEffectsTest, All) {
llvm::StringRef Code = R"cpp(
void Test() {
int msize = 4;
float arr[msize];
[&arr] {};
}
)cpp";

ASSERT_NO_FATAL_FAILURE(
clang::tooling::runToolOnCode(
std::make_unique<ProcessASTAction>(
[&](clang::ASTContext &Ctx) {
RunHasSideEffects Visitor(Ctx);
Visitor.TraverseAST(Ctx);
}
),
Code)
);

}
4 changes: 4 additions & 0 deletions flang/lib/Semantics/mod-file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "mod-file.h"
#include "resolve-names.h"
#include "flang/Common/restorer.h"
#include "flang/Evaluate/tools.h"
#include "flang/Parser/message.h"
#include "flang/Parser/parsing.h"
Expand Down Expand Up @@ -99,6 +100,9 @@ class SubprogramSymbolCollector {
};

bool ModFileWriter::WriteAll() {
// this flag affects character literals: force it to be consistent
auto restorer{
common::ScopedSet(parser::useHexadecimalEscapeSequences, false)};
WriteAll(context_.globalScope());
return !context_.AnyFatalError();
}
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/mod-file.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SemanticsContext;

class ModFileWriter {
public:
ModFileWriter(SemanticsContext &context) : context_{context} {}
explicit ModFileWriter(SemanticsContext &context) : context_{context} {}
bool WriteAll();

private:
Expand Down
2 changes: 1 addition & 1 deletion lldb/tools/debugserver/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function(get_debugserver_codesign_identity result)
return()
endif()

message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
message(WARNING "Development code sign identity not found: 'lldb_codesign' ${not_found_help}")

# LLVM pendant: fallback if available
if(LLVM_CODESIGNING_IDENTITY)
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class LegalizerHelper {
widenScalarExtract(MachineInstr &MI, unsigned TypeIdx, LLT WideTy);
LegalizeResult
widenScalarInsert(MachineInstr &MI, unsigned TypeIdx, LLT WideTy);
LegalizeResult widenScalarAddSubSat(MachineInstr &MI, unsigned TypeIdx,
LLT WideTy);

/// Helper function to split a wide generic register into bitwise blocks with
/// the given Type (which implies the number of blocks needed). The generic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Memory.h"
#include "llvm/Support/MSVCErrorWorkarounds.h"

#include <cstdint>
#include <future>
Expand Down Expand Up @@ -78,7 +79,7 @@ class JITLinkMemoryManager {

/// Calls finalizeAsync and waits for completion.
Error finalize() {
std::promise<Error> FinalizeResultP;
std::promise<MSVCPError> FinalizeResultP;
auto FinalizeResultF = FinalizeResultP.get_future();
finalizeAsync(
[&](Error Err) { FinalizeResultP.set_value(std::move(Err)); });
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/ExecutionEngine/Orc/OrcABISupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cstdint>
#include <optional>

namespace llvm {
namespace orc {
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/Passes/PassBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ class PassBuilder {
/// Returns true if the pass name is the name of an alias analysis pass.
bool isAAPassName(StringRef PassName);

/// Returns true if the pass name is the name of a (non-alias) analysis pass.
bool isAnalysisPassName(StringRef PassName);

/// Register a callback for a default optimizer pipeline extension
/// point
///
Expand Down
4 changes: 4 additions & 0 deletions llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def : GINodeEquiv<G_XOR, xor>;
def : GINodeEquiv<G_SHL, shl>;
def : GINodeEquiv<G_LSHR, srl>;
def : GINodeEquiv<G_ASHR, sra>;
def : GINodeEquiv<G_SADDSAT, saddsat>;
def : GINodeEquiv<G_UADDSAT, uaddsat>;
def : GINodeEquiv<G_SSUBSAT, ssubsat>;
def : GINodeEquiv<G_USUBSAT, usubsat>;
def : GINodeEquiv<G_SELECT, select>;
def : GINodeEquiv<G_FNEG, fneg>;
def : GINodeEquiv<G_FPEXT, fpextend>;
Expand Down
18 changes: 13 additions & 5 deletions llvm/lib/Analysis/InlineAdvisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class DefaultInlineAdvice : public InlineAdvice {

} // namespace

std::unique_ptr<InlineAdvice> DefaultInlineAdvisor::getAdvice(CallBase &CB) {
llvm::Optional<llvm::InlineCost>
getDefaultInlineAdvice(CallBase &CB, FunctionAnalysisManager &FAM,
const InlineParams &Params) {
Function &Caller = *CB.getCaller();
ProfileSummaryInfo *PSI =
FAM.getResult<ModuleAnalysisManagerFunctionProxy>(Caller)
Expand All @@ -111,10 +113,16 @@ std::unique_ptr<InlineAdvice> DefaultInlineAdvisor::getAdvice(CallBase &CB) {
return getInlineCost(CB, Params, CalleeTTI, GetAssumptionCache, GetTLI,
GetBFI, PSI, RemarksEnabled ? &ORE : nullptr);
};
auto OIC = llvm::shouldInline(CB, GetInlineCost, ORE,
Params.EnableDeferral.hasValue() &&
Params.EnableDeferral.getValue());
return std::make_unique<DefaultInlineAdvice>(this, CB, OIC, ORE);
return llvm::shouldInline(CB, GetInlineCost, ORE,
Params.EnableDeferral.hasValue() &&
Params.EnableDeferral.getValue());
}

std::unique_ptr<InlineAdvice> DefaultInlineAdvisor::getAdvice(CallBase &CB) {
auto OIC = getDefaultInlineAdvice(CB, FAM, Params);
return std::make_unique<DefaultInlineAdvice>(
this, CB, OIC,
FAM.getResult<OptimizationRemarkEmitterAnalysis>(*CB.getCaller()));
}

InlineAdvice::InlineAdvice(InlineAdvisor *Advisor, CallBase &CB,
Expand Down
Binary file removed llvm/lib/Analysis/models/inliner/saved_model.pb
Binary file not shown.
Loading

0 comments on commit 3a1737a

Please sign in to comment.