Differential D128338 Diff 438983 mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
Show First 20 Lines • Show All 690 Lines • ▼ Show 20 Lines | convertOmpWsLoop(Operation &opInst, llvm::IRBuilderBase &builder, | ||||
// Find the loop configuration. | // Find the loop configuration. | ||||
llvm::Value *step = moduleTranslation.lookupValue(loop.step()[0]); | llvm::Value *step = moduleTranslation.lookupValue(loop.step()[0]); | ||||
llvm::Type *ivType = step->getType(); | llvm::Type *ivType = step->getType(); | ||||
llvm::Value *chunk = nullptr; | llvm::Value *chunk = nullptr; | ||||
if (loop.schedule_chunk_var()) { | if (loop.schedule_chunk_var()) { | ||||
llvm::Value *chunkVar = | llvm::Value *chunkVar = | ||||
moduleTranslation.lookupValue(loop.schedule_chunk_var()); | moduleTranslation.lookupValue(loop.schedule_chunk_var()); | ||||
llvm::Type *chunkVarType = chunkVar->getType(); | chunk = builder.CreateSExtOrTrunc(chunkVar, ivType); | ||||
assert(chunkVarType->isIntegerTy() && | |||||
"chunk size must be one integer expression"); | |||||
if (chunkVarType->getIntegerBitWidth() < ivType->getIntegerBitWidth()) | |||||
chunk = builder.CreateSExt(chunkVar, ivType); | |||||
else if (chunkVarType->getIntegerBitWidth() > ivType->getIntegerBitWidth()) | |||||
chunk = builder.CreateTrunc(chunkVar, ivType); | |||||
else | |||||
chunk = chunkVar; | |||||
} | } | ||||
SmallVector<omp::ReductionDeclareOp> reductionDecls; | SmallVector<omp::ReductionDeclareOp> reductionDecls; | ||||
collectReductionDecls(loop, reductionDecls); | collectReductionDecls(loop, reductionDecls); | ||||
llvm::OpenMPIRBuilder::InsertPointTy allocaIP = | llvm::OpenMPIRBuilder::InsertPointTy allocaIP = | ||||
findAllocaInsertPoint(builder, moduleTranslation); | findAllocaInsertPoint(builder, moduleTranslation); | ||||
// Allocate space for privatized reduction variables. | // Allocate space for privatized reduction variables. | ||||
▲ Show 20 Lines • Show All 695 Lines • Show Last 20 Lines |