Skip to content

Commit 15b8dd9

Browse files
committed
Make Injective and HyperView parameter attributes
instead of function attributes. Rewrite Tapir alias analysis to be more independent of BasicAliasAnalysis. In the future it should be a separate alias analysis pass. Add __tapir_frame builtin to get current frame descriptor. Pass __tapir_frame as an argument to hyperobject view lookup. Remove never-used hyper_token builtin and intrinsic.
1 parent 9ce0f85 commit 15b8dd9

26 files changed

+414
-375
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4156,21 +4156,14 @@ def StrandMalloc : InheritableAttr {
41564156
}
41574157

41584158
def Injective : InheritableAttr {
4159-
// TODO: Associate this with a single argument, not the function.
41604159
let Spellings = [Clang<"injective">];
4161-
let Subjects = SubjectList<[Function]>;
4160+
let Subjects = SubjectList<[ParmVar]>;
41624161
let Documentation = [Undocumented];
41634162
}
41644163

41654164
def HyperView : InheritableAttr {
41664165
let Spellings = [Clang<"hyper_view">];
4167-
let Subjects = SubjectList<[FunctionLike]>;
4168-
let Documentation = [StrandMallocDocs];
4169-
}
4170-
4171-
def HyperToken : InheritableAttr {
4172-
let Spellings = [Clang<"hyper_token">];
4173-
let Subjects = SubjectList<[FunctionLike]>;
4166+
let Subjects = SubjectList<[ParmVar]>;
41744167
let Documentation = [StrandMallocDocs];
41754168
}
41764169

clang/include/clang/Basic/Builtins.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,8 @@ BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
17211721
// Arithmetic Fence: to prevent FP reordering and reassociation optimizations
17221722
LANGBUILTIN(__arithmetic_fence, "v.", "tE", ALL_LANGUAGES)
17231723

1724+
BUILTIN(__tapir_frame, "v*", "n")
1725+
17241726
// Tapir. Rewriting of reducer references happens during sema
17251727
// and needs a builtin to carry the information to codegen.
17261728
BUILTIN(__hyper_lookup, "v*vC*z.", "nU")

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5429,15 +5429,27 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
54295429
Str.getPointer(), Zeros);
54305430
return RValue::get(Ptr);
54315431
}
5432+
case Builtin::BI__tapir_frame: {
5433+
Function *FF = CGM.getIntrinsic(Intrinsic::tapir_frame);
5434+
return RValue::get(Builder.CreateCall(FF, {}));
5435+
}
54325436
case Builtin::BI__hyper_lookup: {
5437+
Function *TF = CGM.getIntrinsic(Intrinsic::tapir_frame);
5438+
llvm::Value *Frame = Builder.CreateCall(TF, {});
54335439
llvm::Value *Size = EmitScalarExpr(E->getArg(1));
54345440
Function *F = CGM.getIntrinsic(Intrinsic::hyper_lookup, Size->getType());
54355441
llvm::Value *Ptr = EmitScalarExpr(E->getArg(0));
54365442
llvm::Value *Identity = EmitScalarExpr(E->getArg(2));
54375443
llvm::Value *Reduce = EmitScalarExpr(E->getArg(3));
5438-
return RValue::get(Builder.CreateCall(
5439-
F, {Ptr, Size, Builder.CreateBitCast(Identity, VoidPtrTy),
5440-
Builder.CreateBitCast(Reduce, VoidPtrTy)}));
5444+
CallInst *Call =
5445+
Builder.CreateCall(F,
5446+
{Frame, Ptr, Size,
5447+
Builder.CreateBitCast(Identity, VoidPtrTy),
5448+
Builder.CreateBitCast(Reduce, VoidPtrTy)});
5449+
// TODO: These should be added automatically based on the function type.
5450+
Call->addParamAttr(1, Attribute::Injective);
5451+
Call->addParamAttr(1, Attribute::HyperView);
5452+
return RValue::get(Call);
54415453
}
54425454
}
54435455
IsSpawnedScope SpawnedScp(this);

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9364,9 +9364,6 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
93649364
case ParsedAttr::AT_HyperView:
93659365
handleSimpleAttribute<HyperViewAttr>(S, D, AL);
93669366
break;
9367-
case ParsedAttr::AT_HyperToken:
9368-
handleSimpleAttribute<HyperTokenAttr>(S, D, AL);
9369-
break;
93709367
case ParsedAttr::AT_ReducerUnregister:
93719368
handleSimpleAttribute<ReducerUnregisterAttr>(S, D, AL);
93729369
break;

