Skip to content

Commit c3d22d0

Browse files
authored
Merge branch 'main' into users/rampitec/09-17-_amdgpu_add_gfx1251_runlines_to_cooperative_atomcis_tests._nfc
2 parents 1b3d480 + 7fb3a91 commit c3d22d0

File tree

23 files changed

+151
-89
lines changed

23 files changed

+151
-89
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6839,10 +6839,11 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
68396839
// though they were unknown attributes.
68406840
if (AL.getKind() == ParsedAttr::UnknownAttribute ||
68416841
!AL.existsInTarget(S.Context.getTargetInfo())) {
6842-
if (AL.isRegularKeywordAttribute() || AL.isDeclspecAttribute()) {
6843-
S.Diag(AL.getLoc(), AL.isRegularKeywordAttribute()
6844-
? diag::err_keyword_not_supported_on_target
6845-
: diag::warn_unhandled_ms_attribute_ignored)
6842+
if (AL.isRegularKeywordAttribute()) {
6843+
S.Diag(AL.getLoc(), diag::err_keyword_not_supported_on_target)
6844+
<< AL.getAttrName() << AL.getRange();
6845+
} else if (AL.isDeclspecAttribute()) {
6846+
S.Diag(AL.getLoc(), diag::warn_unhandled_ms_attribute_ignored)
68466847
<< AL.getAttrName() << AL.getRange();
68476848
} else {
68486849
S.DiagnoseUnknownAttribute(AL);

clang/lib/Sema/SemaStmtAttr.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,11 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A,
672672
!(A.existsInTarget(S.Context.getTargetInfo()) ||
673673
(S.Context.getLangOpts().SYCLIsDevice && Aux &&
674674
A.existsInTarget(*Aux)))) {
675-
if (A.isRegularKeywordAttribute() || A.isDeclspecAttribute()) {
676-
S.Diag(A.getLoc(), A.isRegularKeywordAttribute()
677-
? diag::err_keyword_not_supported_on_target
678-
: diag::warn_unhandled_ms_attribute_ignored)
675+
if (A.isRegularKeywordAttribute()) {
676+
S.Diag(A.getLoc(), diag::err_keyword_not_supported_on_target)
677+
<< A << A.getRange();
678+
} else if (A.isDeclspecAttribute()) {
679+
S.Diag(A.getLoc(), diag::warn_unhandled_ms_attribute_ignored)
679680
<< A << A.getRange();
680681
} else {
681682
S.DiagnoseUnknownAttribute(A);

llvm/include/llvm/BinaryFormat/ELF.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,12 @@ enum : unsigned {
932932
// Processor selection mask for EF_CUDA_SM* values prior to blackwell.
933933
EF_CUDA_SM = 0xff,
934934

935+
// Processor selection mask for EF_CUDA_SM* values following blackwell.
936+
EF_CUDA_SM_MASK = 0xff00,
937+
938+
// Processor selection mask for EF_CUDA_SM* values following blackwell.
939+
EF_CUDA_SM_OFFSET = 8,
940+
935941
// SM based processor values.
936942
EF_CUDA_SM20 = 0x14,
937943
EF_CUDA_SM21 = 0x15,
@@ -951,9 +957,15 @@ enum : unsigned {
951957
EF_CUDA_SM80 = 0x50,
952958
EF_CUDA_SM86 = 0x56,
953959
EF_CUDA_SM87 = 0x57,
960+
EF_CUDA_SM88 = 0x58,
954961
EF_CUDA_SM89 = 0x59,
955-
// The sm_90a variant uses the same machine flag.
956962
EF_CUDA_SM90 = 0x5a,
963+
EF_CUDA_SM100 = 0x64,
964+
EF_CUDA_SM101 = 0x65,
965+
EF_CUDA_SM103 = 0x67,
966+
EF_CUDA_SM110 = 0x6e,
967+
EF_CUDA_SM120 = 0x78,
968+
EF_CUDA_SM121 = 0x79,
957969

958970
// Unified texture binding is enabled.
959971
EF_CUDA_TEXMODE_UNIFIED = 0x100,
@@ -969,17 +981,7 @@ enum : unsigned {
969981
// Virtual processor selection mask for EF_CUDA_VIRTUAL_SM* values.
970982
EF_CUDA_VIRTUAL_SM = 0xff0000,
971983

972-
// Processor selection mask for EF_CUDA_SM* values following blackwell.
973-
EF_CUDA_SM_MASK = 0xff00,
974-
975-
// SM based processor values.
976-
EF_CUDA_SM100 = 0x6400,
977-
EF_CUDA_SM101 = 0x6500,
978-
EF_CUDA_SM103 = 0x6700,
979-
EF_CUDA_SM120 = 0x7800,
980-
EF_CUDA_SM121 = 0x7900,
981-
982-
// Set when using an accelerator variant like sm_100a.
984+
// Set when using an accelerator variant like sm_100a in the new ABI.
983985
EF_CUDA_ACCELERATORS = 0x8,
984986
};
985987

llvm/include/llvm/IR/PatternMatch.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ template <typename Val, typename Pattern> bool match(Val *V, const Pattern &P) {
5050
return P.match(V);
5151
}
5252

53+
template <typename Val, typename Pattern> struct MatchFunctor {
54+
const Pattern &P;
55+
MatchFunctor(const Pattern &P) : P(P) {}
56+
bool operator()(Val *V) const { return P.match(V); }
57+
};
58+
59+
/// A match functor that can be used as a UnaryPredicate in functional
60+
/// algorithms like all_of.
61+
template <typename Val = const Value, typename Pattern>
62+
MatchFunctor<Val, Pattern> match_fn(const Pattern &P) {
63+
return P;
64+
}
65+
5366
template <typename Pattern> bool match(ArrayRef<int> Mask, const Pattern &P) {
5467
return P.match(Mask);
5568
}

llvm/include/llvm/Support/FormatVariadicDetails.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,14 @@ template <class T> class has_StreamOperator {
7878
using ConstRefT = const std::decay_t<T> &;
7979

8080
template <typename U>
81-
static char test(std::enable_if_t<
82-
std::is_same_v<decltype(std::declval<llvm::raw_ostream &>()
83-
<< std::declval<U>()),
84-
llvm::raw_ostream &>,
85-
int *>);
81+
static auto test(int)
82+
-> std::is_same<decltype(std::declval<llvm::raw_ostream &>()
83+
<< std::declval<U>()),
84+
llvm::raw_ostream &>;
8685

87-
template <typename U> static double test(...);
86+
template <typename U> static auto test(...) -> std::false_type;
8887

89-
static bool const value = (sizeof(test<ConstRefT>(nullptr)) == 1);
88+
static constexpr bool value = decltype(test<ConstRefT>(0))::value;
9089
};
9190

9291
// Simple template that decides whether a type T should use the member-function

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,14 +5057,12 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr,
50575057
}
50585058

50595059
// All-zero GEP is a no-op, unless it performs a vector splat.
5060-
if (Ptr->getType() == GEPTy &&
5061-
all_of(Indices, [](const auto *V) { return match(V, m_Zero()); }))
5060+
if (Ptr->getType() == GEPTy && all_of(Indices, match_fn(m_Zero())))
50625061
return Ptr;
50635062

50645063
// getelementptr poison, idx -> poison
50655064
// getelementptr baseptr, poison -> poison
5066-
if (isa<PoisonValue>(Ptr) ||
5067-
any_of(Indices, [](const auto *V) { return isa<PoisonValue>(V); }))
5065+
if (isa<PoisonValue>(Ptr) || any_of(Indices, IsaPred<PoisonValue>))
50685066
return PoisonValue::get(GEPTy);
50695067

50705068
// getelementptr undef, idx -> undef
@@ -5121,8 +5119,7 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr,
51215119
}
51225120

51235121
if (!IsScalableVec && Q.DL.getTypeAllocSize(LastType) == 1 &&
5124-
all_of(Indices.drop_back(1),
5125-
[](Value *Idx) { return match(Idx, m_Zero()); })) {
5122+
all_of(Indices.drop_back(1), match_fn(m_Zero()))) {
51265123
unsigned IdxWidth =
51275124
Q.DL.getIndexSizeInBits(Ptr->getType()->getPointerAddressSpace());
51285125
if (Q.DL.getTypeSizeInBits(Indices.back()->getType()) == IdxWidth) {
@@ -5152,8 +5149,7 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr,
51525149
}
51535150

51545151
// Check to see if this is constant foldable.
5155-
if (!isa<Constant>(Ptr) ||
5156-
!all_of(Indices, [](Value *V) { return isa<Constant>(V); }))
5152+
if (!isa<Constant>(Ptr) || !all_of(Indices, IsaPred<Constant>))
51575153
return nullptr;
51585154

51595155
if (!ConstantExpr::isSupportedGetElementPtr(SrcTy))
@@ -5691,7 +5687,7 @@ static Constant *simplifyFPOp(ArrayRef<Value *> Ops, FastMathFlags FMF,
56915687
RoundingMode Rounding) {
56925688
// Poison is independent of anything else. It always propagates from an
56935689
// operand to a math result.
5694-
if (any_of(Ops, [](Value *V) { return match(V, m_Poison()); }))
5690+
if (any_of(Ops, IsaPred<PoisonValue>))
56955691
return PoisonValue::get(Ops[0]->getType());
56965692

56975693
for (Value *V : Ops) {
@@ -7155,7 +7151,7 @@ static Value *simplifyInstructionWithOperands(Instruction *I,
71557151

71567152
switch (I->getOpcode()) {
71577153
default:
7158-
if (llvm::all_of(NewOps, [](Value *V) { return isa<Constant>(V); })) {
7154+
if (all_of(NewOps, IsaPred<Constant>)) {
71597155
SmallVector<Constant *, 8> NewConstOps(NewOps.size());
71607156
transform(NewOps, NewConstOps.begin(),
71617157
[](Value *V) { return cast<Constant>(V); });

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,8 @@ bool llvm::haveNoCommonBitsSet(const WithCache<const Value *> &LHSCache,
250250
}
251251

252252
bool llvm::isOnlyUsedInZeroComparison(const Instruction *I) {
253-
return !I->user_empty() && all_of(I->users(), [](const User *U) {
254-
return match(U, m_ICmp(m_Value(), m_Zero()));
255-
});
253+
return !I->user_empty() &&
254+
all_of(I->users(), match_fn(m_ICmp(m_Value(), m_Zero())));
256255
}
257256

258257
bool llvm::isOnlyUsedInZeroEqualityComparison(const Instruction *I) {

llvm/lib/CodeGen/InterleavedAccessPass.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,9 @@ bool InterleavedAccessImpl::lowerInterleavedLoad(
312312
continue;
313313
}
314314
if (auto *BI = dyn_cast<BinaryOperator>(User)) {
315-
if (!BI->user_empty() && all_of(BI->users(), [](auto *U) {
316-
auto *SVI = dyn_cast<ShuffleVectorInst>(U);
317-
return SVI && isa<UndefValue>(SVI->getOperand(1));
318-
})) {
315+
using namespace PatternMatch;
316+
if (!BI->user_empty() &&
317+
all_of(BI->users(), match_fn(m_Shuffle(m_Value(), m_Undef())))) {
319318
for (auto *SVI : BI->users())
320319
BinOpShuffles.insert(cast<ShuffleVectorInst>(SVI));
321320
continue;

llvm/lib/Object/ELFObjectFile.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,8 @@ StringRef ELFObjectFileBase::getNVPTXCPUName() const {
624624
assert(getEMachine() == ELF::EM_CUDA);
625625
unsigned SM = getEIdentABIVersion() == ELF::ELFABIVERSION_CUDA_V1
626626
? getPlatformFlags() & ELF::EF_CUDA_SM
627-
: getPlatformFlags() & ELF::EF_CUDA_SM_MASK;
627+
: (getPlatformFlags() & ELF::EF_CUDA_SM_MASK) >>
628+
ELF::EF_CUDA_SM_OFFSET;
628629

629630
switch (SM) {
630631
// Fermi architecture.
@@ -676,6 +677,8 @@ StringRef ELFObjectFileBase::getNVPTXCPUName() const {
676677
return "sm_86";
677678
case ELF::EF_CUDA_SM87:
678679
return "sm_87";
680+
case ELF::EF_CUDA_SM88:
681+
return "sm_88";
679682

680683
// Ada architecture.
681684
case ELF::EF_CUDA_SM89:
@@ -696,6 +699,9 @@ StringRef ELFObjectFileBase::getNVPTXCPUName() const {
696699
case ELF::EF_CUDA_SM103:
697700
return getPlatformFlags() & ELF::EF_CUDA_ACCELERATORS ? "sm_103a"
698701
: "sm_103";
702+
case ELF::EF_CUDA_SM110:
703+
return getPlatformFlags() & ELF::EF_CUDA_ACCELERATORS ? "sm_110a"
704+
: "sm_110";
699705

700706
// Rubin architecture.
701707
case ELF::EF_CUDA_SM120:

llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,12 +2354,8 @@ Instruction *InstCombinerImpl::visitSub(BinaryOperator &I) {
23542354
// and let's try to sink `(sub 0, b)` into `b` itself. But only if this isn't
23552355
// a pure negation used by a select that looks like abs/nabs.
23562356
bool IsNegation = match(Op0, m_ZeroInt());
2357-
if (!IsNegation || none_of(I.users(), [&I, Op1](const User *U) {
2358-
const Instruction *UI = dyn_cast<Instruction>(U);
2359-
if (!UI)
2360-
return false;
2361-
return match(UI, m_c_Select(m_Specific(Op1), m_Specific(&I)));
2362-
})) {
2357+
if (!IsNegation || none_of(I.users(), match_fn(m_c_Select(m_Specific(Op1),
2358+
m_Specific(&I))))) {
23632359
if (Value *NegOp1 = Negator::Negate(IsNegation, /* IsNSW */ IsNegation &&
23642360
I.hasNoSignedWrap(),
23652361
Op1, *this))

0 commit comments

Comments
 (0)