================
@@ -4562,7 +4565,15 @@ void Driver::BuildDefaultActions(Compilation &C, 
DerivedArgList &Args,
       LA->propagateHostOffloadInfo(C.getActiveOffloadKinds(),
                                    /*BoundArch=*/nullptr);
     } else {
-      LA = C.MakeAction<LinkJobAction>(LinkerInputs, types::TY_Image);
+      // If we are linking but were passed -emit-llvm, we will be calling
+      // llvm-link, so set the output type accordingly. This is only allowed in
+      // rare cases, so make sure we aren't going to error about it.
+      bool LinkingIR = Args.hasArg(options::OPT_emit_llvm) &&
----------------
sarnex wrote:

My thinking was that logically both AMDGPU and SPIR-V toolchains link IR and 
output IR with `llvm-link` and should have a linker output type matching that, 
it may be that AMDGPU never reaches here, or it may be that it does reach here 
but it being `Image` type doesn't cause a problem, however it does for SPIR-V. 

It seems like your concern is to limit the `Driver.cpp` change as much as 
possible, so I'll restrict it to `SPIR-V` for know since that's the only known 
case that actually needs a change to prevent an error.

https://github.com/llvm/llvm-project/pull/169572
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to