Skip to content

Commit

Permalink
Merged master:7b774b7cd48 into amd-gfx:9333d68d986
Browse files Browse the repository at this point in the history
Local branch amd-gfx 9333d68 Merged master:170ee645f4d into amd-gfx:817733143d1
Remote branch master 7b774b7 [OPENMP50]Add if clause in teams distribute simd directive.
  • Loading branch information
Sw authored and Sw committed Dec 11, 2019
2 parents 9333d68 + 7b774b7 commit 296f1a2
Show file tree
Hide file tree
Showing 169 changed files with 4,710 additions and 4,119 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticParseKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def warn_null_statement : Warning<

def warn_misleading_indentation : Warning<
"misleading indentation; statement is not part of "
"the previous '%select{if|else|for|while|else if}0'">,
"the previous '%select{if|else|for|while}0'">,
InGroup<MisleadingIndentation>, DefaultIgnore;
def note_previous_statement : Note<
"previous statement is here">;
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Basic/OpenMPKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(aligned)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(safelen)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(simdlen)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(allocate)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(if)

// Clauses allowed for OpenMP directive 'teams distribute parallel for simd'
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(firstprivate)
Expand Down
37 changes: 10 additions & 27 deletions clang/include/clang/Basic/arm_mve.td
Original file line number Diff line number Diff line change
Expand Up @@ -609,30 +609,21 @@ defm vstrhq: scatter_offset_both<!listconcat(T.All16, T.Int32), u16, 1>;
defm vstrwq: scatter_offset_both<T.All32, u32, 2>;
defm vstrdq: scatter_offset_both<T.Int64, u64, 3>;

multiclass PredicatedImmediateVectorShift<
Immediate immtype, string predIntrName, list<dag> unsignedFlag = []> {
foreach predIntr = [IRInt<predIntrName, [Vector, Predicate]>] in {
def _m_n: Intrinsic<Vector, (args Vector:$inactive, Vector:$v,
immtype:$sh, Predicate:$pred),
!con((predIntr $v, $sh), !dag(predIntr, unsignedFlag, ?),
(predIntr $pred, $inactive))>;
def _x_n: Intrinsic<Vector, (args Vector:$v, immtype:$sh,
Predicate:$pred),
!con((predIntr $v, $sh), !dag(predIntr, unsignedFlag, ?),
(predIntr $pred, (undef Vector)))>;
}
}

let params = T.Int in {
def vshlq_n: Intrinsic<Vector, (args Vector:$v, imm_0toNm1:$sh),
(shl $v, (splat (Scalar $sh)))>;
defm vshlq: PredicatedImmediateVectorShift<imm_0toNm1, "shl_imm_predicated">;
defm vshlq: IntrinsicMX<Vector, (args Vector:$v, imm_0toNm1:$sh,
Predicate:$pred),
(IRInt<"shl_imm_predicated", [Vector, Predicate]>
$v, $sh, $pred, $inactive), "_n">;

let pnt = PNT_NType in {
def vshrq_n: Intrinsic<Vector, (args Vector:$v, imm_1toN:$sh),
(immshr $v, $sh, (unsignedflag Scalar))>;
defm vshrq: PredicatedImmediateVectorShift<imm_1toN, "shr_imm_predicated",
[(unsignedflag Scalar)]>;
defm vshrq: IntrinsicMX<Vector, (args Vector:$v, imm_1toN:$sh,
Predicate:$pred),
(IRInt<"shr_imm_predicated", [Vector, Predicate]>
$v, $sh, (unsignedflag Scalar), $pred, $inactive), "_n">;
}
}

