[PATCH] D97818: [OpenMP] Replace GPU globalization calls with shared memory in the middle-end

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 11:29:41 PDT 2021


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:1035
+    auto ReplaceAllocCalls = [&](Use &U, Function &F) {
+      auto &FreeCall = OMPInfoCache.RFIs[OMPRTL___kmpc_free_shared];
+      CallBase *CB = OpenMPOpt::getCallIfRegularCall(U, &RFI);
----------------
Nit: hoist this out of the lambda.


================
Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:1060
+        }
+      }
+
----------------
You have to check that a unique free call was found or give up otherwise.


================
Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:1077
+      auto *NewBuffer = new AddrSpaceCastInst(GEPExpr, Int8Ty->getPointerTo(),
+                                              CB->getName() + "_shared", CB);
+
----------------
You might be able to replace these two with just: `ConstantExpr::getPointerCast`


================
Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:2480
+      if (One->isOne() && NegOne->isMinusOne())
+        return true;
+
----------------
Check the Pred as well. Maybe try to split this in multiple matches or somehow to make it easier to read.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97818/new/

https://reviews.llvm.org/D97818



More information about the llvm-commits mailing list