Skip to content

Commit

Permalink
Merged master:21810b0e1428 into amd-gfx:99aa69d1fa46
Browse files Browse the repository at this point in the history
Local branch amd-gfx 99aa69d Merged master:612b4dda7667 into amd-gfx:6a82f7b231e2
Remote branch master 21810b0 [SVE] Lower fixed length vector integer UMIN/UMAX
  • Loading branch information
Sw authored and Sw committed Aug 13, 2020
2 parents 99aa69d + 21810b0 commit 5f4901f
Show file tree
Hide file tree
Showing 131 changed files with 7,827 additions and 2,613 deletions.
6 changes: 5 additions & 1 deletion clang/lib/Driver/ToolChains/Darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
bool isMacosxVersionLT(unsigned V0, unsigned V1 = 0, unsigned V2 = 0) const {
assert(isTargetMacOS() && getTriple().isMacOSX() &&
"Unexpected call for non OS X target!");
VersionTuple MinVers = getTriple().getMinimumSupportedOSVersion();
// The effective triple might not be initialized yet, so construct a
// pseudo-effective triple to get the minimum supported OS version.
VersionTuple MinVers =
llvm::Triple(getTriple().getArchName(), "apple", "macos")
.getMinimumSupportedOSVersion();
return (!MinVers.empty() && MinVers > TargetVersion
? MinVers
: TargetVersion) < VersionTuple(V0, V1, V2);
Expand Down
5 changes: 3 additions & 2 deletions clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12886,7 +12886,8 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
AttributeCommonInfo::AS_Pragma));
}

