Skip to content

Commit d2959c3

Browse files
committed
Auto-upgrade intrinsics
1 parent 1350854 commit d2959c3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc_codegen_llvm/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ pub(crate) unsafe fn optimize(
365365
.map(|path_buf| CString::new(path_buf.to_string_lossy().as_bytes()).unwrap());
366366

367367
// FIXME: NewPM doesn't seem to have a facility to provide custom InlineParams.
368-
// FIXME: Extra passes.
368+
// FIXME: Support extra passes.
369369
llvm::LLVMRustOptimizeWithNewPassManager(
370370
llmod,
371371
tm,

src/rustllvm/PassWrapper.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,10 @@ LLVMRustOptimizeWithNewPassManager(
628628
PTO.LoopVectorization = LoopVectorize;
629629
PTO.SLPVectorization = SLPVectorize;
630630

631-
// FIXME: What's this?
632631
PassInstrumentationCallbacks PIC;
633632
StandardInstrumentations SI;
634633
SI.registerCallbacks(PIC);
635634

636-
// FIXME: PGOOpt
637635
Optional<PGOOptions> PGOOpt;
638636
if (PGOGenPath) {
639637
assert(!PGOUsePath);
@@ -736,14 +734,12 @@ LLVMRustOptimizeWithNewPassManager(
736734
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
737735

738736
MPM.addPass(AlwaysInlinerPass(/*InsertLifetimeIntrinsics=*/false));
739-
// FIXME: PGO?
740737
} else {
741738
for (const auto &C : PipelineStartEPCallbacks)
742739
PB.registerPipelineStartEPCallback(C);
743740
for (const auto &C : OptimizerLastEPCallbacks)
744741
PB.registerOptimizerLastEPCallback(C);
745742

746-
// FIXME: Sanitizers? PGO?
747743
if (PrepareForThinLTO) {
748744
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager);
749745
} else if (PrepareForLTO) {
@@ -759,6 +755,10 @@ LLVMRustOptimizeWithNewPassManager(
759755
MPM.addPass(NameAnonGlobalPass());
760756
}
761757

758+
// Upgrade all calls to old intrinsics first.
759+
for (Module::iterator I = TheModule->begin(), E = TheModule->end(); I != E;)
760+
UpgradeCallsToIntrinsic(&*I++); // must be post-increment, as we remove
761+
762762
MPM.run(*TheModule, MAM);
763763
}
764764

0 commit comments

Comments
 (0)