Expand Down Expand Up @@ -713,25 +704,17 @@ def vadciq_m: Intrinsic<Vector, (args Vector:$inactive, Vector:$a, Vector:$b,
multiclass VectorComplexAddPred<dag not_halving, dag angle> {
def "" : Intrinsic<Vector, (args Vector:$a, Vector:$b),
(IRInt<"vcaddq", [Vector]> not_halving, angle, $a, $b)>;
def _m : Intrinsic<Vector, (args Vector:$inactive, Vector:$a, Vector:$b,
Predicate:$pred),
defm "" : IntrinsicMX<Vector, (args Vector:$a, Vector:$b, Predicate:$pred),
(IRInt<"vcaddq_predicated", [Vector, Predicate]>
not_halving, angle, $inactive, $a, $b, $pred)>;
def _x : Intrinsic<Vector, (args Vector:$a, Vector:$b, Predicate:$pred),
(IRInt<"vcaddq_predicated", [Vector, Predicate]>
not_halving, angle, (undef Vector), $a, $b, $pred)>;
}

multiclass VectorComplexMulPred<dag angle> {
def "" : Intrinsic<Vector, (args Vector:$a, Vector:$b),
(IRInt<"vcmulq", [Vector]> angle, $a, $b)>;
def _m : Intrinsic<Vector, (args Vector:$inactive, Vector:$a, Vector:$b,
Predicate:$pred),
defm "" : IntrinsicMX<Vector, (args Vector:$a, Vector:$b, Predicate:$pred),
(IRInt<"vcmulq_predicated", [Vector, Predicate]> angle, $inactive, $a, $b,
$pred)>;
def _x : Intrinsic<Vector, (args Vector:$a, Vector:$b, Predicate:$pred),
(IRInt<"vcmulq_predicated", [Vector, Predicate]> angle, (undef Vector), $a,
$b, $pred)>;
}

multiclass VectorComplexMLAPred<dag angle> {
Expand Down
24 changes: 24 additions & 0 deletions clang/include/clang/Basic/arm_mve_defs.td
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,30 @@ class NameOverride<string basename_> {
string basename = basename_;
}

// A wrapper to define both _m and _x versions of a predicated
// intrinsic.
multiclass IntrinsicMX<Type rettype, dag arguments, dag cg,
string nameSuffix = "",
PolymorphicNameType pnt_x = PNT_Type> {
// The _m variant takes an initial parameter called $inactive, which
// provides the input value of the output register, i.e. all the
// inactive lanes in the predicated operation take their values from
// this.
def "_m" # nameSuffix:
Intrinsic<rettype, !con((args rettype:$inactive), arguments), cg>;

// The _x variant leaves off that parameter, and simply uses an
// undef value of the same type.
def "_x" # nameSuffix:
Intrinsic<rettype, arguments, (seq (undef rettype):$inactive, cg)> {
// Allow overriding of the polymorphic name type, because
// sometimes the _m and _x variants polymorph differently
// (typically because the type of the inactive parameter can be
// used as a disambiguator if it's present).
let pnt = pnt_x;
}
}

// -----------------------------------------------------------------------------
// Convenience lists of parameter types. 'T' is just a container record, so you
// can define a typical intrinsic with 'let Params = T.Usual', or similar,
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Basic/OpenMPKinds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,8 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
}
break;
case OMPD_teams_distribute_simd:
if (OpenMPVersion < 50 && CKind == OMPC_if)
return false;
switch (CKind) {
#define OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(Name) \
case OMPC_##Name: \
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,

{
PrettyStackTraceString CrashInfo("Per-function optimization");
llvm::TimeTraceScope TimeScope("PerFunctionPasses", StringRef(""));
llvm::TimeTraceScope TimeScope("PerFunctionPasses");

PerFunctionPasses.doInitialization();
for (Function &F : *TheModule)
Expand All @@ -907,13 +907,13 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,

{
PrettyStackTraceString CrashInfo("Per-module optimization passes");
llvm::TimeTraceScope TimeScope("PerModulePasses", StringRef(""));
llvm::TimeTraceScope TimeScope("PerModulePasses");
PerModulePasses.run(*TheModule);
}

{
PrettyStackTraceString CrashInfo("Code generation");
llvm::TimeTraceScope TimeScope("CodeGenPasses", StringRef(""));
llvm::TimeTraceScope TimeScope("CodeGenPasses");
CodeGenPasses.run(*TheModule);
}

Expand Down Expand Up @@ -1499,7 +1499,7 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
BackendAction Action,
std::unique_ptr<raw_pwrite_stream> OS) {

llvm::TimeTraceScope TimeScope("Backend", StringRef(""));
llvm::TimeTraceScope TimeScope("Backend");

std::unique_ptr<llvm::Module> EmptyModule;
if (!CGOpts.ThinLTOIndexFile.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace clang {

void HandleTranslationUnit(ASTContext &C) override {
{
llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
llvm::TimeTraceScope TimeScope("Frontend");
PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
if (FrontendTimesIsEnabled) {
LLVMIRGenerationRefCount += 1;
Expand Down
8 changes: 7 additions & 1 deletion clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2212,9 +2212,15 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV,
*UnitGV = EmitAnnotationUnit(L),
*LineNoCst = EmitAnnotationLineNo(L);

llvm::Constant *ASZeroGV = GV;
if (GV->getAddressSpace() != 0) {
ASZeroGV = llvm::ConstantExpr::getAddrSpaceCast(
GV, GV->getValueType()->getPointerTo(0));
}

// Create the ConstantStruct for the global annotation.
llvm::Constant *Fields[4] = {
llvm::ConstantExpr::getBitCast(GV, Int8PtrTy),
llvm::ConstantExpr::getBitCast(ASZeroGV, Int8PtrTy),
llvm::ConstantExpr::getBitCast(AnnoGV, Int8PtrTy),
llvm::ConstantExpr::getBitCast(UnitGV, Int8PtrTy),
LineNoCst
Expand Down
5 changes: 3 additions & 2 deletions clang/lib/Frontend/CompilerInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,9 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
if (!hasTarget())
return false;

// Create TargetInfo for the other side of CUDA and OpenMP compilation.
if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) &&
// Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation.
if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice ||
getLangOpts().SYCLIsDevice) &&
!getFrontendOpts().AuxTriple.empty()) {
auto TO = std::make_shared<TargetOptions>();
TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Frontend/InitPreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,8 @@ void clang::InitializePreprocessor(
if (InitOpts.UsePredefines) {
// FIXME: This will create multiple definitions for most of the predefined
// macros. This is not the right way to handle this.
if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) &&
PP.getAuxTargetInfo())
InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
PP.getPreprocessorOpts(), Builder);

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Parse/ParseAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
bool HaveLexer = S.getPreprocessor().getCurrentLexer();

if (HaveLexer) {
llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
llvm::TimeTraceScope TimeScope("Frontend");
P.Initialize();
Parser::DeclGroupPtrTy ADecl;
for (bool AtEOF = P.ParseFirstTopLevelDecl(ADecl); !AtEOF;
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Sema/Sema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,7 @@ void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) {
}

{
llvm::TimeTraceScope TimeScope("PerformPendingInstantiations",
StringRef(""));
llvm::TimeTraceScope TimeScope("PerformPendingInstantiations");
PerformPendingInstantiations();
}

Expand Down
8 changes: 7 additions & 1 deletion clang/lib/Sema/SemaOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4741,6 +4741,8 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
case OMPD_teams_distribute_simd:
Res = ActOnOpenMPTeamsDistributeSimdDirective(
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
if (LangOpts.OpenMP >= 50)
AllowedNameModifiers.push_back(OMPD_simd);
break;
case OMPD_teams_distribute_parallel_for_simd:
Res = ActOnOpenMPTeamsDistributeParallelForSimdDirective(
Expand Down Expand Up @@ -10768,6 +10770,11 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
(NameModifier == OMPD_unknown || NameModifier == OMPD_simd))
CaptureRegion = OMPD_target;
break;
case OMPD_teams_distribute_simd:
if (OpenMPVersion >= 50 &&
(NameModifier == OMPD_unknown || NameModifier == OMPD_simd))
CaptureRegion = OMPD_teams;
break;
case OMPD_cancel:
case OMPD_parallel:
case OMPD_parallel_master:
Expand Down Expand Up @@ -10812,7 +10819,6 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_ordered:
case OMPD_atomic:
case OMPD_teams_distribute:
case OMPD_teams_distribute_simd:
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with if-clause");
case OMPD_unknown:
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Serialization/GlobalModuleIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ GlobalModuleIndex::GlobalModuleIndex(std::unique_ptr<llvm::MemoryBuffer> Buffer,
"' failed: " + toString(std::move(Err)));
};

llvm::TimeTraceScope TimeScope("Module LoadIndex", StringRef(""));
llvm::TimeTraceScope TimeScope("Module LoadIndex");
// Read the global index.
bool InGlobalIndexBlock = false;
bool Done = false;
Expand Down Expand Up @@ -770,7 +770,7 @@ bool GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter &Stream) {
}

using namespace llvm;
llvm::TimeTraceScope TimeScope("Module WriteIndex", StringRef(""));
llvm::TimeTraceScope TimeScope("Module WriteIndex");

// Emit the file header.
Stream.Emit((unsigned)'B', 8);
Expand Down
7 changes: 6 additions & 1 deletion clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ add_clang_library(clangStaticAnalyzerCheckers
CXXSelfAssignmentChecker.cpp
DeadStoresChecker.cpp
DebugCheckers.cpp
DebugIteratorModeling.cpp
DeleteWithNonVirtualDtorChecker.cpp
DereferenceChecker.cpp
DirectIvarAssignment.cpp
Expand All @@ -42,7 +43,10 @@ add_clang_library(clangStaticAnalyzerCheckers
GTestChecker.cpp
IdenticalExprChecker.cpp
InnerPointerChecker.cpp
IteratorChecker.cpp
InvalidatedIteratorChecker.cpp
Iterator.cpp
IteratorModeling.cpp
IteratorRangeChecker.cpp
IvarInvalidationChecker.cpp
LLVMConventionsChecker.cpp
LocalizationChecker.cpp
Expand All @@ -51,6 +55,7 @@ add_clang_library(clangStaticAnalyzerCheckers
MallocChecker.cpp
MallocOverflowSecurityChecker.cpp
MallocSizeofChecker.cpp
MismatchedIteratorChecker.cpp
MmapWriteExecChecker.cpp
MIGChecker.cpp
MoveChecker.cpp
Expand Down
Loading

0 comments on commit 296f1a2

Please sign in to comment.