[Clang] Only emit textual LLVM-IR in device only mode
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 13 Jan 2023 19:31:18 +0000 (13:31 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 24 Jan 2023 21:11:30 +0000 (15:11 -0600)
commitd50dacd7c3c2ce489df6ed1ccde71bba390fe5e2
treecf628bb65680fd685f0723e3a790b2c84543af64
parenta037b85f30970cb2dc51e8ab66f2e157bfb28c19
[Clang] Only emit textual LLVM-IR in device only mode

Currently, we embed device code into the host to perform
multi-architecture linking and handling of device code. If the user
specified `-S -emit-llvm` then the embedded output will be textual
LLVM-IR. This is a problem because it can't be used by the LTO backend
and it makes reading the file confusing.

This patch changes the behaviour to only emit textual device IR if we
are in device only mode, that is, if the device code is presented
directly to the user instead of being embedded. Otherwise we should
always embed device bitcode instead.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D141717
clang/lib/Driver/Driver.cpp
clang/test/Driver/openmp-offload-gpu.c