if (var->hasInit() && isa<InitListExpr>(var->getInit())) {
if (!var->getType()->isStructureType() && var->hasInit() &&
isa<InitListExpr>(var->getInit())) {
const auto *ILE = cast<InitListExpr>(var->getInit());
unsigned NumInits = ILE->getNumInits();
if (NumInits > 2)
Expand Down Expand Up @@ -12927,7 +12928,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
Diag(SL->getBeginLoc(),
diag::note_concatenated_string_literal_silence);
}
// Warn just once.
// In any case, stop now.
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %clang -### -arch arm64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
// RUN: %clang -### -arch x86_64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
// REQUIRES: system-darwin

// ARM64-10_7-NOT: -lcrt1.10.6.o
// x86_64-10_7: -lcrt1.10.6.o
1 change: 1 addition & 0 deletions clang/test/Driver/macos-apple-silicon-slice-link-libs.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %clang -### -target arm64-apple-macos10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
// RUN: %clang -### -target x86_64-apple-macos10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
// RUN: %clang -### -target arm64-apple-darwin6 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s

// RUN: %clang -### -target arm64-apple-macos10.5 %s 2>&1 | FileCheck -check-prefix=ARM64-10_5 %s
// RUN: %clang -### -target x86_64-apple-macos10.5 %s 2>&1 | FileCheck -check-prefix=x86_64-10_5 %s
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Sema/string-concat.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ const A not_warn6 = A{"",
""};
#endif

static A not_warn7 = {"",

""
"",
""};


// Do not warn when all the elements in the initializer are concatenated together.
const char *all_elems_in_init_concatenated[] = {"a" "b" "c"};
Expand Down
14 changes: 7 additions & 7 deletions compiler-rt/test/profile/Linux/counter_promo_for.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ __attribute__((noinline)) void foo(int n, int N) {
// PROMO: load{{.*}}@__profc_foo{{.*}} 3){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 3){{.*}}
// PROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO-NEXT: load{{.*}}@__profc_foo{{.*}} 1){{.*}}
// PROMO: load{{.*}}@__profc_foo{{.*}} 1){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 1){{.*}}
// PROMO-NEXT: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO: load{{.*}}@__profc_foo{{.*}} 2){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 2){{.*}}
//
// NOPROMO-LABEL: @foo
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 1){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 1){{.*}}
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 2){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 2){{.*}}
Expand Down
14 changes: 7 additions & 7 deletions compiler-rt/test/profile/Linux/counter_promo_while.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ int g;
__attribute__((noinline)) void bar(int i) { g += i; }
__attribute__((noinline)) void foo(int n, int N) {
// PROMO-LABEL: @foo
// PROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO-NEXT: load{{.*}}@__profc_foo{{.*}} 1){{.*}}
// PROMO: load{{.*}}@__profc_foo{{.*}} 1){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 1){{.*}}
// PROMO-NEXT: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// PROMO-NEXT: load{{.*}}@__profc_foo{{.*}} 2){{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 2){{.*}}
//
// NOPROMO-LABEL: @foo
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 1){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 1){{.*}}
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}}
// NOPROMO: load{{.*}}@__profc_foo{{.*}} 2){{.*}}
// NOPROMO-NEXT: add
// NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 2){{.*}}
Expand Down
7 changes: 6 additions & 1 deletion flang/include/flang/Parser/parse-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ struct AssignStmt;
struct AssignedGotoStmt;
struct PauseStmt;
struct OpenACCConstruct;
struct AccEndCombinedDirective;
struct OpenACCDeclarativeConstruct;
struct OpenMPConstruct;
struct OpenMPDeclarativeConstruct;
Expand Down Expand Up @@ -517,6 +518,7 @@ struct ExecutableConstruct {
common::Indirection<WhereConstruct>, common::Indirection<ForallConstruct>,
common::Indirection<CompilerDirective>,
common::Indirection<OpenACCConstruct>,
common::Indirection<AccEndCombinedDirective>,
common::Indirection<OpenMPConstruct>,
common::Indirection<OmpEndLoopDirective>>
u;
Expand Down Expand Up @@ -3970,6 +3972,7 @@ struct OpenACCStandaloneDeclarativeConstruct {

struct AccBeginCombinedDirective {
TUPLE_CLASS_BOILERPLATE(AccBeginCombinedDirective);
CharBlock source;
std::tuple<AccCombinedDirective, AccClauseList> t;
};

Expand All @@ -3981,7 +3984,9 @@ struct AccEndCombinedDirective {
struct OpenACCCombinedConstruct {
TUPLE_CLASS_BOILERPLATE(OpenACCCombinedConstruct);
CharBlock source;
std::tuple<AccBeginCombinedDirective, Block,
OpenACCCombinedConstruct(AccBeginCombinedDirective &&a)
: t({std::move(a), std::nullopt, std::nullopt}) {}
std::tuple<AccBeginCombinedDirective, std::optional<DoConstruct>,
std::optional<AccEndCombinedDirective>>
t;
};
Expand Down
3 changes: 2 additions & 1 deletion flang/lib/Parser/executable-parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ constexpr auto executableConstruct{
construct<ExecutableConstruct>(indirect(whereConstruct)),
construct<ExecutableConstruct>(indirect(forallConstruct)),
construct<ExecutableConstruct>(indirect(ompEndLoopDirective)),
construct<ExecutableConstruct>(indirect(openaccConstruct)),
construct<ExecutableConstruct>(indirect(openmpConstruct)),
construct<ExecutableConstruct>(indirect(accEndCombinedDirective)),
construct<ExecutableConstruct>(indirect(openaccConstruct)),
construct<ExecutableConstruct>(indirect(compilerDirective)))};

// R510 execution-part-construct ->
Expand Down
14 changes: 7 additions & 7 deletions flang/lib/Parser/openacc-parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,9 @@ TYPE_PARSER(sourced(
parenthesized(Parser<AccObjectListWithModifier>{}))))

// 2.11 Combined constructs
TYPE_PARSER(startAccLine >> construct<AccEndCombinedDirective>(sourced(
"END"_tok >> Parser<AccCombinedDirective>{})))

TYPE_PARSER(construct<AccBeginCombinedDirective>(
sourced(Parser<AccCombinedDirective>{}), Parser<AccClauseList>{}))

TYPE_PARSER(construct<OpenACCCombinedConstruct>(
Parser<AccBeginCombinedDirective>{} / endAccLine, block,
maybe(Parser<AccEndCombinedDirective>{} / endAccLine)))

// 2.12 Atomic constructs
TYPE_PARSER(construct<AccEndAtomic>(startAccLine >> "END ATOMIC"_tok))

Expand Down Expand Up @@ -281,4 +274,11 @@ TYPE_CONTEXT_PARSER("OpenACC construct"_en_US,
construct<OpenACCConstruct>(Parser<OpenACCCacheConstruct>{}),
construct<OpenACCConstruct>(Parser<OpenACCWaitConstruct>{}),
construct<OpenACCConstruct>(Parser<OpenACCAtomicConstruct>{})))

