@@ -1314,8 +1314,7 @@ static void targetParallelCallback(
1314
1314
/* if expression */ Cond,
1315
1315
/* number of threads */ NumThreads ? NumThreads : Builder.getInt32 (-1 ),
1316
1316
/* Proc bind */ Builder.getInt32 (-1 ),
1317
- /* outlined function */
1318
- Builder.CreateBitCast (&OutlinedFn, OMPIRBuilder->ParallelTaskPtr ),
1317
+ /* outlined function */ &OutlinedFn,
1319
1318
/* wrapper function */ NullPtrValue,
1320
1319
/* arguments of the outlined funciton*/ Args,
1321
1320
/* number of arguments */ Builder.getInt64 (NumCapturedVars)};
@@ -1389,9 +1388,8 @@ hostParallelCallback(OpenMPIRBuilder *OMPIRBuilder, Function &OutlinedFn,
1389
1388
Builder.SetInsertPoint (CI);
1390
1389
1391
1390
// Build call __kmpc_fork_call[_if](Ident, n, microtask, var1, .., varn);
1392
- Value *ForkCallArgs[] = {
1393
- Ident, Builder.getInt32 (NumCapturedVars),
1394
- Builder.CreateBitCast (&OutlinedFn, OMPIRBuilder->ParallelTaskPtr )};
1391
+ Value *ForkCallArgs[] = {Ident, Builder.getInt32 (NumCapturedVars),
1392
+ &OutlinedFn};
1395
1393
1396
1394
SmallVector<Value *, 16 > RealArgs;
1397
1395
RealArgs.append (std::begin (ForkCallArgs), std::end (ForkCallArgs));
@@ -1408,8 +1406,6 @@ hostParallelCallback(OpenMPIRBuilder *OMPIRBuilder, Function &OutlinedFn,
1408
1406
Value *NullPtrValue = Constant::getNullValue (PtrTy);
1409
1407
RealArgs.push_back (NullPtrValue);
1410
1408
}
1411
- if (IfCondition && RealArgs.back ()->getType () != PtrTy)
1412
- RealArgs.back () = Builder.CreateBitCast (RealArgs.back (), PtrTy);
1413
1409
1414
1410
Builder.CreateCall (RTLFn, RealArgs);
1415
1411
@@ -4494,18 +4490,19 @@ getKmpcForStaticLoopForType(Type *Ty, OpenMPIRBuilder *OMPBuilder,
4494
4490
4495
4491
// Inserts a call to proper OpenMP Device RTL function which handles
4496
4492
// loop worksharing.
4497
- static void createTargetLoopWorkshareCall (
4498
- OpenMPIRBuilder *OMPBuilder, WorksharingLoopType LoopType,
4499
- BasicBlock *InsertBlock, Value *Ident, Value *LoopBodyArg,
4500
- Type *ParallelTaskPtr, Value *TripCount, Function &LoopBodyFn) {
4493
+ static void createTargetLoopWorkshareCall (OpenMPIRBuilder *OMPBuilder,
4494
+ WorksharingLoopType LoopType,
4495
+ BasicBlock *InsertBlock, Value *Ident,
4496
+ Value *LoopBodyArg, Value *TripCount,
4497
+ Function &LoopBodyFn) {
4501
4498
Type *TripCountTy = TripCount->getType ();
4502
4499
Module &M = OMPBuilder->M ;
4503
4500
IRBuilder<> &Builder = OMPBuilder->Builder ;
4504
4501
FunctionCallee RTLFn =
4505
4502
getKmpcForStaticLoopForType (TripCountTy, OMPBuilder, LoopType);
4506
4503
SmallVector<Value *, 8 > RealArgs;
4507
4504
RealArgs.push_back (Ident);
4508
- RealArgs.push_back (Builder. CreateBitCast ( &LoopBodyFn, ParallelTaskPtr) );
4505
+ RealArgs.push_back (&LoopBodyFn);
4509
4506
RealArgs.push_back (LoopBodyArg);
4510
4507
RealArgs.push_back (TripCount);
4511
4508
if (LoopType == WorksharingLoopType::DistributeStaticLoop) {
@@ -4529,12 +4526,10 @@ static void createTargetLoopWorkshareCall(
4529
4526
Builder.CreateCall (RTLFn, RealArgs);
4530
4527
}
4531
4528
4532
- static void
4533
- workshareLoopTargetCallback (OpenMPIRBuilder *OMPIRBuilder,
4534
- CanonicalLoopInfo *CLI, Value *Ident,
4535
- Function &OutlinedFn, Type *ParallelTaskPtr,
4536
- const SmallVector<Instruction *, 4 > &ToBeDeleted,
4537
- WorksharingLoopType LoopType) {
4529
+ static void workshareLoopTargetCallback (
4530
+ OpenMPIRBuilder *OMPIRBuilder, CanonicalLoopInfo *CLI, Value *Ident,
4531
+ Function &OutlinedFn, const SmallVector<Instruction *, 4 > &ToBeDeleted,
4532
+ WorksharingLoopType LoopType) {
4538
4533
IRBuilder<> &Builder = OMPIRBuilder->Builder ;
4539
4534
BasicBlock *Preheader = CLI->getPreheader ();
4540
4535
Value *TripCount = CLI->getTripCount ();
@@ -4581,8 +4576,7 @@ workshareLoopTargetCallback(OpenMPIRBuilder *OMPIRBuilder,
4581
4576
OutlinedFnCallInstruction->eraseFromParent ();
4582
4577
4583
4578
createTargetLoopWorkshareCall (OMPIRBuilder, LoopType, Preheader, Ident,
4584
- LoopBodyArg, ParallelTaskPtr, TripCount,
4585
- OutlinedFn);
4579
+ LoopBodyArg, TripCount, OutlinedFn);
4586
4580
4587
4581
for (auto &ToBeDeletedItem : ToBeDeleted)
4588
4582
ToBeDeletedItem->eraseFromParent ();
@@ -4676,8 +4670,8 @@ OpenMPIRBuilder::applyWorkshareLoopTarget(DebugLoc DL, CanonicalLoopInfo *CLI,
4676
4670
//
4677
4671
OI.PostOutlineCB = [=, ToBeDeletedVec =
4678
4672
std::move (ToBeDeleted)](Function &OutlinedFn) {
4679
- workshareLoopTargetCallback (this , CLI, Ident, OutlinedFn, ParallelTaskPtr ,
4680
- ToBeDeletedVec, LoopType);
4673
+ workshareLoopTargetCallback (this , CLI, Ident, OutlinedFn, ToBeDeletedVec ,
4674
+ LoopType);
4681
4675
};
4682
4676
addOutlineInfo (std::move (OI));
4683
4677
return CLI->getAfterIP ();
@@ -8126,7 +8120,7 @@ Expected<Function *> OpenMPIRBuilder::emitUserDefinedMapper(
8126
8120
// Convert the size in bytes into the number of array elements.
8127
8121
TypeSize ElementSize = M.getDataLayout ().getTypeStoreSize (ElemTy);
8128
8122
Size = Builder.CreateExactUDiv (Size, Builder.getInt64 (ElementSize));
8129
- Value *PtrBegin = Builder. CreateBitCast ( BeginIn, Builder. getPtrTy ()) ;
8123
+ Value *PtrBegin = BeginIn;
8130
8124
Value *PtrEnd = Builder.CreateGEP (ElemTy, PtrBegin, Size);
8131
8125
8132
8126
// Emit array initiation if this is an array section and \p MapType indicates
@@ -8170,10 +8164,8 @@ Expected<Function *> OpenMPIRBuilder::emitUserDefinedMapper(
8170
8164
8171
8165
// Fill up the runtime mapper handle for all components.
8172
8166
for (unsigned I = 0 ; I < Info->BasePointers .size (); ++I) {
8173
- Value *CurBaseArg =
8174
- Builder.CreateBitCast (Info->BasePointers [I], Builder.getPtrTy ());
8175
- Value *CurBeginArg =
8176
- Builder.CreateBitCast (Info->Pointers [I], Builder.getPtrTy ());
8167
+ Value *CurBaseArg = Info->BasePointers [I];
8168
+ Value *CurBeginArg = Info->Pointers [I];
8177
8169
Value *CurSizeArg = Info->Sizes [I];
8178
8170
Value *CurNameArg = Info->Names .size ()
8179
8171
? Info->Names [I]
0 commit comments