[llvm] [mlir] [OpenMP][MLIR][OMPIRBuilder] Add a small optional constant alloca raise function pass to finalize, utilised in convertTarget (PR #78818)

Kiran Chandramohan via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 14:44:02 PST 2024


================
@@ -5043,6 +5088,12 @@ static Function *createOutlinedFunction(
 
   BasicBlock *UserCodeEntryBB = Builder.GetInsertBlock();
 
+  // As we embed the user code in the middle of our target region after we
+  // generate entry code, we must move what allocas we can into the entry
+  // block to avoid possible breaking optimisations for device
+  if (OMPBuilder.Config.isTargetDevice())
+    OMPBuilder.ConstantAllocaRaiseCandidates.emplace_back(Func);
----------------
kiranchandramohan wrote:

Assuming this code is going to run for all device targets. I guess you said that this is something specific for AMD GPU backends. Do you know whether such transformations apply to other targets as well?

https://github.com/llvm/llvm-project/pull/78818


More information about the llvm-commits mailing list