TYPE_PARSER(startAccLine >> sourced(construct<AccEndCombinedDirective>(sourced(
"END"_tok >> Parser<AccCombinedDirective>{}))))

TYPE_PARSER(construct<OpenACCCombinedConstruct>(
sourced(Parser<AccBeginCombinedDirective>{} / endAccLine)))

} // namespace Fortran::parser
8 changes: 4 additions & 4 deletions flang/lib/Parser/program-parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ TYPE_CONTEXT_PARSER("specification part"_en_US,
// are in contexts that impose constraints on the kinds of statements that
// are allowed, and so we have a variant production for declaration-construct
// that implements those constraints.
constexpr auto execPartLookAhead{first(actionStmt >> ok,
ompEndLoopDirective >> ok, openaccConstruct >> ok, openmpConstruct >> ok,
"ASSOCIATE ("_tok, "BLOCK"_tok, "SELECT"_tok, "CHANGE TEAM"_sptok,
"CRITICAL"_tok, "DO"_tok, "IF ("_tok, "WHERE ("_tok, "FORALL ("_tok)};
constexpr auto execPartLookAhead{
first(actionStmt >> ok, openaccConstruct >> ok, openmpConstruct >> ok,
"ASSOCIATE ("_tok, "BLOCK"_tok, "SELECT"_tok, "CHANGE TEAM"_sptok,
"CRITICAL"_tok, "DO"_tok, "IF ("_tok, "WHERE ("_tok, "FORALL ("_tok)};
constexpr auto declErrorRecovery{
stmtErrorRecoveryStart >> !execPartLookAhead >> skipStmtErrorRecovery};
constexpr auto misplacedSpecificationStmt{Parser<UseStmt>{} >>
Expand Down
1 change: 1 addition & 0 deletions flang/lib/Parser/type-parsers.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ constexpr Parser<EntryStmt> entryStmt; // R1541
constexpr Parser<ContainsStmt> containsStmt; // R1543
constexpr Parser<CompilerDirective> compilerDirective;
constexpr Parser<OpenACCConstruct> openaccConstruct;
constexpr Parser<AccEndCombinedDirective> accEndCombinedDirective;
constexpr Parser<OpenACCDeclarativeConstruct> openaccDeclarativeConstruct;
constexpr Parser<OpenMPConstruct> openmpConstruct;
constexpr Parser<OpenMPDeclarativeConstruct> openmpDeclarativeConstruct;
Expand Down
5 changes: 2 additions & 3 deletions flang/lib/Parser/unparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2104,10 +2104,9 @@ class UnparseVisitor {
Walk(std::get<AccBeginCombinedDirective>(x.t));
Put("\n");
EndOpenACC();
Walk(std::get<Block>(x.t), "");
Walk(std::get<std::optional<DoConstruct>>(x.t));
BeginOpenACC();
Word("!$ACC END ");
Walk(std::get<std::optional<AccEndCombinedDirective>>(x.t));
Walk("!$ACC END ", std::get<std::optional<DoConstruct>>(x.t));
Put("\n");
EndOpenACC();
}
Expand Down
62 changes: 62 additions & 0 deletions flang/lib/Semantics/canonicalize-acc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// 1. move structured DoConstruct into
// OpenACCLoopConstruct. Compilation will not proceed in case of errors
// after this pass.
// 2. move structured DoConstruct into OpenACCCombinedConstruct. Move
// AccEndCombinedConstruct into OpenACCCombinedConstruct if present.
// Compilation will not proceed in case of errors after this pass.
namespace Fortran::semantics {

using namespace parser::literals;
Expand All @@ -30,6 +33,16 @@ class CanonicalizationOfAcc {
for (auto it{block.begin()}; it != block.end(); ++it) {
if (auto *accLoop{parser::Unwrap<parser::OpenACCLoopConstruct>(*it)}) {
RewriteOpenACCLoopConstruct(*accLoop, block, it);
} else if (auto *accCombined{
parser::Unwrap<parser::OpenACCCombinedConstruct>(*it)}) {
RewriteOpenACCCombinedConstruct(*accCombined, block, it);
} else if (auto *endDir{
parser::Unwrap<parser::AccEndCombinedDirective>(*it)}) {
// Unmatched AccEndCombinedDirective
messages_.Say(endDir->v.source,
"The %s directive must follow the DO loop associated with the "
"loop construct"_err_en_US,
parser::ToUpperCaseLetters(endDir->v.source.ToString()));
}
} // Block list
}
Expand Down Expand Up @@ -73,6 +86,55 @@ class CanonicalizationOfAcc {
parser::ToUpperCaseLetters(dir.source.ToString()));
}

void RewriteOpenACCCombinedConstruct(parser::OpenACCCombinedConstruct &x,
parser::Block &block, parser::Block::iterator it) {
// Check the sequence of DoConstruct in the same iteration
//
// Original:
// ExecutableConstruct -> OpenACCConstruct -> OpenACCCombinedConstruct
// ACCBeginCombinedDirective
// ExecutableConstruct -> DoConstruct
// ExecutableConstruct -> AccEndCombinedDirective (if available)
//
// After rewriting:
// ExecutableConstruct -> OpenACCConstruct -> OpenACCCombinedConstruct
// ACCBeginCombinedDirective
// DoConstruct
// AccEndCombinedDirective (if available)
parser::Block::iterator nextIt;
auto &beginDir{std::get<parser::AccBeginCombinedDirective>(x.t)};
auto &dir{std::get<parser::AccCombinedDirective>(beginDir.t)};

nextIt = it;
if (++nextIt != block.end()) {
if (auto *doCons{parser::Unwrap<parser::DoConstruct>(*nextIt)}) {
if (doCons->GetLoopControl()) {
// move DoConstruct
std::get<std::optional<parser::DoConstruct>>(x.t) =
std::move(*doCons);
nextIt = block.erase(nextIt);
// try to match AccEndCombinedDirective
if (nextIt != block.end()) {
if (auto *endDir{
parser::Unwrap<parser::AccEndCombinedDirective>(*nextIt)}) {
std::get<std::optional<parser::AccEndCombinedDirective>>(x.t) =
std::move(*endDir);
block.erase(nextIt);
}
}
} else {
messages_.Say(dir.source,
"DO loop after the %s directive must have loop control"_err_en_US,
parser::ToUpperCaseLetters(dir.source.ToString()));
}
return; // found do-loop
}
}
messages_.Say(dir.source,
"A DO loop must follow the %s directive"_err_en_US,
parser::ToUpperCaseLetters(dir.source.ToString()));
}

parser::Messages &messages_;
};

Expand Down
12 changes: 10 additions & 2 deletions flang/lib/Semantics/check-acc-structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,17 @@ void AccStructureChecker::Leave(
}

void AccStructureChecker::Enter(const parser::OpenACCCombinedConstruct &x) {
const auto &beginBlockDir{std::get<parser::AccBeginCombinedDirective>(x.t)};
const auto &beginCombinedDir{
std::get<parser::AccBeginCombinedDirective>(x.t)};
const auto &combinedDir{
std::get<parser::AccCombinedDirective>(beginBlockDir.t)};
std::get<parser::AccCombinedDirective>(beginCombinedDir.t)};

// check matching, End directive is optional
if (const auto &endCombinedDir{
std::get<std::optional<parser::AccEndCombinedDirective>>(x.t)}) {
CheckMatching<parser::AccCombinedDirective>(combinedDir, endCombinedDir->v);
}

PushContextAndClauseSets(combinedDir.source, combinedDir.v);
}

Expand Down
16 changes: 16 additions & 0 deletions flang/test/Lower/pre-fir-tree05.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,19 @@ subroutine foo()
end subroutine
! CHECK-NEXT: EndSubroutine foo

! CHECK: Subroutine foo
subroutine foo2()
! CHECK-NEXT: <<OpenACCConstruct>>
!$acc parallel loop
! CHECK-NEXT: <<DoConstruct>>
! CHECK-NEXT: NonLabelDoStmt
do i=1,5
! CHECK-NEXT: EndDoStmt
! CHECK-NEXT: <<End DoConstruct>>
end do
!$acc end parallel loop
! CHECK-NEXT: <<End OpenACCConstruct>>
! CHECK-NEXT: ContinueStmt
end subroutine
! CHECK-NEXT: EndSubroutine foo2

Loading

0 comments on commit 5f4901f

Please sign in to comment.