@@ -4063,24 +4063,10 @@ getKmpcForStaticLoopForType(Type *Ty, OpenMPIRBuilder *OMPBuilder,
4063
4063
static void createTargetLoopWorkshareCall (
4064
4064
OpenMPIRBuilder *OMPBuilder, WorksharingLoopType LoopType,
4065
4065
BasicBlock *InsertBlock, Value *Ident, Value *LoopBodyArg,
4066
- Type *ParallelTaskPtr, Value *TripCountOrig, Function &LoopBodyFn) {
4066
+ Type *ParallelTaskPtr, Value *TripCount, Function &LoopBodyFn) {
4067
+ Type *TripCountTy = TripCount->getType ();
4067
4068
Module &M = OMPBuilder->M ;
4068
4069
IRBuilder<> &Builder = OMPBuilder->Builder ;
4069
- Value *TripCount = TripCountOrig;
4070
- // FIXME(JAN): The trip count is 1 larger than it should be for GPU, this may
4071
- // not be the right way to fix it, but this works for now.
4072
- if (OMPBuilder->Config .isGPU ()) {
4073
- if (LoopType != WorksharingLoopType::DistributeStaticLoop)
4074
- Builder.restoreIP ({InsertBlock, std::prev (InsertBlock->end ())});
4075
- LLVMContext &Ctx = M.getContext ();
4076
- Type *IVTy = TripCountOrig->getType ();
4077
- Type *InternalIVTy = IVTy->getIntegerBitWidth () <= 32
4078
- ? Type::getInt32Ty (Ctx)
4079
- : Type::getInt64Ty (Ctx);
4080
- Constant *One = ConstantInt::get (InternalIVTy, 1 );
4081
- TripCount = Builder.CreateSub (TripCountOrig, One, " modified_trip_count" );
4082
- }
4083
- Type *TripCountTy = TripCount->getType ();
4084
4070
FunctionCallee RTLFn =
4085
4071
getKmpcForStaticLoopForType (TripCountTy, OMPBuilder, LoopType);
4086
4072
SmallVector<Value *, 8 > RealArgs;
0 commit comments