Skip to content

Commit 04a318e

Browse files
committed
Use the helper for internalizing with new PM
1 parent d6318de commit 04a318e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
3232
#include "llvm/Transforms/IPO/AlwaysInliner.h"
3333
#include "llvm/Transforms/IPO/FunctionImport.h"
34+
#include "llvm/Transforms/IPO/Internalize.h"
3435
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
3536
#include "llvm/Transforms/Utils/AddDiscriminators.h"
3637
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
@@ -1013,8 +1014,6 @@ extern "C" void LLVMRustPrintPasses() {
10131014

10141015
extern "C" void LLVMRustRunRestrictionPass(LLVMModuleRef M, char **Symbols,
10151016
size_t Len) {
1016-
llvm::legacy::PassManager passes;
1017-
10181017
auto PreserveFunctions = [=](const GlobalValue &GV) {
10191018
for (size_t I = 0; I < Len; I++) {
10201019
if (GV.getName() == Symbols[I]) {
@@ -1024,9 +1023,7 @@ extern "C" void LLVMRustRunRestrictionPass(LLVMModuleRef M, char **Symbols,
10241023
return false;
10251024
};
10261025

1027-
passes.add(llvm::createInternalizePass(PreserveFunctions));
1028-
1029-
passes.run(*unwrap(M));
1026+
internalizeModule(*unwrap(M), PreserveFunctions);
10301027
}
10311028

10321029
extern "C" void

0 commit comments

Comments
 (0)