@@ -2617,7 +2617,7 @@ void OpenMPIRBuilder::emitReductionListCopy(
2617
2617
Expected<Function *> OpenMPIRBuilder::emitInterWarpCopyFunction (
2618
2618
const LocationDescription &Loc, ArrayRef<ReductionInfo> ReductionInfos,
2619
2619
AttributeList FuncAttrs) {
2620
- IRBuilder<>::InsertPointGuard IPG ( Builder);
2620
+ InsertPointTy SavedIP = Builder. saveIP ( );
2621
2621
LLVMContext &Ctx = M.getContext ();
2622
2622
FunctionType *FuncTy = FunctionType::get (
2623
2623
Builder.getVoidTy (), {Builder.getPtrTy (), Builder.getInt32Ty ()},
@@ -2630,7 +2630,6 @@ Expected<Function *> OpenMPIRBuilder::emitInterWarpCopyFunction(
2630
2630
WcFunc->addParamAttr (1 , Attribute::NoUndef);
2631
2631
BasicBlock *EntryBB = BasicBlock::Create (M.getContext (), " entry" , WcFunc);
2632
2632
Builder.SetInsertPoint (EntryBB);
2633
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
2634
2633
2635
2634
// ReduceList: thread local Reduce list.
2636
2635
// At the stage of the computation when this function is called, partially
@@ -2845,6 +2844,7 @@ Expected<Function *> OpenMPIRBuilder::emitInterWarpCopyFunction(
2845
2844
}
2846
2845
2847
2846
Builder.CreateRetVoid ();
2847
+ Builder.restoreIP (SavedIP);
2848
2848
2849
2849
return WcFunc;
2850
2850
}
@@ -2853,7 +2853,6 @@ Function *OpenMPIRBuilder::emitShuffleAndReduceFunction(
2853
2853
ArrayRef<ReductionInfo> ReductionInfos, Function *ReduceFn,
2854
2854
AttributeList FuncAttrs) {
2855
2855
LLVMContext &Ctx = M.getContext ();
2856
- IRBuilder<>::InsertPointGuard IPG (Builder);
2857
2856
FunctionType *FuncTy =
2858
2857
FunctionType::get (Builder.getVoidTy (),
2859
2858
{Builder.getPtrTy (), Builder.getInt16Ty (),
@@ -2872,7 +2871,6 @@ Function *OpenMPIRBuilder::emitShuffleAndReduceFunction(
2872
2871
SarFunc->addParamAttr (3 , Attribute::SExt);
2873
2872
BasicBlock *EntryBB = BasicBlock::Create (M.getContext (), " entry" , SarFunc);
2874
2873
Builder.SetInsertPoint (EntryBB);
2875
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
2876
2874
2877
2875
// Thread local Reduce list used to host the values of data to be reduced.
2878
2876
Argument *ReduceListArg = SarFunc->getArg (0 );
@@ -3019,7 +3017,7 @@ Function *OpenMPIRBuilder::emitShuffleAndReduceFunction(
3019
3017
Function *OpenMPIRBuilder::emitListToGlobalCopyFunction (
3020
3018
ArrayRef<ReductionInfo> ReductionInfos, Type *ReductionsBufferTy,
3021
3019
AttributeList FuncAttrs) {
3022
- IRBuilder<>::InsertPointGuard IPG ( Builder);
3020
+ OpenMPIRBuilder::InsertPointTy OldIP = Builder. saveIP ( );
3023
3021
LLVMContext &Ctx = M.getContext ();
3024
3022
FunctionType *FuncTy = FunctionType::get (
3025
3023
Builder.getVoidTy (),
@@ -3035,7 +3033,6 @@ Function *OpenMPIRBuilder::emitListToGlobalCopyFunction(
3035
3033
3036
3034
BasicBlock *EntryBlock = BasicBlock::Create (Ctx, " entry" , LtGCFunc);
3037
3035
Builder.SetInsertPoint (EntryBlock);
3038
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
3039
3036
3040
3037
// Buffer: global reduction buffer.
3041
3038
Argument *BufferArg = LtGCFunc->getArg (0 );
@@ -3123,13 +3120,14 @@ Function *OpenMPIRBuilder::emitListToGlobalCopyFunction(
3123
3120
}
3124
3121
3125
3122
Builder.CreateRetVoid ();
3123
+ Builder.restoreIP (OldIP);
3126
3124
return LtGCFunc;
3127
3125
}
3128
3126
3129
3127
Function *OpenMPIRBuilder::emitListToGlobalReduceFunction (
3130
3128
ArrayRef<ReductionInfo> ReductionInfos, Function *ReduceFn,
3131
3129
Type *ReductionsBufferTy, AttributeList FuncAttrs) {
3132
- IRBuilder<>::InsertPointGuard IPG ( Builder);
3130
+ OpenMPIRBuilder::InsertPointTy OldIP = Builder. saveIP ( );
3133
3131
LLVMContext &Ctx = M.getContext ();
3134
3132
FunctionType *FuncTy = FunctionType::get (
3135
3133
Builder.getVoidTy (),
@@ -3145,7 +3143,6 @@ Function *OpenMPIRBuilder::emitListToGlobalReduceFunction(
3145
3143
3146
3144
BasicBlock *EntryBlock = BasicBlock::Create (Ctx, " entry" , LtGRFunc);
3147
3145
Builder.SetInsertPoint (EntryBlock);
3148
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
3149
3146
3150
3147
// Buffer: global reduction buffer.
3151
3148
Argument *BufferArg = LtGRFunc->getArg (0 );
@@ -3206,13 +3203,14 @@ Function *OpenMPIRBuilder::emitListToGlobalReduceFunction(
3206
3203
Builder.CreateCall (ReduceFn, {LocalReduceListAddrCast, ReduceList})
3207
3204
->addFnAttr (Attribute::NoUnwind);
3208
3205
Builder.CreateRetVoid ();
3206
+ Builder.restoreIP (OldIP);
3209
3207
return LtGRFunc;
3210
3208
}
3211
3209
3212
3210
Function *OpenMPIRBuilder::emitGlobalToListCopyFunction (
3213
3211
ArrayRef<ReductionInfo> ReductionInfos, Type *ReductionsBufferTy,
3214
3212
AttributeList FuncAttrs) {
3215
- IRBuilder<>::InsertPointGuard IPG ( Builder);
3213
+ OpenMPIRBuilder::InsertPointTy OldIP = Builder. saveIP ( );
3216
3214
LLVMContext &Ctx = M.getContext ();
3217
3215
FunctionType *FuncTy = FunctionType::get (
3218
3216
Builder.getVoidTy (),
@@ -3228,7 +3226,6 @@ Function *OpenMPIRBuilder::emitGlobalToListCopyFunction(
3228
3226
3229
3227
BasicBlock *EntryBlock = BasicBlock::Create (Ctx, " entry" , LtGCFunc);
3230
3228
Builder.SetInsertPoint (EntryBlock);
3231
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
3232
3229
3233
3230
// Buffer: global reduction buffer.
3234
3231
Argument *BufferArg = LtGCFunc->getArg (0 );
@@ -3314,13 +3311,14 @@ Function *OpenMPIRBuilder::emitGlobalToListCopyFunction(
3314
3311
}
3315
3312
3316
3313
Builder.CreateRetVoid ();
3314
+ Builder.restoreIP (OldIP);
3317
3315
return LtGCFunc;
3318
3316
}
3319
3317
3320
3318
Function *OpenMPIRBuilder::emitGlobalToListReduceFunction (
3321
3319
ArrayRef<ReductionInfo> ReductionInfos, Function *ReduceFn,
3322
3320
Type *ReductionsBufferTy, AttributeList FuncAttrs) {
3323
- IRBuilder<>::InsertPointGuard IPG ( Builder);
3321
+ OpenMPIRBuilder::InsertPointTy OldIP = Builder. saveIP ( );
3324
3322
LLVMContext &Ctx = M.getContext ();
3325
3323
auto *FuncTy = FunctionType::get (
3326
3324
Builder.getVoidTy (),
@@ -3336,7 +3334,6 @@ Function *OpenMPIRBuilder::emitGlobalToListReduceFunction(
3336
3334
3337
3335
BasicBlock *EntryBlock = BasicBlock::Create (Ctx, " entry" , LtGRFunc);
3338
3336
Builder.SetInsertPoint (EntryBlock);
3339
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
3340
3337
3341
3338
// Buffer: global reduction buffer.
3342
3339
Argument *BufferArg = LtGRFunc->getArg (0 );
@@ -3397,6 +3394,7 @@ Function *OpenMPIRBuilder::emitGlobalToListReduceFunction(
3397
3394
Builder.CreateCall (ReduceFn, {ReduceList, ReductionList})
3398
3395
->addFnAttr (Attribute::NoUnwind);
3399
3396
Builder.CreateRetVoid ();
3397
+ Builder.restoreIP (OldIP);
3400
3398
return LtGRFunc;
3401
3399
}
3402
3400
@@ -3409,7 +3407,6 @@ std::string OpenMPIRBuilder::getReductionFuncName(StringRef Name) const {
3409
3407
Expected<Function *> OpenMPIRBuilder::createReductionFunction (
3410
3408
StringRef ReducerName, ArrayRef<ReductionInfo> ReductionInfos,
3411
3409
ReductionGenCBKind ReductionGenCBKind, AttributeList FuncAttrs) {
3412
- IRBuilder<>::InsertPointGuard IPG (Builder);
3413
3410
auto *FuncTy = FunctionType::get (Builder.getVoidTy (),
3414
3411
{Builder.getPtrTy (), Builder.getPtrTy ()},
3415
3412
/* IsVarArg */ false );
@@ -3422,7 +3419,6 @@ Expected<Function *> OpenMPIRBuilder::createReductionFunction(
3422
3419
BasicBlock *EntryBB =
3423
3420
BasicBlock::Create (M.getContext (), " entry" , ReductionFunc);
3424
3421
Builder.SetInsertPoint (EntryBB);
3425
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
3426
3422
3427
3423
// Need to alloca memory here and deal with the pointers before getting
3428
3424
// LHS/RHS pointers out
@@ -3750,12 +3746,10 @@ static Error populateReductionFunction(
3750
3746
Function *ReductionFunc,
3751
3747
ArrayRef<OpenMPIRBuilder::ReductionInfo> ReductionInfos,
3752
3748
IRBuilder<> &Builder, ArrayRef<bool > IsByRef, bool IsGPU) {
3753
- IRBuilder<>::InsertPointGuard IPG (Builder);
3754
3749
Module *Module = ReductionFunc->getParent ();
3755
3750
BasicBlock *ReductionFuncBlock =
3756
3751
BasicBlock::Create (Module->getContext (), " " , ReductionFunc);
3757
3752
Builder.SetInsertPoint (ReductionFuncBlock);
3758
- Builder.SetCurrentDebugLocation (llvm::DebugLoc ());
3759
3753
Value *LHSArrayPtr = nullptr ;
3760
3754
Value *RHSArrayPtr = nullptr ;
3761
3755
if (IsGPU) {
0 commit comments