clang/test/Cilk/hyper-array-extern-1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int read_array_hyper(unsigned i)
1010
{
1111
return x[i];
1212
// CHECK: %[[ARRAYIDX:.+]] = getelementptr inbounds
13-
// CHECK: %[[VIEWRAW:.+]] = call ptr @llvm.hyper.lookup.i64(ptr %[[ARRAYIDX]], i64 4, ptr null, ptr null)
13+
// CHECK: %[[VIEWRAW:.+]] = call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective %[[ARRAYIDX]], i64 4, ptr null, ptr null)
1414
// CHECK-NOT: call ptr @llvm.hyper.lookup
1515
// CHECK: %[[VAL:.+]] = load i32, ptr %[[VIEWRAW]]
1616
// CHECK: ret i32 %[[VAL]]

clang/test/Cilk/hyper-assign.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ extern long _Hyperobject x, _Hyperobject y;
66

77
long chain_assign()
88
{
9-
// CHECK: %[[Y1RAW:.+]] = call ptr @llvm.hyper.lookup.i64(ptr @y, i64 8, ptr null, ptr null)
9+
// CHECK: %[[Y1RAW:.+]] = call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @y, i64 8, ptr null, ptr null)
1010
// CHECK: %[[Y1VAL:.+]] = load i64, ptr %[[Y1RAW]]
11-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 8, ptr null, ptr null)
11+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 8, ptr null, ptr null)
1212
// CHECK: store i64 %[[Y1VAL]]
13-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @y, i64 8, ptr null, ptr null)
14-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 8, ptr null, ptr null)
13+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @y, i64 8, ptr null, ptr null)
14+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 8, ptr null, ptr null)
1515
return x = y = x = y;
1616
}
1717

1818
long simple_assign(long val)
1919
{
20-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 8, ptr null, ptr null)
20+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 8, ptr null, ptr null)
2121
// CHECK-NOT: call ptr @llvm.hyper.lookup
2222
// CHECK: store i64
2323
return x = val;
@@ -26,11 +26,11 @@ long simple_assign(long val)
2626
long subtract()
2727
{
2828
// The order is not fixed here.
29-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @y, i64 8, ptr null, ptr null)
29+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @y, i64 8, ptr null, ptr null)
3030
// CHECK: load i64
3131
// CHECK: add nsw i64 %[[Y:.+]], 1
3232
// CHECK: store i64
33-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 8, ptr null, ptr null)
33+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 8, ptr null, ptr null)
3434
// CHECK: load i64
3535
// CHECK: sub nsw
3636
// CHECK: store i64

clang/test/Cilk/hyper-complex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern __complex__ float _Hyperobject c;
77
// CHECK-LABEL: get_real
88
float get_real()
99
{
10-
// CHECK: %[[RAW1:.+]] = call ptr @llvm.hyper.lookup.i64(ptr @c, i64 8, ptr null, ptr null)
10+
// CHECK: %[[RAW1:.+]] = call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @c, i64 8, ptr null, ptr null)
1111
// CHECK: %[[FIELD1:.+]] = getelementptr inbounds { float, float }, ptr %[[RAW1]], i32 0, i32 0
1212
// CHECK: %[[RET1:.+]] = load float, ptr %[[FIELD1]]
1313
// CHECK: ret float %[[RET1]]
@@ -16,7 +16,7 @@ float get_real()
1616
// CHECK-LABEL: get_imag
1717
float get_imag()
1818
{
19-
// CHECK: %[[RAW2:.+]] = call ptr @llvm.hyper.lookup.i64(ptr @c, i64 8, ptr null, ptr null)
19+
// CHECK: %[[RAW2:.+]] = call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @c, i64 8, ptr null, ptr null)
2020
// CHECK: %[[FIELD2:.+]] = getelementptr inbounds { float, float }, ptr %[[RAW2]], i32 0, i32 1
2121
// CHECK: load float, ptr %[[FIELD2]]
2222
// CHECK: ret float
@@ -27,7 +27,7 @@ float get_imag()
2727
float get_abs()
2828
{
2929
// Only one call to llvm.hyper.lookup.
30-
// CHECK: @llvm.hyper.lookup.i64(ptr @c, i64 8, ptr null, ptr null)
30+
// CHECK: @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @c, i64 8, ptr null, ptr null)
3131
// CHECK-NOT: @llvm.hyper.lookup
3232
// CHECK: call float @cabsf
3333
// CHECK: ret float

clang/test/Cilk/hyper-copy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ extern struct S b __attribute__((aligned(8)));
99
// CHECK-LABEL: scopy
1010
void scopy()
1111
{
12-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @a, i64 8, ptr null, ptr null)
12+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @a, i64 8, ptr null, ptr null)
1313
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 @b,
14-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @a, i64 8, ptr null, ptr null)
14+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @a, i64 8, ptr null, ptr null)
1515
// CHECK: call void @llvm.memcpy.p0.p0.i64
1616
// CHECK: ret void
1717
b = a;

