Skip to content

Commit 900fd66

Browse files
committed
New runtime interface for reducer lookup
1 parent 0502352 commit 900fd66

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5434,13 +5434,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
54345434
return RValue::get(Builder.CreateCall(FF, {}));
54355435
}
54365436
case Builtin::BI__hyper_lookup: {
5437+
Function *TF = CGM.getIntrinsic(Intrinsic::tapir_frame);
5438+
llvm::Value *Frame = Builder.CreateCall(TF, {});
54375439
llvm::Value *Size = EmitScalarExpr(E->getArg(1));
54385440
Function *F = CGM.getIntrinsic(Intrinsic::hyper_lookup, Size->getType());
54395441
llvm::Value *Ptr = EmitScalarExpr(E->getArg(0));
54405442
llvm::Value *Identity = EmitScalarExpr(E->getArg(2));
54415443
llvm::Value *Reduce = EmitScalarExpr(E->getArg(3));
54425444
return RValue::get(Builder.CreateCall(
5443-
F, {Ptr, Size, Builder.CreateBitCast(Identity, VoidPtrTy),
5445+
F, {Frame, Ptr, Size, Builder.CreateBitCast(Identity, VoidPtrTy),
54445446
Builder.CreateBitCast(Reduce, VoidPtrTy)}));
54455447
}
54465448
}

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,8 @@ def int_tapir_frame
14401440
// but that does not work, so rely on the front end to insert bitcasts.
14411441
def int_hyper_lookup
14421442
: Intrinsic<[llvm_ptr_ty],
1443-
[llvm_ptr_ty, llvm_anyint_ty, llvm_ptr_ty, llvm_ptr_ty], [
1443+
[llvm_ptr_ty, llvm_ptr_ty, llvm_anyint_ty,
1444+
llvm_ptr_ty, llvm_ptr_ty], [
14441445
IntrWillReturn, IntrReadMem, IntrInaccessibleMemOnly,
14451446
IntrStrandPure, IntrHyperView, IntrInjective
14461447
]>;

llvm/lib/Transforms/Tapir/OpenCilkABI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ void OpenCilkABI::prepareModule() {
226226
FunctionType *Grainsize16FnTy = FunctionType::get(Int16Ty, {Int16Ty}, false);
227227
FunctionType *Grainsize32FnTy = FunctionType::get(Int32Ty, {Int32Ty}, false);
228228
FunctionType *Grainsize64FnTy = FunctionType::get(Int64Ty, {Int64Ty}, false);
229-
FunctionType *LookupTy = FunctionType::get(
230-
VoidPtrTy, {VoidPtrTy, Int64Ty, VoidPtrTy, VoidPtrTy}, false);
229+
FunctionType *LookupTy = FunctionType::get(VoidPtrTy,
230+
{StackFramePtrTy, VoidPtrTy, Int64Ty, VoidPtrTy, VoidPtrTy}, false);
231231
FunctionType *UnregTy = FunctionType::get(VoidTy, {VoidPtrTy}, false);
232232
FunctionType *Reg32Ty =
233233
FunctionType::get(VoidTy, {VoidPtrTy, Int32Ty, VoidPtrTy,
@@ -262,7 +262,7 @@ void OpenCilkABI::prepareModule() {
262262
CilkRTSCilkForGrainsize32},
263263
{"__cilkrts_cilk_for_grainsize_64", Grainsize64FnTy,
264264
CilkRTSCilkForGrainsize64},
265-
{"__cilkrts_reducer_lookup", LookupTy, CilkRTSReducerLookup},
265+
{"__cilkrts_reducer_lookup_in_frame", LookupTy, CilkRTSReducerLookup},
266266
{"__cilkrts_reducer_register_32", Reg32Ty, CilkRTSReducerRegister32},
267267
{"__cilkrts_reducer_register_64", Reg64Ty, CilkRTSReducerRegister64},
268268
{"__cilkrts_reducer_unregister", UnregTy, CilkRTSReducerUnregister},

0 commit comments

Comments
 (0)