From 280c7a9526a9ae7f959117c9cec94f8c8887f15c Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Mon, 18 Mar 2024 12:10:19 -0500 Subject: [PATCH] [Clang] Fix preprocessing device only in HIP mode Summary: A recent change made the HIP compilation bundle by default. However we don't want to do this for `-E`, which silently broke some handling. --- clang/lib/Driver/Driver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 5015ce9f6d68e0..1daf588142b3b4 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -4647,7 +4647,8 @@ Action *Driver::BuildOffloadingActions(Compilation &C, // All kinds exit now in device-only mode except for non-RDC mode HIP. if (offloadDeviceOnly() && - (!C.isOffloadingHostKind(Action::OFK_HIP) || + (getFinalPhase(Args) == phases::Preprocess || + !C.isOffloadingHostKind(Action::OFK_HIP) || !Args.hasFlag(options::OPT_gpu_bundle_output, options::OPT_no_gpu_bundle_output, true) || Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false)))