clang/test/Cilk/hyper-template.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ template<typename T> struct S { T member; };
55
S<long> _Hyperobject S_long;
66

77
// CHECK-LABEL: @_Z1fv
8-
// CHECK: %0 = call ptr @llvm.hyper.lookup.i64(ptr @S_long, i64 8, ptr null, ptr null)
8+
// CHECK: %0 = call ptr @llvm.tapir.frame()
9+
// CHECK: %1 = call ptr @llvm.hyper.lookup.i64(ptr %0, ptr hyper_view injective @S_long, i64 8, ptr null, ptr null)
910
// CHECK-NOT: call ptr @llvm.hyper.lookup
1011
// CHECK: getelementptr
1112
// CHECK: %[[RET:.+]] = load i64

clang/test/Cilk/hyper-unary.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ void function1()
1111
{
1212
// CHECK: store i32 1, ptr %[[Y:.+]],
1313
int _Hyperobject y = 1;
14-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 4, ptr null, ptr null)
14+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 4, ptr null, ptr null)
1515
// CHECK: load i32
16-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %[[Y]], i64 4, ptr null, ptr null)
16+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective %[[Y]], i64 4, ptr null, ptr null)
1717
// CHECK: load i32
1818
(void)x; (void)y;
1919
}
@@ -23,9 +23,9 @@ void function2()
2323
{
2424
// CHECK: store i32 1, ptr %[[Y:.+]],
2525
int _Hyperobject y = 1;
26-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 4, ptr null, ptr null)
26+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 4, ptr null, ptr null)
2727
// CHECK: load i32
28-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %[[Y]], i64 4, ptr null, ptr null)
28+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective %[[Y]], i64 4, ptr null, ptr null)
2929
// CHECK: load i32
3030
(void)!x; (void)!y;
3131
}
@@ -35,18 +35,18 @@ void function3()
3535
{
3636
// CHECK: store i32 1, ptr %[[Y:.+]],
3737
int _Hyperobject y = 1;
38-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 4, ptr null, ptr null)
38+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 4, ptr null, ptr null)
3939
// CHECK: load i32
40-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %[[Y]], i64 4, ptr null, ptr null)
40+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective %[[Y]], i64 4, ptr null, ptr null)
4141
// CHECK: load i32
4242
(void)-x; (void)-y;
43-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr @x, i64 4, ptr null, ptr null)
43+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective @x, i64 4, ptr null, ptr null)
4444
// CHECK: load i32
45-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %[[Y]], i64 4, ptr null, ptr null)
45+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective %[[Y]], i64 4, ptr null, ptr null)
4646
// CHECK: load i32
4747
(void)~x; (void)~y;
4848
// CHECK: %[[XP:.+]] = load ptr, ptr @xp
49-
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %[[XP]], i64 4, ptr null, ptr null)
49+
// CHECK: call ptr @llvm.hyper.lookup.i64(ptr %{{[0-9]+}}, ptr hyper_view injective %[[XP]], i64 4, ptr null, ptr null)
5050
// CHECK: load i32
5151
(void)*xp;
5252
}

clang/test/Cilk/tapir-frame.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %clang_cc1 %s -x c -O1 -fopencilk -mllvm -use-opencilk-runtime-bc=false -mllvm -debug-abi-calls=true -verify -S -emit-llvm -o - | FileCheck %s
2+
// expected-no-diagnostics
3+
4+
// CHECK-LABEL: zero
5+
int zero()
6+
{
7+
return __tapir_frame() != 0;
8+
// CHECK: ret i32 0
9+
}
10+
11+
// CHECK-LABEL: one
12+
int one()
13+
{
14+
extern void f(int);
15+
_Cilk_spawn f(0);
16+
_Cilk_spawn f(1);
17+
// CHECK: ret i32 1
18+
return __tapir_frame() != 0;
19+
}
20+
21+
// CHECK-LABEL: function3
22+
int function3()
23+
{
24+
extern void f(int);
25+
extern int g(void *);
26+
_Cilk_spawn f(0);
27+
// CHECK: call i32 @g(ptr noundef nonnull %__cilkrts_sf)
28+
return g(__tapir_frame());
29+
}

