[MLIR][OpenMP][NFC] Minor code cleanup
authorAkash Banerjee <Akash.Banerjee@amd.com>
Thu, 27 Apr 2023 13:47:42 +0000 (14:47 +0100)
committerAkash Banerjee <Akash.Banerjee@amd.com>
Thu, 27 Apr 2023 13:49:32 +0000 (14:49 +0100)
Cleanup how the IsBegin argument is passed and removed unnecessary variable.

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

index 6249753..52c0755 100644 (file)
@@ -1424,7 +1424,6 @@ static LogicalResult
 convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
                      LLVM::ModuleTranslation &moduleTranslation) {
   unsigned numMapOperands;
-  bool mapperFunc = false;
   llvm::Value *ifCond = nullptr;
   int64_t deviceID = llvm::omp::OMP_DEVICEID_UNDEF;
   SmallVector<Value> mapOperands;
@@ -1471,7 +1470,6 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
             numMapOperands = enterDataOp.getMapOperands().size();
             mapOperands = enterDataOp.getMapOperands();
             mapTypes = enterDataOp.getMapTypes();
-            mapperFunc = true;
             return success();
           })
           .Case([&](omp::ExitDataOp exitDataOp) {
@@ -1532,11 +1530,11 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
   if (isa<omp::DataOp>(op)) {
     builder.restoreIP(ompBuilder->createTargetData(
         ompLoc, builder.saveIP(), mapTypeFlags, mapNames, mapperAllocas,
-        mapperFunc, deviceID, ifCond, processMapOpCB, bodyCB));
+        /*IsBegin=*/false, deviceID, ifCond, processMapOpCB, bodyCB));
   } else {
     builder.restoreIP(ompBuilder->createTargetData(
         ompLoc, builder.saveIP(), mapTypeFlags, mapNames, mapperAllocas,
-        mapperFunc, deviceID, ifCond, processMapOpCB));
+        isa<omp::EnterDataOp>(op), deviceID, ifCond, processMapOpCB));
   }
 
   if (failed(processMapOpStatus))