llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-driver

Author: Manuel Carrasco (mgcarrasco)

<details>
<summary>Changes</summary>

The AMD path doesn't use spirv-link, and the driver was incorrectly adding 
flags for it, which broke the build. The regression was introduced in 
https://github.com/llvm/llvm-project/commit/1870f3face71d6da2bc0095f751dd1b961b7e4c0.

Without this PR's fix, the following assertion is triggered 
[here](https://github.com/llvm/llvm-project/blob/aa3d6b37c7945bfb4c261dd994689de2a2de25bf/clang/lib/Driver/ToolChains/HIPAMD.cpp#L43)
 when the LLVM bitcode is linked because unexpected flags are forwarded: 
```clang::driver::InputInfo::getFilename() const: Assertion `isFilename() 
&amp;&amp; "Invalid accessor."' failed.```


---
Full diff: https://github.com/llvm/llvm-project/pull/183529.diff


1 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+5-2) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 0aa93e2e46814..7eafa1395b131 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9374,8 +9374,11 @@ void LinkerWrapper::ConstructJob(Compilation &C, const 
JobAction &JA,
       // For SPIR-V, pass some extra flags to `spirv-link`, the out-of-tree
       // SPIR-V linker. `spirv-link` isn't called in LTO mode so restrict these
       // flags to normal compilation.
-      if (TC->getTriple().isSPIRV() && !C.getDriver().isUsingLTO() &&
-          !C.getDriver().isUsingOffloadLTO()) {
+      // SPIR-V for AMD doesn't use spirv-link and therefore doesn't need these
+      // flags.
+      if (TC->getTriple().isSPIRV() &&
+          TC->getTriple().getVendor() != llvm::Triple::VendorType::AMD &&
+          !C.getDriver().isUsingLTO() && !C.getDriver().isUsingOffloadLTO()) {
         // For SPIR-V some functions will be defined by the runtime so allow
         // unresolved symbols in `spirv-link`.
         LinkerArgs.emplace_back("--allow-partial-linkage");

``````````

</details>


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

Reply via email to