|
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" |
@@ -934,6 +937,9 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
934 | 937 | if (NeedThinLTOBufferPasses) { |
935 | 938 | MPM.addPass(CanonicalizeAliasesPass()); |
936 | 939 | MPM.addPass(NameAnonGlobalPass()); |
| 940 | +#if LLVM_VERSION_GE(23, 0) |
| 941 | + MPM.addPass(AssignGUIDPass()); |
| 942 | +#endif |
937 | 943 | } |
938 | 944 | // For `-Copt-level=0`, and the pre-link fat/thin LTO stages. |
939 | 945 | if (ThinLTOBufferRef && *ThinLTOBufferRef == nullptr) { |
@@ -1475,6 +1481,9 @@ extern "C" LLVMRustBuffer *LLVMRustModuleSerialize(LLVMModuleRef M, |
1475 | 1481 | PB.registerLoopAnalyses(LAM); |
1476 | 1482 | PB.crossRegisterProxies(LAM, FAM, CGAM, MAM); |
1477 | 1483 | ModulePassManager MPM; |
| 1484 | +#if LLVM_VERSION_GE(23, 0) |
| 1485 | + MPM.addPass(AssignGUIDPass()); |
| 1486 | +#endif |
1478 | 1487 | MPM.addPass(ThinLTOBitcodeWriterPass(OS, nullptr)); |
1479 | 1488 | MPM.run(*unwrap(M), MAM); |
1480 | 1489 | } else { |
|
0 commit comments