clang/test/Misc/pragma-attribute-supported-attributes-list.test

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@
7474
// CHECK-NEXT: GNUInline (SubjectMatchRule_function)
7575
// CHECK-NEXT: HIPManaged (SubjectMatchRule_variable)
7676
// CHECK-NEXT: Hot (SubjectMatchRule_function)
77-
// CHECK-NEXT: HyperToken (SubjectMatchRule_hasType_functionType)
78-
// CHECK-NEXT: HyperView (SubjectMatchRule_hasType_functionType)
77+
// CHECK-NEXT: HyperView (SubjectMatchRule_variable_is_parameter)
7978
// CHECK-NEXT: IBAction (SubjectMatchRule_objc_method_is_instance)
8079
// CHECK-NEXT: IFunc (SubjectMatchRule_function)
8180
// CHECK-NEXT: InitPriority (SubjectMatchRule_variable)
82-
// CHECK-NEXT: Injective (SubjectMatchRule_function)
81+
// CHECK-NEXT: Injective (SubjectMatchRule_variable_is_parameter)
8382
// CHECK-NEXT: InternalLinkage (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record)
8483
// CHECK-NEXT: LTOVisibilityPublic (SubjectMatchRule_record)
8584
// CHECK-NEXT: Leaf (SubjectMatchRule_function)

