[PATCH] D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 29 13:20:56 PDT 2023


jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

Let's move on. I described what this should look like, just for the record.



================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:10399
+    DeviceID = CGF.Builder.getInt64(OMP_DEVICEID_UNDEF);
+  }
 
----------------
TIFitis wrote:
> jdoerfert wrote:
> > Move this behind the if generation and guard the emit scalar with a conditional, all is only needed if both Device is present and IfCond is not known true.
> I have moved the device generation after the if generation.
> But I am not sure what should be the guard here for emitting the scalar.
> 
> My idea was to generate something like:
> 
> 
> ```
> %new_dev = alloca ...
> if.then
>     %x = load %device
>     store %x %new_dev
>     ...
>     begin_mapper(..., %new_dev, ...)
> ...
> if.then
>     ...
>     end_mapper(..., %new_dev, ...)
> ```
What we should do, though I don't think it will really matter, is the following:
```
device_val = undef;
if_val = eval_if_clause();
if (id_val) {
  device_val = eval_device_clause()
  ...other clauses ...
  begin_then(... Vals ...)
} else {
  begin_else(...)
}

if (if_val) {
  end_then(... Vals ...)
} else {
  end_else(...)
}
```






Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150860



More information about the cfe-commits mailing list