Skip to content

Commit b4257a3

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:42de2b7e9911 into amd-gfx:9dd93aa266d9
Local branch amd-gfx 9dd93aa Merged main:9084934aa95c into amd-gfx:730349204aab Remote branch main 42de2b7 [SystemZ/z/OS] Add library names for intrinsics (llvm#68114)
2 parents 9dd93aa + 42de2b7 commit b4257a3

File tree

59 files changed

+3223
-2076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3223
-2076
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4589,13 +4589,11 @@ def msve_vector_bits_EQ : Joined<["-"], "msve-vector-bits=">, Group<m_aarch64_Fe
45894589
} // let Flags = [TargetSpecific]
45904590

45914591
def mvscale_min_EQ : Joined<["-"], "mvscale-min=">,
4592-
Group<m_aarch64_Features_Group>, Flags<[NoXarchOption]>,
4593-
Visibility<[ClangOption, CC1Option, FC1Option]>,
4592+
Visibility<[CC1Option, FC1Option]>,
45944593
HelpText<"Specify the vscale minimum. Defaults to \"1\". (AArch64/RISC-V only)">,
45954594
MarshallingInfoInt<LangOpts<"VScaleMin">>;
45964595
def mvscale_max_EQ : Joined<["-"], "mvscale-max=">,
4597-
Group<m_aarch64_Features_Group>, Flags<[NoXarchOption]>,
4598-
Visibility<[ClangOption, CC1Option, FC1Option]>,
4596+
Visibility<[CC1Option, FC1Option]>,
45994597
HelpText<"Specify the vscale maximum. Defaults to the"
46004598
" vector length agnostic value of \"0\". (AArch64/RISC-V only)">,
46014599
MarshallingInfoInt<LangOpts<"VScaleMax">>;

clang/lib/Lex/ModuleMap.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,8 +1551,6 @@ namespace clang {
15511551
/// (or the end of the file).
15521552
void skipUntil(MMToken::TokenKind K);
15531553

1554-
using ModuleId = SmallVector<std::pair<std::string, SourceLocation>, 2>;
1555-
15561554
bool parseModuleId(ModuleId &Id);
15571555
void parseModuleDecl();
15581556
void parseExternModuleDecl();

compiler-rt/include/profile/InstrProfData.inc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -644,17 +644,16 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
644644
(uint64_t)'p' << 40 | (uint64_t)'r' << 32 | (uint64_t)'o' << 24 | \
645645
(uint64_t)'f' << 16 | (uint64_t)'R' << 8 | (uint64_t)129
646646

647-
/* FIXME: Please remedy the fixme in the header before bumping the version. */
648647
/* Raw profile format version (start from 1). */
649648
#define INSTR_PROF_RAW_VERSION 8
650649
/* Indexed profile format version (start from 1). */
651650
#define INSTR_PROF_INDEX_VERSION 10
652651
/* Coverage mapping format version (start from 0). */
653652
#define INSTR_PROF_COVMAP_VERSION 5
654653

655-
/* Profile version is always of type uint64_t. Reserve the upper 8 bits in the
656-
* version for other variants of profile. We set the lowest bit of the upper 8
657-
* bits (i.e. bit 56) to 1 to indicate if this is an IR-level instrumentation
654+
/* Profile version is always of type uint64_t. Reserve the upper 32 bits in the
655+
* version for other variants of profile. We set the 8th most significant bit
656+
* (i.e. bit 56) to 1 to indicate if this is an IR-level instrumentation
658657
* generated profile, and 0 if this is a Clang FE generated profile.
659658
* 1 in bit 57 indicates there are context-sensitive records in the profile.
660659
* The 59th bit indicates whether to use debug info to correlate profiles.
@@ -663,7 +662,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
663662
* The 62nd bit indicates whether memory profile information is present.
664663
* The 63rd bit indicates if this is a temporal profile.
665664
*/
666-
#define VARIANT_MASKS_ALL 0xff00000000000000ULL
665+
#define VARIANT_MASKS_ALL 0xffffffff00000000ULL
667666
#define GET_VERSION(V) ((V) & ~VARIANT_MASKS_ALL)
668667
#define VARIANT_MASK_IR_PROF (0x1ULL << 56)
669668
#define VARIANT_MASK_CSIR_PROF (0x1ULL << 57)

flang/lib/Semantics/check-omp-structure.cpp

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,7 @@ bool OmpStructureChecker::IsOperatorValid(const T &node, const D &variable) {
17341734
}
17351735
return common::HasMember<T, AllowedBinaryOperators>;
17361736
}
1737-
return true;
1737+
return false;
17381738
}
17391739