llvm/include/llvm/Analysis/BasicAliasAnalysis.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,19 @@ class BasicAAResult : public AAResultBase {
137137
AliasResult aliasCheck(const Value *V1, LocationSize V1Size, const Value *V2,
138138
LocationSize V2Size, AAQueryInfo &AAQI,
139139
const Instruction *CtxI);
140+
AliasResult aliasCheckTapir(const Value *V1, const Value *V2,
141+
LocationSize Size, AAQueryInfo &AAQI,
142+
const Instruction *CtxI);
140143

141144
AliasResult aliasCheckRecursive(const Value *V1, LocationSize V1Size,
142145
const Value *V2, LocationSize V2Size,
143146
AAQueryInfo &AAQI, const Value *O1,
144147
const Value *O2);
145148

146-
AliasResult checkInjectiveArguments(const Value *V1, const Value *O1,
147-
const Value *V2, const Value *O2,
149+
const Value *getViewClass(const CallBase *V, AAQueryInfo &AAQI);
150+
AliasResult checkInjectiveArguments(const CallBase *C1, const CallBase *C2,
148151
AAQueryInfo &AAQI);
152+
149153
};
150154

151155
/// Analysis pass providing a never-invalidated alias analysis result.

llvm/include/llvm/IR/Attributes.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def FnRetThunkExtern : EnumAttr<"fn_ret_thunk_extern", [FnAttr]>;
107107
def InAlloca : TypeAttr<"inalloca", [ParamAttr]>;
108108

109109
/// Distinct arguments to this function yield distinct return values.
110-
def Injective : EnumAttr<"injective", [FnAttr]>;
110+
def Injective : EnumAttr<"injective", [ParamAttr]>;
111111

112112
/// Source said inlining was desirable.
113113
def InlineHint : EnumAttr<"inlinehint", [FnAttr]>;
@@ -216,7 +216,7 @@ def ReadNone : EnumAttr<"readnone", [ParamAttr]>;
216216
def ReadOnly : EnumAttr<"readonly", [ParamAttr]>;
217217

218218
/// Tapir reducer-related attributes.
219-
def HyperView : EnumAttr<"hyper_view", [FnAttr]>;
219+
def HyperView : EnumAttr<"hyper_view", [ParamAttr]>;
220220
def ReducerRegister : EnumAttr<"reducer_register", [FnAttr]>;
221221
def ReducerUnregister : EnumAttr<"reducer_unregister", [FnAttr]>;
222222

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,10 @@ def Commutative : IntrinsicProperty;
6060
// Throws - This intrinsic can throw.
6161
def Throws : IntrinsicProperty;
6262

63-
// Injective - This intrinsic returns different values given different
64-
// arguments.
65-
def IntrInjective : IntrinsicProperty;
6663
// Strand pure - (Tapir) This intrinsic has no visible side effects and
6764
// returns the same result given the same argument, but only within a
6865
// single strand of execution.
6966
def IntrStrandPure : IntrinsicProperty;
70-
// HyperView - (Tapir) This intrinsic lowers to a runtime call to
71-
// find the address of the current view of a hyperobject. It does not
72-
// return the address of anything in the current frame other than its
73-
// argument.
74-
def IntrHyperView : IntrinsicProperty;
7567
// ReducerRegister / ReducerUnregister - (Tapir) This intrinsic registers
7668
// or unregisters a reducer. These calls have no side effects on visible
7769
// memory but can not be moved past other reducer and hyperobject calls
@@ -92,6 +84,22 @@ class NoCapture<AttrIndex idx> : IntrinsicProperty {
9284
int ArgNo = idx.Value;
9385
}
9486

87+
// Injective - This intrinsic returns different values given different
88+
// arguments.
89+
class IntrInjective<AttrIndex idx> : IntrinsicProperty {
90+
int ArgNo = idx.Value;
91+
int Align = 1;
92+
}
93+
94+
// HyperView - (Tapir) This intrinsic lowers to a runtime call to
95+
// find the address of the current view of a hyperobject. It does not
96+
// return the address of anything in the current frame other than its
97+
// argument.
98+
class IntrHyperView<AttrIndex idx> : IntrinsicProperty {
99+
int ArgNo = idx.Value;
100+
int Align = 1;
101+
}
102+
95103
// NoAlias - The specified argument pointer is not aliasing other "noalias" pointer
96104
// arguments of the intrinsic wrt. the intrinsic scope.
97105
class NoAlias<AttrIndex idx> : IntrinsicProperty {
@@ -1430,25 +1438,33 @@ def int_tapir_loop_grainsize
14301438
// lowering transforms this intrinsic into ordinary frameaddress
14311439
// intrinsics.
14321440
def int_task_frameaddress
1433-
: Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrWillReturn]>;
1441+
: Intrinsic<[llvm_ptr_ty], [llvm_i32_ty],
1442+
[IntrWillReturn,IntrStrandPure]>;
1443+
1444+
// Return the stack_frame in an OpenCilk function, otherwise null.
1445+
def int_tapir_frame
1446+
: Intrinsic<[llvm_ptr_ty], [], [IntrWillReturn,IntrReadMem,IntrStrandPure]>;
14341447

14351448
// Ideally the types would be [llvm_anyptr_ty], [LLVMMatchType<0>]
14361449
// but that does not work, so rely on the front end to insert bitcasts.
14371450
def int_hyper_lookup
14381451
: Intrinsic<[llvm_ptr_ty],
1439-
[llvm_ptr_ty, llvm_anyint_ty, llvm_ptr_ty, llvm_ptr_ty], [
1452+
[llvm_ptr_ty, llvm_ptr_ty, llvm_anyint_ty,
1453+
llvm_ptr_ty, llvm_ptr_ty], [
1454+
NonNull<RetIndex>, NonNull<ArgIndex<1>>,
14401455
IntrWillReturn, IntrReadMem, IntrInaccessibleMemOnly,
1441-
IntrStrandPure, IntrHyperView, IntrInjective
1442-
]>;
1456+
IntrStrandPure, IntrHyperView<ArgIndex<1>>,
1457+
IntrInjective<ArgIndex<1>>]>; // Dereferenceable,
14431458

14441459
// TODO: Change tablegen to allow function pointer types in intrinsics.
14451460
def int_reducer_register
14461461
: Intrinsic<[], [llvm_ptr_ty, llvm_anyint_ty, llvm_ptr_ty, llvm_ptr_ty],
1447-
[IntrWillReturn, IntrInaccessibleMemOnly, IntrReducerRegister]>;
1462+
[NonNull<ArgIndex<0>>, IntrWillReturn, IntrInaccessibleMemOnly,
1463+
IntrReducerRegister]>;
14481464

14491465
def int_reducer_unregister
1450-
: Intrinsic<[], [llvm_ptr_ty], [IntrWillReturn, IntrInaccessibleMemOnly,
1451-
IntrReducerUnregister]>;
1466+
: Intrinsic<[], [llvm_ptr_ty], [NonNull<ArgIndex<0>>, IntrWillReturn,
1467+
IntrInaccessibleMemOnly, IntrReducerUnregister]>;
14521468

14531469
///===-------------------------- Other Intrinsics --------------------------===//
14541470
//

llvm/include/llvm/Transforms/Tapir/LoweringUtils.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ class TapirTarget {
245245
/// Lower a Tapir sync instruction SI.
246246
virtual void lowerSync(SyncInst &SI) = 0;
247247

248+
virtual void lowerFrameCall(CallBase *Call, DominatorTree &DT) {
249+
}
250+
248251
virtual void lowerReducerOperation(CallBase *Call) {
249252
}
250253

0 commit comments

Comments
 (0)