[all-commits] [llvm/llvm-project] 148210: [Flang][OpenMP][MLIR] Remove deletion of unused de...
agozillon via All-commits
all-commits at lists.llvm.org
Tue Oct 3 06:21:40 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1482106c9960300e729b1a58e5e25b6ac1c150ba
https://github.com/llvm/llvm-project/commit/1482106c9960300e729b1a58e5e25b6ac1c150ba
Author: agozillon <Andrew.Gozillon at amd.com>
Date: 2023-10-03 (Tue, 03 Oct 2023)
Changed paths:
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
A openmp/libomptarget/test/offloading/fortran/double-target-call-with-declare-target.f90
Log Message:
-----------
[Flang][OpenMP][MLIR] Remove deletion of unused declare target global after use replacement (#67762)
At the moment, for device a reference pointer is generated in place of
the original declare target global value, this reference pointer is the
pointer that actually receives the data. In Clang the original global
value isn't generated for device, just the reference pointer.
Unfortunately for Flang/MLIR this is currently not the case, as the
declare target attribute is processed after the creation of the global
so we end up with a dead global on device effectively after rewriting
its uses to the new device reference pointer.
It appears I was a little overzealous with the deletion of the declare
target globals for device. The current method breaks in-cases where the
same declare target global is used across two target regions (added a
runtime reproduced in the patch). As it'll effectively delete it before
the second target gets a chance to be written to LLVM IR and have it's
uses rewritten .
I'd like to remove this deletion as the dead global isn't breaking any
code and will likely be removed in later dead code elimination passes,
perhaps a little too heavy handed with the original approach.
More information about the All-commits
mailing list