Skip to content

Commit

Permalink
Merged master:a9c845395f8 into amd-gfx:96f3f925d93
Browse files Browse the repository at this point in the history
Local branch amd-gfx 96f3f92 Merged master:e498be57387 into amd-gfx:b8f35abb804
Remote branch master a9c8453 [lldb] Put the headers in unittests/TestingSupport/ into modules
  • Loading branch information
Sw authored and Sw committed Dec 20, 2019
2 parents 96f3f92 + a9c8453 commit fca8d3e
Show file tree
Hide file tree
Showing 23 changed files with 557 additions and 468 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Tooling/Syntax/Mutations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class syntax::MutationsImpl {
void syntax::removeStatement(syntax::Arena &A, syntax::Statement *S) {
assert(S->canModify());

if (auto *Parent = llvm::dyn_cast<CompoundStatement>(S->parent())) {
if (isa<CompoundStatement>(S->parent())) {
// A child of CompoundStatement can just be safely removed.
MutationsImpl::remove(S);
return;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Tooling/Syntax/Tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ FileRange syntax::Token::range(const SourceManager &SM,
auto F = First.range(SM);
auto L = Last.range(SM);
assert(F.file() == L.file() && "tokens from different files");
assert(F == L || F.endOffset() <= L.beginOffset() && "wrong order of tokens");
assert((F == L || F.endOffset() <= L.beginOffset()) && "wrong order of tokens");
return FileRange(F.file(), F.beginOffset(), L.endOffset());
}

Expand Down
8 changes: 7 additions & 1 deletion lldb/packages/Python/lldbsuite/test/lldbpexpect.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

# System modules
import os
import sys

# Third-party modules
Expand Down Expand Up @@ -29,16 +30,21 @@ def expect_prompt(self):
def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None):
logfile = getattr(sys.stdout, 'buffer',
sys.stdout) if self.TraceOn() else None

args = ['--no-lldbinit', '--no-use-colors']
for cmd in self.setUpCommands():
args += ['-O', cmd]
if executable is not None:
args += ['--file', executable]
if extra_args is not None:
args.extend(extra_args)

env = dict(os.environ)
env["TERM"]="vt100"

self.child = pexpect.spawn(
lldbtest_config.lldbExec, args=args, logfile=logfile,
timeout=timeout, dimensions=dimensions)
timeout=timeout, dimensions=dimensions, env=env)
self.expect_prompt()
for cmd in self.setUpCommands():
self.child.expect_exact(cmd)
Expand Down
1 change: 1 addition & 0 deletions lldb/source/Target/ThreadPlanStepRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ bool ThreadPlanStepRange::StopOthers() {
case lldb::eAllThreads:
return false;
}
llvm_unreachable("Unhandled run mode!");
}

InstructionList *ThreadPlanStepRange::GetInstructionsForAddress(
Expand Down
93 changes: 82 additions & 11 deletions lldb/unittests/Symbol/TestClangASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ class TestClangASTImporter : public testing::Test {
lldb::AccessType::eAccessPublic, name, 0,
lldb::LanguageType::eLanguageTypeC);
}

/// Create a record with the given name and a field with the given type
/// and name.
CompilerType createRecordWithField(ClangASTContext &ast,
llvm::StringRef record_name,
CompilerType field_type,
llvm::StringRef field_name) {
CompilerType t = createRecord(ast, record_name);

ClangASTContext::StartTagDeclarationDefinition(t);
ast.AddFieldToRecordType(t, field_name, field_type,
lldb::AccessType::eAccessPublic, 7);
ClangASTContext::CompleteTagDeclarationDefinition(t);

return t;
}
};

