HomePhabricator

[AMDGPU][OpenMP] Fix clang driver crash when provided -c

Authored by pdhaliwal on May 5 2021, 5:02 AM.

Description

[AMDGPU][OpenMP] Fix clang driver crash when provided -c

The offload action is used in four different ways as explained
in Driver.cpp:4495. When -c is present, the final phase will be
assemble (linker when -c is not present). However, this phase
is skipped according to D96769 for amdgcn. So, offload action
arrives into following situation,

compile (device) ---> offload ---> offload

without -c the chain looks like,
compile (device) ---> offload ---> linker (device)

				---> offload

The former situation creates an unhandled case which causes
problem. The solution presented in this patch delays the D96769
logic until job creation time. This keeps the offload action
in the 1 of the 4 specified situations.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D101901