17401740
void OmpStructureChecker::CheckAtomicCaptureStmt(
@@ -1780,9 +1780,12 @@ void OmpStructureChecker::CheckAtomicUpdateStmt(
17801780
const parser::AssignmentStmt &assignment) {
17811781
const auto &expr{std::get<parser::Expr>(assignment.t)};
17821782
const auto &var{std::get<parser::Variable>(assignment.t)};
1783+
bool isIntrinsicProcedure{false};
1784+
bool isValidOperator{false};
17831785
common::visit(
17841786
common::visitors{
17851787
[&](const common::Indirection<parser::FunctionReference> &x) {
1788+
isIntrinsicProcedure = true;
17861789
const auto &procedureDesignator{
17871790
std::get<parser::ProcedureDesignator>(x.value().v.t)};
17881791
const parser::Name *name{
@@ -1794,46 +1797,61 @@ void OmpStructureChecker::CheckAtomicUpdateStmt(
17941797
context_.Say(expr.source,
17951798
"Invalid intrinsic procedure name in "
17961799
"OpenMP ATOMIC (UPDATE) statement"_err_en_US);
1797-
} else if (name) {
1798-
bool foundMatch{false};
1799-
if (auto varDesignatorIndirection =
1800-
std::get_if<Fortran::common::Indirection<
1801-
Fortran::parser::Designator>>(&var.u)) {
1802-
const auto &varDesignator = varDesignatorIndirection->value();
1803-
if (const auto *dataRef = std::get_if<Fortran::parser::DataRef>(
1804-
&varDesignator.u)) {
1805-
if (const auto *name =
1806-
std::get_if<Fortran::parser::Name>(&dataRef->u)) {
1807-
const auto &varSymbol = *name->symbol;
1808-
if (const auto *e{GetExpr(context_, expr)}) {
1809-
for (const Symbol &symbol :
1810-
evaluate::CollectSymbols(*e)) {
1811-
if (symbol == varSymbol) {
1812-
foundMatch = true;
1813-
break;
1814-
}
1815-
}
1816-
}
1817-
}
1818-
}
1819-
}
1820-
if (!foundMatch) {
1821-
context_.Say(expr.source,
1822-
"Atomic update variable '%s' not found in the "
1823-
"argument list of intrinsic procedure"_err_en_US,
1824-
var.GetSource().ToString());
1825-
}
18261800
}
18271801
},
18281802
[&](const auto &x) {
18291803
if (!IsOperatorValid(x, var)) {
18301804
context_.Say(expr.source,
1831-
"Invalid operator in OpenMP ATOMIC (UPDATE) "
1805+
"Invalid or missing operator in atomic update "
18321806
"statement"_err_en_US);
1833-
}
1807+
} else
1808+
isValidOperator = true;
18341809
},
18351810
},
18361811
expr.u);
1812+
if (const auto *e{GetExpr(context_, expr)}) {
1813+
const auto *v{GetExpr(context_, var)};
1814+
if (e->Rank() != 0)
1815+
context_.Say(expr.source,
1816+
"Expected scalar expression "
1817+
"on the RHS of atomic update assignment "
1818+
"statement"_err_en_US);
1819+
if (v->Rank() != 0)
1820+
context_.Say(var.GetSource(),
1821+
"Expected scalar variable "
1822+
"on the LHS of atomic update assignment "
1823+
"statement"_err_en_US);
1824+
const Symbol &varSymbol = evaluate::GetSymbolVector(*v).front();
1825+
int numOfSymbolMatches{0};
1826+
SymbolVector exprSymbols = evaluate::GetSymbolVector(*e);
1827+
for (const Symbol &symbol : exprSymbols) {
1828+
if (varSymbol == symbol)
1829+
numOfSymbolMatches++;
1830+
}
1831+
if (isIntrinsicProcedure) {
1832+
std::string varName = var.GetSource().ToString();
1833+
if (numOfSymbolMatches != 1)
1834+
context_.Say(expr.source,
1835+
"Intrinsic procedure"
1836+
" arguments in atomic update statement"
1837+
" must have exactly one occurence of '%s'"_err_en_US,
1838+
varName);
1839+
else if (varSymbol != exprSymbols.front() &&
1840+
varSymbol != exprSymbols.back())
1841+
context_.Say(expr.source,
1842+
"Atomic update statement "
1843+
"should be of the form `%s = intrinsic_procedure(%s, expr_list)` "
1844+
"OR `%s = intrinsic_procedure(expr_list, %s)`"_err_en_US,
1845+
varName, varName, varName, varName);
1846+
} else if (isValidOperator) {
1847+
if (numOfSymbolMatches != 1)
1848+
context_.Say(expr.source,
1849+
"Exactly one occurence of '%s' "
1850+
"expected on the RHS of atomic update assignment statement"_err_en_US,
1851+
var.GetSource().ToString());
1852+
}
1853+
}
1854+
18371855
ErrIfAllocatableVariable(var);
18381856
}
18391857

flang/test/Lower/OpenMP/FIR/atomic-update.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ program OmpAtomicUpdate
6969
!CHECK: ^bb0(%[[ARG:.*]]: i32):
7070
!CHECK: %[[LOADED_X:.*]] = fir.load %[[X]] : !fir.ref<i32>
7171
!CHECK: %[[LOADED_Z:.*]] = fir.load %[[Z]] : !fir.ref<i32>
72-
!CHECK: %{{.*}} = arith.cmpi sgt, %[[LOADED_X]], %[[ARG]] : i32
73-
!CHECK: %{{.*}} = arith.select %{{.*}}, %[[LOADED_X]], %[[ARG]] : i32
72+
!CHECK: %{{.*}} = arith.cmpi sgt, %[[ARG]], %[[LOADED_X]] : i32
73+
!CHECK: %{{.*}} = arith.select %{{.*}}, %[[ARG]], %[[LOADED_X]] : i32
7474
!CHECK: %{{.*}} = arith.cmpi sgt, %{{.*}}, %[[LOADED_Z]] : i32
7575
!CHECK: %[[RESULT:.*]] = arith.select %{{.*}}, %{{.*}}, %[[LOADED_Z]] : i32
7676
!CHECK: omp.yield(%[[RESULT]] : i32)
@@ -84,7 +84,7 @@ program OmpAtomicUpdate
8484
!$omp atomic relaxed update hint(omp_sync_hint_uncontended)
8585
x = x - 1
8686
!$omp atomic update relaxed
87-
y = max(x, y, z)
87+
y = max(y, x, z)
8888
!$omp atomic relaxed hint(omp_sync_hint_contended)
8989
z = z + x
9090

0 commit comments

Comments
 (0)