[clang] [llvm] IR: Store the default subtarget info in named metadata instead of the context. (PR #98673)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 17:57:57 PDT 2024


================
@@ -1240,11 +1240,22 @@ void IRLinker::linkNamedMDNodes() {
     if (IsPerformingImport && NMD.getName() == "llvm.stats")
       continue;
 
+    // Default subtarget info is only intended to be used before LTO and
+    // shouldn't be present after merging because the default subtargets may be
+    // different. Even if they were the same we wouldn't want to keep them to
+    // avoid introducing bugs that would only occur when merging modules with
+    // different subtarget info.
+    if (NMD.getName() == "llvm.subtarget.info")
----------------
jrtc27 wrote:

This seems to be an overly simplistic take. Downstream we need a subset of the target features during LTO, and it wouldn't surprise me if there are cases upstream that could benefit from it too.

https://github.com/llvm/llvm-project/pull/98673


More information about the llvm-commits mailing list