@@ -168,9 +168,14 @@ void AMDGCN::Linker::constructLinkAndEmitSpirvCommand(
168168 const InputInfo &Output, const llvm::opt::ArgList &Args) const {
169169 assert (!Inputs.empty () && " Must have at least one input." );
170170
171- constructLlvmLinkCommand (C, JA, Inputs, Output, Args);
172-
173- // Linked BC is now in Output
171+ InputInfo LinkedBC = Inputs.front ();
172+ if (Inputs.size () > 1 ) {
173+ std::string TempPath = C.getDriver ().GetTemporaryPath (" pre-spirv-translate" ,
174+ " bc" );
175+ LinkedBC = InputInfo (&JA, C.getArgs ().MakeArgString (TempPath),
176+ Output.getBaseInput ());
177+ constructLlvmLinkCommand (C, JA, Inputs, LinkedBC, Args);
178+ }
174179
175180 // Emit SPIR-V binary.
176181 llvm::opt::ArgStringList TrArgs{
@@ -180,7 +185,7 @@ void AMDGCN::Linker::constructLinkAndEmitSpirvCommand(
180185 " --spirv-lower-const-expr" ,
181186 " --spirv-preserve-auxdata" ,
182187 " --spirv-debug-info-version=nonsemantic-shader-200" };
183- SPIRV::constructTranslateCommand (C, *this , JA, Output, Output , TrArgs);
188+ SPIRV::constructTranslateCommand (C, *this , JA, Output, LinkedBC , TrArgs);
184189}
185190
186191// For amdgcn the inputs of the linker job are device bitcode and output is
0 commit comments