|
49 | 49 | #include "llvm/Transforms/Instrumentation/RealtimeSanitizer.h" |
50 | 50 | #include "llvm/Transforms/Instrumentation/ThreadSanitizer.h" |
51 | 51 | #include "llvm/Transforms/Scalar/AnnotationRemarks.h" |
| 52 | +#if LLVM_VERSION_GE(23, 0) |
| 53 | +#include "llvm/Transforms/Utils/AssignGUID.h" |
| 54 | +#endif |
52 | 55 | #include "llvm/Transforms/Utils/CanonicalizeAliases.h" |
53 | 56 | #include "llvm/Transforms/Utils/FunctionImportUtils.h" |
54 | 57 | #include "llvm/Transforms/Utils/NameAnonGlobals.h" |
@@ -915,6 +918,9 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
915 | 918 | if (NeedThinLTOBufferPasses) { |
916 | 919 | MPM.addPass(CanonicalizeAliasesPass()); |
917 | 920 | MPM.addPass(NameAnonGlobalPass()); |
| 921 | +#if LLVM_VERSION_GE(23, 0) |
| 922 | + MPM.addPass(AssignGUIDPass()); |
| 923 | +#endif |
918 | 924 | } |
919 | 925 | // For `-Copt-level=0`, and the pre-link fat/thin LTO stages. |
920 | 926 | if (ThinLTOBufferRef && *ThinLTOBufferRef == nullptr) { |
@@ -1454,6 +1460,9 @@ extern "C" LLVMRustBuffer *LLVMRustModuleSerialize(LLVMModuleRef M, |
1454 | 1460 | PB.registerLoopAnalyses(LAM); |
1455 | 1461 | PB.crossRegisterProxies(LAM, FAM, CGAM, MAM); |
1456 | 1462 | ModulePassManager MPM; |
| 1463 | +#if LLVM_VERSION_GE(23, 0) |
| 1464 | + MPM.addPass(AssignGUIDPass()); |
| 1465 | +#endif |
1457 | 1466 | MPM.addPass(ThinLTOBitcodeWriterPass(OS, nullptr)); |
1458 | 1467 | MPM.run(*unwrap(M), MAM); |
1459 | 1468 | } else { |
|
0 commit comments