From 58e04598036f8f77582865a81143fa8f559ba6cc Mon Sep 17 00:00:00 2001 From: "John F. Carr" Date: Sun, 10 Jul 2022 14:45:12 -0400 Subject: [PATCH] Merge reducer destructor callback into reduce callback. --- clang/include/clang/AST/ASTContext.h | 6 +++--- clang/include/clang/AST/Type.h | 11 ++++------- clang/include/clang/AST/TypeProperties.td | 5 +---- .../include/clang/Basic/DiagnosticParseKinds.td | 2 +- clang/include/clang/Sema/DeclSpec.h | 6 ++---- clang/include/clang/Sema/Sema.h | 2 +- clang/lib/AST/ASTContext.cpp | 16 +++++++--------- clang/lib/AST/ASTStructuralEquivalence.cpp | 5 +---- clang/lib/AST/Type.cpp | 16 ++++++---------- clang/lib/AST/TypePrinter.cpp | 5 ----- clang/lib/CodeGen/CGDecl.cpp | 7 ++----- clang/lib/CodeGen/CGDeclCXX.cpp | 2 +- clang/lib/CodeGen/CodeGenFunction.h | 1 - clang/lib/Parse/ParseDecl.cpp | 7 ++----- clang/lib/Sema/SemaType.cpp | 9 +++------ clang/lib/Sema/TreeTransform.h | 11 ++++------- clang/test/Cilk/hyper-errors.c | 4 ++-- clang/test/Cilk/hyper-global-c.c | 2 +- clang/test/Cilk/hyper-global-ctor-dtor.cpp | 2 +- clang/test/Cilk/hyper-global-ctor-only.cpp | 2 +- clang/test/Cilk/hyper-global-dtor-only.cpp | 2 +- clang/test/Cilk/stream-compat.cpp | 4 +--- llvm/include/llvm/IR/Intrinsics.td | 3 +-- llvm/lib/Transforms/Tapir/OpenCilkABI.cpp | 4 ++-- 24 files changed, 48 insertions(+), 86 deletions(-) diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index d0831cf64df2..fb13fb4e2a33 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -1321,9 +1321,9 @@ class ASTContext : public RefCountedBase { return CanQualType::CreateUnsafe(getComplexType((QualType) T)); } - QualType getHyperobjectType(QualType T, Expr *R, Expr *I, Expr *D) const; - CanQualType getHyperobjectType(CanQualType T, Expr *R, Expr *I, Expr *D) const { - return CanQualType::CreateUnsafe(getHyperobjectType((QualType) T, R, I, D)); + QualType getHyperobjectType(QualType T, Expr *R, Expr *I) const; + CanQualType getHyperobjectType(CanQualType T, Expr *R, Expr *I) const { + return CanQualType::CreateUnsafe(getHyperobjectType((QualType) T, R, I)); } /// Return the uniqued reference to the type for a pointer to diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index d19581bff639..319111c81801 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -6395,14 +6395,13 @@ class HyperobjectType final : public Type, public llvm::FoldingSetNode { friend class ASTContext; QualType ElementType; - Expr *Identity, *Reduce, *Destroy; - const FunctionDecl *IdentityID, *ReduceID, *DestroyID; + Expr *Identity, *Reduce; + const FunctionDecl *IdentityID, *ReduceID; bool Bare; HyperobjectType(QualType Element, QualType CanonicalPtr, Expr *i, const FunctionDecl *ifn, - Expr *r, const FunctionDecl *rfn, - Expr *d, const FunctionDecl *dfn); + Expr *r, const FunctionDecl *rfn); public: QualType getElementType() const { return ElementType; } @@ -6411,7 +6410,6 @@ class HyperobjectType final : public Type, public llvm::FoldingSetNode { Expr *getIdentity() const { return Identity; } Expr *getReduce() const { return Reduce; } - Expr *getDestroy() const { return Destroy; } bool hasCallbacks() const { return !Bare; } @@ -6422,8 +6420,7 @@ class HyperobjectType final : public Type, public llvm::FoldingSetNode { static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee, const FunctionDecl *I, - const FunctionDecl *R, - const FunctionDecl *D); + const FunctionDecl *R); static bool classof(const Type *T) { return T->getTypeClass() == Hyperobject; diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td index bcd8b91a7913..3d5d128ea9c9 100644 --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -27,12 +27,9 @@ let Class = HyperobjectType in { def : Property<"identity", ExprRef> { let Read = [{ node->getIdentity() }]; } - def : Property<"destroy", ExprRef> { - let Read = [{ node->getDestroy() }]; - } def : Creator<[{ - return ctx.getHyperobjectType(elementType, reduce, identity, destroy); + return ctx.getHyperobjectType(elementType, reduce, identity); }]>; } diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 0c056d14d73d..9b52340756f1 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1315,7 +1315,7 @@ def warn_pragma_cilk_grainsize_equals: Warning< "'#pragma cilk grainsize' no longer requires '='">, InGroup; def error_hyperobject_arguments: Error< - "hyperobject must have 0, 2, or 3 callbacks">; + "hyperobject must have 0 or 2 callbacks">; // OpenMP support. def warn_pragma_omp_ignored : Warning< diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h index 046fb14982ce..719acf10c082 100644 --- a/clang/include/clang/Sema/DeclSpec.h +++ b/clang/include/clang/Sema/DeclSpec.h @@ -1549,11 +1549,10 @@ struct DeclaratorChunk { struct HyperobjectTypeInfo { SourceLocation LParenLoc; SourceLocation RParenLoc; - Expr *Arg[3]; + Expr *Arg[2]; void destroy() { Arg[0] = nullptr; Arg[1] = nullptr; - Arg[2] = nullptr; } }; @@ -1700,7 +1699,7 @@ struct DeclaratorChunk { SourceLocation Loc, SourceLocation LParen, SourceLocation RParen, - Expr *E0, Expr *E1, Expr *E2) { + Expr *E0, Expr *E1) { DeclaratorChunk I; I.Kind = Hyperobject; I.Loc = Loc; @@ -1708,7 +1707,6 @@ struct DeclaratorChunk { I.Hyper.RParenLoc = RParen; I.Hyper.Arg[0] = E0; I.Hyper.Arg[1] = E1; - I.Hyper.Arg[2] = E2; return I; } diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 22788cc34f04..8a1efa001a67 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -1997,7 +1997,7 @@ class Sema final { QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc); QualType BuildHyperobjectType(QualType Element, Expr *Identity, Expr *Reduce, - Expr *Destroy, SourceLocation Loc); + SourceLocation Loc); QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc); diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 815eeddfffe5..535a8d2e0641 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -3267,26 +3267,24 @@ static const FunctionDecl *getFunction(Expr *E) { return F->getFirstDecl(); } -QualType ASTContext::getHyperobjectType(QualType T, Expr *I, Expr *R, Expr *D) const { - assert(I && R && D); +QualType ASTContext::getHyperobjectType(QualType T, Expr *I, Expr *R) const { + assert(I && R); bool IN = HyperobjectType::isNullish(I); bool RN = HyperobjectType::isNullish(R); - bool DN = HyperobjectType::isNullish(D); const FunctionDecl *IF = getFunction(I); const FunctionDecl *RF = getFunction(R); - const FunctionDecl *DF = getFunction(D); - bool Varies = (!IN && !IF) || (!RN && !RF) || (!DN && !DF); + bool Varies = (!IN && !IF) || (!RN && !RF); QualType Canonical; if (!T.isCanonical()) - Canonical = getHyperobjectType(getCanonicalType(T), I, R, D); + Canonical = getHyperobjectType(getCanonicalType(T), I, R); // Do not unique hyperobject types with variable expressions. if (Varies) { auto *New = new (*this, TypeAlignment) - HyperobjectType(T, Canonical, I, IF, R, RF, D, DF); + HyperobjectType(T, Canonical, I, IF, R, RF); Types.push_back(New); return QualType(New, 0); } @@ -3295,7 +3293,7 @@ QualType ASTContext::getHyperobjectType(QualType T, Expr *I, Expr *R, Expr *D) c // structure. // TODO: 0 and nullptr are not properly treated as equivalent here. llvm::FoldingSetNodeID ID; - HyperobjectType::Profile(ID, T, IF, RF, DF); + HyperobjectType::Profile(ID, T, IF, RF); void *InsertPos = nullptr; if (HyperobjectType *HT = HyperobjectTypes.FindNodeOrInsertPos(ID, InsertPos)) @@ -3303,7 +3301,7 @@ QualType ASTContext::getHyperobjectType(QualType T, Expr *I, Expr *R, Expr *D) c auto *New = new (*this, TypeAlignment) - HyperobjectType(T, Canonical, I, IF, R, RF, D, DF); + HyperobjectType(T, Canonical, I, IF, R, RF); Types.push_back(New); HyperobjectTypes.InsertNode(New, InsertPos); return QualType(New, 0); diff --git a/clang/lib/AST/ASTStructuralEquivalence.cpp b/clang/lib/AST/ASTStructuralEquivalence.cpp index 49b861bc8aa4..c80e6cdd297f 100644 --- a/clang/lib/AST/ASTStructuralEquivalence.cpp +++ b/clang/lib/AST/ASTStructuralEquivalence.cpp @@ -708,15 +708,12 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, const HyperobjectType *H2 = cast(T2); Expr *R1 = H1->getReduce(), *R2 = H2->getReduce(); Expr *I1 = H1->getIdentity(), *I2 = H2->getIdentity(); - Expr *D1 = H1->getDestroy(), *D2 = H2->getDestroy(); - if (!!I2 != !!I2 || !!R1 != !!R2 || !!D1 != !!D2) + if (!!I2 != !!I2 || !!R1 != !!R2) return false; if (I1 && !IsStructurallyEquivalent(Context, I1, I2)) return false; if (R1 && !IsStructurallyEquivalent(Context, R1, R2)) return false; - if (D1 && !IsStructurallyEquivalent(Context, D1, D2)) - return false; if (!IsStructurallyEquivalent(Context, cast(T1)->getElementType(), cast(T2)->getElementType())) diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index b63fa7cbcd03..44cdb3d4d60c 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -3164,29 +3164,25 @@ bool HyperobjectType::isNullish(Expr *E) { HyperobjectType::HyperobjectType(QualType Element, QualType CanonicalPtr, Expr *i, const FunctionDecl *ifn, - Expr *r, const FunctionDecl *rfn, - Expr *d, const FunctionDecl *dfn) + Expr *r, const FunctionDecl *rfn) : Type(Hyperobject, CanonicalPtr, Element->getDependence()), - ElementType(Element), Identity(i), Reduce(r), Destroy(d), - IdentityID(ifn), ReduceID(rfn), DestroyID(dfn), - Bare(isNullish(i) && isNullish(r) && isNullish(d)) { + ElementType(Element), Identity(i), Reduce(r), + IdentityID(ifn), ReduceID(rfn), + Bare(isNullish(i) && isNullish(r)) { } void HyperobjectType::Profile(llvm::FoldingSetNodeID &ID) const { - Profile(ID, getElementType(), IdentityID, ReduceID, DestroyID); + Profile(ID, getElementType(), IdentityID, ReduceID); } void HyperobjectType::Profile(llvm::FoldingSetNodeID &ID, QualType Pointee, - const FunctionDecl *I, const FunctionDecl *R, - const FunctionDecl *D) { + const FunctionDecl *I, const FunctionDecl *R) { ID.AddPointer(Pointee.getAsOpaquePtr()); // In normal use both I and R will be non-null or neither of them will be. if (I) ID.AddPointer(I); if (R) ID.AddPointer(R); - if (D) - ID.AddPointer(D); } StringRef FunctionType::getNameForCallConv(CallingConv CC) { diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index fd5025365885..e24c9b9bd029 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -393,15 +393,10 @@ void TypePrinter::printHyperobjectBefore(const HyperobjectType *T, if (T->hasCallbacks()) { Expr *I = T->getIdentity(); Expr *R = T->getReduce(); - Expr *D = T->getDestroy(); OS << '('; I->printPretty(OS, nullptr, Policy); OS << ", "; R->printPretty(OS, nullptr, Policy); - if (!HyperobjectType::isNullish(D)) { - OS << ", "; - D->printPretty(OS, nullptr, Policy); - } OS << ")"; } } diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 4a343efd4225..ee5984e87ff5 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1810,7 +1810,6 @@ bool CodeGenFunction::getReducer(const VarDecl *D, ReducerCallbacks &CB) { if (H->hasCallbacks()) { CB.Identity = H->getIdentity(); CB.Reduce = H->getReduce(); - CB.Destroy = H->getDestroy(); return true; } } @@ -1836,7 +1835,6 @@ void CodeGenFunction::EmitReducerInit(const VarDecl *D, llvm::Value *Addr) { RValue Identity = EmitAnyExpr(C.Identity); RValue Reduce = EmitAnyExpr(C.Reduce); - RValue Destroy = EmitAnyExpr(C.Destroy); llvm::Type *SizeType = ConvertType(getContext().getSizeType()); unsigned SizeBits = SizeType->getIntegerBitWidth(); @@ -1858,8 +1856,7 @@ void CodeGenFunction::EmitReducerInit(const VarDecl *D, CGM.getIntrinsic(llvm::Intrinsic::reducer_register, Types); llvm::Value *IdentityV = Identity.getScalarVal(); llvm::Value *ReduceV = Reduce.getScalarVal(); - llvm::Value *DestroyV = Destroy.getScalarVal(); - Builder.CreateCall(F, {Addr, Size, IdentityV, ReduceV, DestroyV}); + Builder.CreateCall(F, {Addr, Size, IdentityV, ReduceV}); } void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { @@ -1872,7 +1869,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { auto DL = ApplyDebugLocation::CreateDefaultArtificial(*this, D.getLocation()); QualType type = D.getType(); - ReducerCallbacks RCB = {0, 0, 0}; + ReducerCallbacks RCB = {0, 0}; bool Reducer = false; if (const HyperobjectType *H = type->getAs()) { type = H->getElementType(); diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index ce5dc763551d..ff34bcddb4bf 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -821,7 +821,7 @@ void CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn, EmitCXXGlobalVarDeclInit(*D, Addr, PerformInit); } - ReducerCallbacks RCB = {0, 0, 0}; + ReducerCallbacks RCB = {0, 0}; if (getReducer(D, RCB)) { llvm::Value *Addr = Builder.CreateBitCast(CGM.GetAddrOfGlobalVar(D, nullptr), CGM.VoidPtrTy); diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 011040cb8fb3..2b8b814a7aca 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -3675,7 +3675,6 @@ class CodeGenFunction : public CodeGenTypeCache { struct ReducerCallbacks { Expr *Identity; Expr *Reduce; - Expr *Destroy; }; bool getReducer(const VarDecl *D, ReducerCallbacks &CB); diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 286fcc984f95..3c58d159dfa7 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -5880,7 +5880,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, ParseTypeQualifierListOpt(DS, AR_GNUAttributesParsedAndRejected, true, !D.mayOmitIdentifier()); - Expr *Reduce = nullptr, *Identity = nullptr, *Destroy = nullptr; + Expr *Reduce = nullptr, *Identity = nullptr; if (Tok.is(tok::l_paren)) { SourceLocation Open = ConsumeParen(); // Eat the parenthesis SmallVector Args; @@ -5907,9 +5907,6 @@ void Parser::ParseDeclaratorInternal(Declarator &D, switch (Args.size()) { case 0: break; - case 3: - Destroy = Args[2]; - LLVM_FALLTHROUGH; case 2: Identity = Args[0]; Reduce = Args[1]; @@ -5931,7 +5928,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, D.AddTypeInfo(DeclaratorChunk::getHyperobject( DS.getTypeQualifiers(), Loc, SourceLocation(), SourceLocation(), - Identity, Reduce, Destroy), + Identity, Reduce), std::move(DS.getAttributes()), SourceLocation()); else Diag(Loc, diag::attribute_requires_cilk) << Kind; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index bd47c94f8645..6ad1b019cf04 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -2401,8 +2401,7 @@ Expr *Sema::ValidateReducerCallback(Expr *E, unsigned NumArgs, } QualType Sema::BuildHyperobjectType(QualType Element, Expr *Identity, - Expr *Reduce, Expr *Destroy, - SourceLocation Loc) { + Expr *Reduce, SourceLocation Loc) { QualType Result = Element; if (!RequireCompleteType(Loc, Element, CompleteTypeKind::Normal, diag::incomplete_hyperobject)) { @@ -2412,12 +2411,11 @@ QualType Sema::BuildHyperobjectType(QualType Element, Expr *Identity, Identity = ValidateReducerCallback(Identity, 1, Loc); Reduce = ValidateReducerCallback(Reduce, 2, Loc); - Destroy = ValidateReducerCallback(Destroy, 1, Loc); // The result of this function must be HyperobjectType if it is called // from C++ template instantiation when rebuilding an existing hyperobject // type. - return Context.getHyperobjectType(Result, Identity, Reduce, Destroy); + return Context.getHyperobjectType(Result, Identity, Reduce); } /// Build a Read-only Pipe type. @@ -5714,8 +5712,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, case DeclaratorChunk::Hyperobject: { T = S.BuildHyperobjectType(T, DeclType.Hyper.Arg[0], - DeclType.Hyper.Arg[1], DeclType.Hyper.Arg[2], - DeclType.Loc); + DeclType.Hyper.Arg[1], DeclType.Loc); break; } } diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index ec831030b701..cecd9f190610 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -1211,7 +1211,7 @@ class TreeTransform { SourceLocation Loc); QualType RebuildHyperobjectType(QualType ElementType, Expr *R, - Expr *I, Expr *D, SourceLocation Loc); + Expr *I, SourceLocation Loc); /// Build a new template name given a nested name specifier, a flag /// indicating whether the "template" keyword was provided, and the template @@ -5009,9 +5009,8 @@ QualType TreeTransform::TransformHyperobjectType SemaRef, Sema::ExpressionEvaluationContext::PotentiallyEvaluated); NewR = getDerived().TransformExpr(H->getReduce()); NewI = getDerived().TransformExpr(H->getIdentity()); - NewD = getDerived().TransformExpr(H->getDestroy()); } - if (NewR.isInvalid() || NewI.isInvalid() || NewD.isInvalid()) + if (NewR.isInvalid() || NewI.isInvalid()) return QualType(); QualType ElementType = getDerived().TransformType(TLB, TL.getPointeeLoc()); @@ -5020,8 +5019,7 @@ QualType TreeTransform::TransformHyperobjectType QualType Result = getDerived().RebuildHyperobjectType(ElementType, NewI.get(), - NewR.get(), NewD.get(), - TL.getHyperLoc()); + NewR.get(), TL.getHyperLoc()); HyperobjectTypeLoc NewT = TLB.push(Result); NewT.setHyperLoc(TL.getHyperLoc()); @@ -14693,9 +14691,8 @@ QualType TreeTransform::RebuildDependentBitIntType( template QualType TreeTransform::RebuildHyperobjectType(QualType ElementType, Expr *I, Expr *R, - Expr *D, SourceLocation Loc) { - return SemaRef.BuildHyperobjectType(ElementType, I, R, D, Loc); + return SemaRef.BuildHyperobjectType(ElementType, I, R, Loc); } template diff --git a/clang/test/Cilk/hyper-errors.c b/clang/test/Cilk/hyper-errors.c index e19b1345061e..1bcd0bdbf60b 100644 --- a/clang/test/Cilk/hyper-errors.c +++ b/clang/test/Cilk/hyper-errors.c @@ -25,6 +25,6 @@ int _Hyperobject(reduce, identity) h; // expected-error@-2{{incompatible function pointer types passing 'void (*)(void *)' to parameter of type 'void (*)(void *, void *)'}} int _Hyperobject(x) i; // expected-error{{use of undeclared identifier 'x'}} -int _Hyperobject(0) j; // expected-error{{hyperobject must have 0, 2, or 3 callbacks}} -int _Hyperobject(0,0,0,0) k; // expected-error{{hyperobject must have 0, 2, or 3 callbacks}} +int _Hyperobject(0) j; // expected-error{{hyperobject must have 0 or 2 callbacks}} +int _Hyperobject(0,0,0,0) k; // expected-error{{hyperobject must have 0 or 2 callbacks}} int _Hyperobject(0, 1) x; // expected-error{{incompatible integer to pointer conversion passing 'int' to parameter of type 'void (*)(void *, void *)'}} diff --git a/clang/test/Cilk/hyper-global-c.c b/clang/test/Cilk/hyper-global-c.c index 6181ae6f98ef..cc696910b928 100644 --- a/clang/test/Cilk/hyper-global-c.c +++ b/clang/test/Cilk/hyper-global-c.c @@ -8,6 +8,6 @@ void reduce_long(void *l, void *r); // CHECK-LABEL: cxx_global_var_init // CHECK: store i64 1, i64* @global // CHECK: call void @llvm.reducer.register.i64 -long _Hyperobject(identity_long, reduce_long, 0) global = 1; +long _Hyperobject(identity_long, reduce_long) global = 1; // CHECK: call void @llvm.reducer.unregister diff --git a/clang/test/Cilk/hyper-global-ctor-dtor.cpp b/clang/test/Cilk/hyper-global-ctor-dtor.cpp index 5ca360f9ceaf..d544f0123b67 100644 --- a/clang/test/Cilk/hyper-global-ctor-dtor.cpp +++ b/clang/test/Cilk/hyper-global-ctor-dtor.cpp @@ -9,7 +9,7 @@ void reduce_S(void *l, void *r); // CHECK-LABEL: cxx_global_var_init // CHECK: call void @_ZN1SC1Ei(%struct.S* noundef nonnull align 4 dereferenceable(4) @global, i32 noundef 1) // CHECK: call void @llvm.reducer.register.i64 -S _Hyperobject(identity_S, reduce_S, 0) global(1); +S _Hyperobject(identity_S, reduce_S) global(1); // CHECK: call void @llvm.reducer.unregister // CHECK: call void @_ZN1SD1Ev diff --git a/clang/test/Cilk/hyper-global-ctor-only.cpp b/clang/test/Cilk/hyper-global-ctor-only.cpp index 2c45a7e10943..0cb4644fd7b8 100644 --- a/clang/test/Cilk/hyper-global-ctor-only.cpp +++ b/clang/test/Cilk/hyper-global-ctor-only.cpp @@ -9,7 +9,7 @@ void reduce_S(void *l, void *r); // CHECK-LABEL: cxx_global_var_init // CHECK: call void @_ZN1SC1Ei(%struct.S* noundef nonnull align 4 dereferenceable(4) @global, i32 noundef 1) // CHECK: call void @llvm.reducer.register.i64 -S _Hyperobject(identity_S, reduce_S, 0) global = 1; +S _Hyperobject(identity_S, reduce_S) global = 1; // CHECK: call void @llvm.reducer.unregister // CHECK-NOT: _ZN1SD1Ev diff --git a/clang/test/Cilk/hyper-global-dtor-only.cpp b/clang/test/Cilk/hyper-global-dtor-only.cpp index e0329aab2153..c8f03b09beea 100644 --- a/clang/test/Cilk/hyper-global-dtor-only.cpp +++ b/clang/test/Cilk/hyper-global-dtor-only.cpp @@ -8,7 +8,7 @@ void reduce_S(void *l, void *r); // CHECK-LABEL: __cxx_global_var_init // CHECK: call void @llvm.reducer.register.i64 -S _Hyperobject(identity_S, reduce_S, 0) global; +S _Hyperobject(identity_S, reduce_S) global; // CHECK: call void @llvm.reducer.unregister // CHECK: call void @_ZN1SD1Ev diff --git a/clang/test/Cilk/stream-compat.cpp b/clang/test/Cilk/stream-compat.cpp index 2715452c60a4..8a407cd7059d 100644 --- a/clang/test/Cilk/stream-compat.cpp +++ b/clang/test/Cilk/stream-compat.cpp @@ -7,14 +7,12 @@ class ostream_view { void reduce(ostream_view* other); static void reduce(void *left_v, void *right_v); static void identity(void *view); - static void destruct(void *view); }; template using ostream_reducer = ostream_view _Hyperobject(&ostream_view::identity, - &ostream_view::reduce, - &ostream_view::destruct); + &ostream_view::reduce); void f() { diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td index 9e43428bd25b..8c8aaf3a36da 100644 --- a/llvm/include/llvm/IR/Intrinsics.td +++ b/llvm/include/llvm/IR/Intrinsics.td @@ -1392,8 +1392,7 @@ def int_hyper_lookup // TODO: Change tablegen to allow function pointer types in intrinsics. def int_reducer_register - : Intrinsic<[], [llvm_ptr_ty, llvm_anyint_ty, llvm_ptr_ty, - llvm_ptr_ty, llvm_ptr_ty], + : Intrinsic<[], [llvm_ptr_ty, llvm_anyint_ty, llvm_ptr_ty, llvm_ptr_ty], [IntrWillReturn, IntrInaccessibleMemOnly, IntrReducerRegister]>; def int_reducer_unregister diff --git a/llvm/lib/Transforms/Tapir/OpenCilkABI.cpp b/llvm/lib/Transforms/Tapir/OpenCilkABI.cpp index b9e72a00ed89..f810a98f661e 100644 --- a/llvm/lib/Transforms/Tapir/OpenCilkABI.cpp +++ b/llvm/lib/Transforms/Tapir/OpenCilkABI.cpp @@ -227,10 +227,10 @@ void OpenCilkABI::prepareModule() { FunctionType *UnregTy = FunctionType::get(VoidTy, {VoidPtrTy}, false); FunctionType *Reg32Ty = FunctionType::get(VoidTy, {VoidPtrTy, Int32Ty, VoidPtrTy, - VoidPtrTy, VoidPtrTy}, false); + VoidPtrTy}, false); FunctionType *Reg64Ty = FunctionType::get(VoidTy, {VoidPtrTy, Int64Ty, VoidPtrTy, - VoidPtrTy, VoidPtrTy}, false); + VoidPtrTy}, false); // Create an array of CilkRTS functions, with their associated types and // FunctionCallee member variables in the OpenCilkABI class.