mirror of
https://github.com/intel/llvm.git
synced 2026-01-23 07:58:23 +08:00
Variable references inside OpenACC compute and loop region were currently always lowered to usages of the same SSA values than in the host thread, even for variables that appear in data clauses and for which acc data operations are created. This makes it a non-trivial task to identify implicit data usages vs usage of data appearing in clauses because the SSA addresses used in the region may have a non-trivial SSA relationship with the SSA addresses used as inputs of the data operations, especially after CSE runs that may merge component or array element addressing operations with similar addressing on the host thread (fir.coordinate/hlfir.designate). This patch updates OpenACC lowering to remap the Symbol that appear in data clauses to the related acc data operation result for the scope of the compute or loop region. To allow FIR passes to reason about these addresses, a new hlfir.declare operation is created with the acc data operation result. This gives access to the shape, contiguity, attributes, and dummy argument relationships inside the region without having FIR extended to understand the data operations.