TEST_F(TestClangASTImporter, CanImportInvalidType) {
Expand All @@ -58,7 +74,9 @@ TEST_F(TestClangASTImporter, ImportInvalidType) {
TEST_F(TestClangASTImporter, CopyDeclTagDecl) {
// Tests that the ClangASTImporter::CopyDecl can copy TagDecls.
std::unique_ptr<ClangASTContext> source_ast = createAST();
CompilerType source_type = createRecord(*source_ast, "Source");
CompilerType source_type = createRecordWithField(
*source_ast, "Source",
source_ast->GetBasicType(lldb::BasicType::eBasicTypeChar), "a_field");
clang::TagDecl *source = ClangUtil::GetAsTagDecl(source_type);

std::unique_ptr<ClangASTContext> target_ast = createAST();
Expand All @@ -72,6 +90,8 @@ TEST_F(TestClangASTImporter, CopyDeclTagDecl) {
clang::TagDecl *imported_tag_decl = llvm::cast<clang::TagDecl>(imported);
EXPECT_EQ(source->getQualifiedNameAsString(),
imported_tag_decl->getQualifiedNameAsString());
// We did a minimal import of the tag decl.
EXPECT_TRUE(imported_tag_decl->hasExternalLexicalStorage());

// Check that origin was set for the imported declaration.
ClangASTImporter::DeclOrigin origin = importer.GetDeclOrigin(imported);
Expand All @@ -83,7 +103,9 @@ TEST_F(TestClangASTImporter, CopyDeclTagDecl) {
TEST_F(TestClangASTImporter, CopyTypeTagDecl) {
// Tests that the ClangASTImporter::CopyType can copy TagDecls types.
std::unique_ptr<ClangASTContext> source_ast = createAST();
CompilerType source_type = createRecord(*source_ast, "Source");
CompilerType source_type = createRecordWithField(
*source_ast, "Source",
source_ast->GetBasicType(lldb::BasicType::eBasicTypeChar), "a_field");
clang::TagDecl *source = ClangUtil::GetAsTagDecl(source_type);

std::unique_ptr<ClangASTContext> target_ast = createAST();
Expand All @@ -96,6 +118,8 @@ TEST_F(TestClangASTImporter, CopyTypeTagDecl) {
clang::TagDecl *imported_tag_decl = ClangUtil::GetAsTagDecl(imported);
EXPECT_EQ(source->getQualifiedNameAsString(),
imported_tag_decl->getQualifiedNameAsString());
// We did a minimal import of the tag decl.
EXPECT_TRUE(imported_tag_decl->hasExternalLexicalStorage());

// Check that origin was set for the imported declaration.
ClangASTImporter::DeclOrigin origin =
Expand All @@ -105,6 +129,57 @@ TEST_F(TestClangASTImporter, CopyTypeTagDecl) {
EXPECT_EQ(origin.decl, source);
}

TEST_F(TestClangASTImporter, DeportDeclTagDecl) {
// Tests that the ClangASTImporter::DeportDecl completely copies TagDecls.
std::unique_ptr<ClangASTContext> source_ast = createAST();
CompilerType source_type = createRecordWithField(
*source_ast, "Source",
source_ast->GetBasicType(lldb::BasicType::eBasicTypeChar), "a_field");
clang::TagDecl *source = ClangUtil::GetAsTagDecl(source_type);

std::unique_ptr<ClangASTContext> target_ast = createAST();

ClangASTImporter importer;
clang::Decl *imported = importer.DeportDecl(
target_ast->getASTContext(), source_ast->getASTContext(), source);
ASSERT_NE(nullptr, imported);

// Check that we got the correct decl by just comparing their qualified name.
clang::TagDecl *imported_tag_decl = llvm::cast<clang::TagDecl>(imported);
EXPECT_EQ(source->getQualifiedNameAsString(),
imported_tag_decl->getQualifiedNameAsString());
// The record should be completed as we deported it.
EXPECT_FALSE(imported_tag_decl->hasExternalLexicalStorage());

// Deporting doesn't update the origin map.
EXPECT_FALSE(importer.GetDeclOrigin(imported_tag_decl).Valid());
}

TEST_F(TestClangASTImporter, DeportTypeTagDecl) {
// Tests that the ClangASTImporter::CopyType can deport TagDecl types.
std::unique_ptr<ClangASTContext> source_ast = createAST();
CompilerType source_type = createRecordWithField(
*source_ast, "Source",
source_ast->GetBasicType(lldb::BasicType::eBasicTypeChar), "a_field");
clang::TagDecl *source = ClangUtil::GetAsTagDecl(source_type);

std::unique_ptr<ClangASTContext> target_ast = createAST();

ClangASTImporter importer;
CompilerType imported = importer.DeportType(*target_ast, source_type);
ASSERT_TRUE(imported.IsValid());

// Check that we got the correct decl by just comparing their qualified name.
clang::TagDecl *imported_tag_decl = ClangUtil::GetAsTagDecl(imported);
EXPECT_EQ(source->getQualifiedNameAsString(),
imported_tag_decl->getQualifiedNameAsString());
// The record should be completed as we deported it.
EXPECT_FALSE(imported_tag_decl->hasExternalLexicalStorage());

// Deporting doesn't update the origin map.
EXPECT_FALSE(importer.GetDeclOrigin(imported_tag_decl).Valid());
}

TEST_F(TestClangASTImporter, MetadataPropagation) {
// Tests that AST metadata is propagated when copying declarations.

Expand Down Expand Up @@ -185,13 +260,9 @@ TEST_F(TestClangASTImporter, RecordLayout) {
// correctly retrieve them.

std::unique_ptr<ClangASTContext> source_ast = createAST();
CompilerType source_type = createRecord(*source_ast, "Source");
ClangASTContext::StartTagDeclarationDefinition(source_type);
clang::FieldDecl *field = source_ast->AddFieldToRecordType(
source_type, "a_field",
source_ast->GetBasicType(lldb::BasicType::eBasicTypeChar),
lldb::AccessType::eAccessPublic, 7);
ClangASTContext::CompleteTagDeclarationDefinition(source_type);
CompilerType source_type = createRecordWithField(
*source_ast, "Source",
source_ast->GetBasicType(lldb::BasicType::eBasicTypeChar), "a_field");

clang::TagDecl *source_tag = ClangUtil::GetAsTagDecl(source_type);
clang::RecordDecl *source_record = llvm::cast<clang::RecordDecl>(source_tag);
Expand All @@ -200,7 +271,7 @@ TEST_F(TestClangASTImporter, RecordLayout) {
ClangASTImporter::LayoutInfo layout_info;
layout_info.bit_size = 15;
layout_info.alignment = 2;
layout_info.field_offsets[field] = 1;
layout_info.field_offsets[*source_record->fields().begin()] = 1;
importer.SetRecordLayout(source_record, layout_info);

uint64_t bit_size;
Expand All @@ -214,7 +285,7 @@ TEST_F(TestClangASTImporter, RecordLayout) {
EXPECT_EQ(15U, bit_size);
EXPECT_EQ(2U, alignment);
EXPECT_EQ(1U, field_offsets.size());
EXPECT_EQ(1U, field_offsets[field]);
EXPECT_EQ(1U, field_offsets[*source_record->fields().begin()]);
EXPECT_EQ(0U, base_offsets.size());
EXPECT_EQ(0U, vbase_offsets.size());
}
11 changes: 11 additions & 0 deletions lldb/unittests/TestingSupport/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

module lldb_TestingSupport {
requires cplusplus
module TestUtilities { header "TestUtilities.h" export * }
module MockTildeExpressionResolver { header "MockTildeExpressionResolver.h" export * }
}

module lldb_TestingSupport_Host {
requires cplusplus
module NativeProcessTestUtils { header "Host/NativeProcessTestUtils.h" export * }
}
31 changes: 12 additions & 19 deletions llvm/include/llvm/IR/IntrinsicsAArch64.td
Original file line number Diff line number Diff line change
Expand Up @@ -1397,28 +1397,14 @@ def int_aarch64_sve_zip2 : AdvSIMD_2VectorArg_Intrinsic;
// Logical operations
//

def int_aarch64_sve_and : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_bic : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_cnot : AdvSIMD_Merged1VectorArg_Intrinsic;
def int_aarch64_sve_eor : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_not : AdvSIMD_Merged1VectorArg_Intrinsic;
def int_aarch64_sve_orr : AdvSIMD_Pred2VectorArg_Intrinsic;

def int_aarch64_sve_and : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_or : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_xor : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_bic_base : AdvSIMD_2VectorArg_Intrinsic;
def int_aarch64_sve_bic : AdvSIMD_Pred2VectorArg_Intrinsic;

def int_aarch64_sve_eor : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_ands : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_bics : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_eors : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_orr : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_orn : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_nor : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_nand : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_orrs : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_orns : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_nors : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_nands : AdvSIMD_Pred2VectorArg_Intrinsic;

// TODO: Deprecated and will be replaced by isel patterns.
def int_aarch64_sve_orr_imm : AdvSIMD_1VectorArg_Imm64_Intrinsic;
def int_aarch64_sve_eor_imm : AdvSIMD_1VectorArg_Imm64_Intrinsic;
def int_aarch64_sve_and_imm : AdvSIMD_1VectorArg_Imm64_Intrinsic;
Expand Down Expand Up @@ -1578,6 +1564,13 @@ def int_aarch64_sve_ptrue : AdvSIMD_SVE_PTRUE_Intrinsic;
// Predicate operations
//

def int_aarch64_sve_and_z : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_bic_z : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_eor_z : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_nand_z : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_nor_z : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_orn_z : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_orr_z : AdvSIMD_Pred2VectorArg_Intrinsic;
def int_aarch64_sve_pfirst : AdvSIMD_Pred1VectorArg_Intrinsic;
def int_aarch64_sve_pnext : AdvSIMD_Pred1VectorArg_Intrinsic;
def int_aarch64_sve_punpkhi : AdvSIMD_SVE_PUNPKHI_Intrinsic;
Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ void llvm::calculateDbgEntityHistory(const MachineFunction *MF,
DbgLabels.addInstr(L, MI);
}

if (MI.isDebugInstr())
// Meta Instructions have no output and do not change any values and so
// can be safely ignored.
if (MI.isMetaInstruction())
continue;

// Not a DBG_VALUE instruction. It may clobber registers which describe
Expand Down
34 changes: 17 additions & 17 deletions llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ let Predicates = [HasSVE] in {
defm AND_ZZZ : sve_int_bin_cons_log<0b00, "and", and>;
defm ORR_ZZZ : sve_int_bin_cons_log<0b01, "orr", or>;
defm EOR_ZZZ : sve_int_bin_cons_log<0b10, "eor", xor>;
defm BIC_ZZZ : sve_int_bin_cons_log<0b11, "bic", int_aarch64_sve_bic_base>;
defm BIC_ZZZ : sve_int_bin_cons_log<0b11, "bic", null_frag>;

defm ADD_ZPmZ : sve_int_bin_pred_arit_0<0b000, "add", int_aarch64_sve_add>;
defm SUB_ZPmZ : sve_int_bin_pred_arit_0<0b001, "sub", int_aarch64_sve_sub>;
defm SUBR_ZPmZ : sve_int_bin_pred_arit_0<0b011, "subr", int_aarch64_sve_subr>;

defm ORR_ZPmZ : sve_int_bin_pred_log<0b000, "orr", int_aarch64_sve_or>;
defm EOR_ZPmZ : sve_int_bin_pred_log<0b001, "eor", int_aarch64_sve_xor>;
defm ORR_ZPmZ : sve_int_bin_pred_log<0b000, "orr", int_aarch64_sve_orr>;
defm EOR_ZPmZ : sve_int_bin_pred_log<0b001, "eor", int_aarch64_sve_eor>;
defm AND_ZPmZ : sve_int_bin_pred_log<0b010, "and", int_aarch64_sve_and>;
defm BIC_ZPmZ : sve_int_bin_pred_log<0b011, "bic", int_aarch64_sve_bic>;

Expand Down Expand Up @@ -307,21 +307,21 @@ let Predicates = [HasSVE] in {
defm PFIRST : sve_int_pfirst<0b00000, "pfirst", int_aarch64_sve_pfirst>;
defm PNEXT : sve_int_pnext<0b00110, "pnext", int_aarch64_sve_pnext>;

defm AND_PPzPP : sve_int_pred_log<0b0000, "and", int_aarch64_sve_and>;
defm BIC_PPzPP : sve_int_pred_log<0b0001, "bic", int_aarch64_sve_bic>;
defm EOR_PPzPP : sve_int_pred_log<0b0010, "eor", int_aarch64_sve_eor>;
defm AND_PPzPP : sve_int_pred_log<0b0000, "and", int_aarch64_sve_and_z>;
defm BIC_PPzPP : sve_int_pred_log<0b0001, "bic", int_aarch64_sve_bic_z>;
defm EOR_PPzPP : sve_int_pred_log<0b0010, "eor", int_aarch64_sve_eor_z>;
defm SEL_PPPP : sve_int_pred_log<0b0011, "sel", vselect>;
defm ANDS_PPzPP : sve_int_pred_log<0b0100, "ands", int_aarch64_sve_ands>;
defm BICS_PPzPP : sve_int_pred_log<0b0101, "bics", int_aarch64_sve_bics>;
defm EORS_PPzPP : sve_int_pred_log<0b0110, "eors", int_aarch64_sve_eors>;
defm ORR_PPzPP : sve_int_pred_log<0b1000, "orr", int_aarch64_sve_orr>;
defm ORN_PPzPP : sve_int_pred_log<0b1001, "orn", int_aarch64_sve_orn>;
defm NOR_PPzPP : sve_int_pred_log<0b1010, "nor", int_aarch64_sve_nor>;
defm NAND_PPzPP : sve_int_pred_log<0b1011, "nand", int_aarch64_sve_nand>;
defm ORRS_PPzPP : sve_int_pred_log<0b1100, "orrs", int_aarch64_sve_orrs>;
defm ORNS_PPzPP : sve_int_pred_log<0b1101, "orns", int_aarch64_sve_orns>;
defm NORS_PPzPP : sve_int_pred_log<0b1110, "nors", int_aarch64_sve_nors>;
defm NANDS_PPzPP : sve_int_pred_log<0b1111, "nands", int_aarch64_sve_nands>;
defm ANDS_PPzPP : sve_int_pred_log<0b0100, "ands", null_frag>;
defm BICS_PPzPP : sve_int_pred_log<0b0101, "bics", null_frag>;
defm EORS_PPzPP : sve_int_pred_log<0b0110, "eors", null_frag>;
defm ORR_PPzPP : sve_int_pred_log<0b1000, "orr", int_aarch64_sve_orr_z>;
defm ORN_PPzPP : sve_int_pred_log<0b1001, "orn", int_aarch64_sve_orn_z>;
defm NOR_PPzPP : sve_int_pred_log<0b1010, "nor", int_aarch64_sve_nor_z>;
defm NAND_PPzPP : sve_int_pred_log<0b1011, "nand", int_aarch64_sve_nand_z>;
defm ORRS_PPzPP : sve_int_pred_log<0b1100, "orrs", null_frag>;
defm ORNS_PPzPP : sve_int_pred_log<0b1101, "orns", null_frag>;
defm NORS_PPzPP : sve_int_pred_log<0b1110, "nors", null_frag>;
defm NANDS_PPzPP : sve_int_pred_log<0b1111, "nands", null_frag>;

defm CLASTA_RPZ : sve_int_perm_clast_rz<0, "clasta", AArch64clasta_n>;
defm CLASTB_RPZ : sve_int_perm_clast_rz<1, "clastb", AArch64clastb_n>;
Expand Down
Loading

0 comments on commit fca8d3e

Please sign in to comment.