]> git.lizzy.rs Git - rust.git/commitdiff
PassWrapper: handle function rename from upstream D36850
authorAugie Fackler <augie@google.com>
Mon, 27 Sep 2021 21:03:08 +0000 (17:03 -0400)
committerAugie Fackler <augie@google.com>
Mon, 27 Sep 2021 22:11:21 +0000 (18:11 -0400)
thinLTOResolvePrevailingInModule became thinLTOFinalizeInModule and
gained the ability to propagate noRecurse and noUnwind function
attributes. I ran codegen tests with it both on and off, as the upstream
patch uses it in both modes, and the tests pass both ways. Given that,
it seemed reasonable to go ahead and let the propagation be enabled in
rustc, and see what happens. See https://reviews.llvm.org/D36850 for
more examples of how the new version of the function gets used.

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

index 48eb50953a957dc759f4e867a9a3564c9fe6a192..ddb5f7dcebfad5777cb9e364513c53f40ab4294f 100644 (file)
@@ -1572,7 +1572,11 @@ extern "C" bool
 LLVMRustPrepareThinLTOResolveWeak(const LLVMRustThinLTOData *Data, LLVMModuleRef M) {
   Module &Mod = *unwrap(M);
   const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(Mod.getModuleIdentifier());
+#if LLVM_VERSION_GE(14, 0)
+  thinLTOFinalizeInModule(Mod, DefinedGlobals, /*PropagateAttrs=*/true);
+#else
   thinLTOResolvePrevailingInModule(Mod, DefinedGlobals);
+#endif
   return true;
 }