Skip to content

Commit 2727e36

Browse files
authored
Remove deprecated non string API for LLVM pass pipeline and parse all options (JuliaLang#55407)
This technically removes the option for Oz in julia but it doesn't actually do what one wants. This removes an API currently used by Enzyme.jl and AllocCheck.jl but given that LLVM.jl doesn't support this API anymore that seems fine. @wsmoses @maleadt Do we want the replacement for this (a function that parses the PipelineConfig struct) to live in LLVM.jl or GPUCompiler.jl ?
1 parent 3db1d19 commit 2727e36

File tree

4 files changed

+11
-62
lines changed

4 files changed

+11
-62
lines changed

src/codegen-stubs.c

-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ JL_DLLEXPORT uint64_t jl_getUnwindInfo_fallback(uint64_t dwAddr)
107107
return 0;
108108
}
109109

110-
JL_DLLEXPORT void jl_build_newpm_pipeline_fallback(void *MPM, void *PB, void *config) UNAVAILABLE
111-
112110
JL_DLLEXPORT void jl_register_passbuilder_callbacks_fallback(void *PB) { }
113111

114112
#define MODULE_PASS(NAME, CLASS, CREATE_PASS) \

src/jl_exported_funcs.inc

-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@
542542
YY(jl_type_to_llvm) \
543543
YY(jl_getUnwindInfo) \
544544
YY(jl_get_libllvm) \
545-
YY(jl_build_newpm_pipeline) \
546545
YY(jl_register_passbuilder_callbacks) \
547546
YY(LLVMExtraMPMAddCPUFeaturesPass) \
548547
YY(LLVMExtraMPMAddRemoveNIPass) \

src/pipeline.cpp

+8-59
Original file line numberDiff line numberDiff line change
@@ -609,65 +609,6 @@ static void buildPipeline(ModulePassManager &MPM, PassBuilder *PB, OptimizationL
609609
MPM.addPass(AfterOptimizationMarkerPass());
610610
}
611611

612-
struct PipelineConfig {
613-
int Speedup;
614-
int Size;
615-
int lower_intrinsics;
616-
int dump_native;
617-
int external_use;
618-
int llvm_only;
619-
int always_inline;
620-
int enable_early_simplifications;
621-
int enable_early_optimizations;
622-
int enable_scalar_optimizations;
623-
int enable_loop_optimizations;
624-
int enable_vector_pipeline;
625-
int remove_ni;
626-
int cleanup;
627-
int warn_missed_transformations;
628-
};
629-
630-
extern "C" JL_DLLEXPORT_CODEGEN void jl_build_newpm_pipeline_impl(void *MPM, void *PB, PipelineConfig* config) JL_NOTSAFEPOINT
631-
{
632-
OptimizationLevel O;
633-
switch (config->Size) {
634-
case 1:
635-
O = OptimizationLevel::Os;
636-
break;
637-
default:
638-
O = OptimizationLevel::Oz;
639-
break;
640-
case 0:
641-
switch (config->Speedup) {
642-
case 0:
643-
O = OptimizationLevel::O0;
644-
break;
645-
case 1:
646-
O = OptimizationLevel::O1;
647-
break;
648-
case 2:
649-
O = OptimizationLevel::O2;
650-
break;
651-
default:
652-
O = OptimizationLevel::O3;
653-
break;
654-
}
655-
}
656-
buildPipeline(*reinterpret_cast<ModulePassManager*>(MPM), reinterpret_cast<PassBuilder*>(PB), O,
657-
OptimizationOptions{!!config->lower_intrinsics,
658-
!!config->dump_native,
659-
!!config->external_use,
660-
!!config->llvm_only,
661-
!!config->always_inline,
662-
!!config->enable_early_simplifications,
663-
!!config->enable_early_optimizations,
664-
!!config->enable_scalar_optimizations,
665-
!!config->enable_loop_optimizations,
666-
!!config->enable_vector_pipeline,
667-
!!config->remove_ni,
668-
!!config->cleanup,
669-
!!config->warn_missed_transformations});
670-
}
671612

672613
#undef JULIA_PASS
673614

@@ -865,6 +806,14 @@ static Optional<std::pair<OptimizationLevel, OptimizationOptions>> parseJuliaPip
865806
OPTION(dump_native),
866807
OPTION(external_use),
867808
OPTION(llvm_only),
809+
OPTION(always_inline),
810+
OPTION(enable_early_simplifications),
811+
OPTION(enable_early_optimizations),
812+
OPTION(enable_scalar_optimizations),
813+
OPTION(enable_loop_optimizations),
814+
OPTION(enable_vector_pipeline),
815+
OPTION(remove_ni),
816+
OPTION(cleanup),
868817
OPTION(warn_missed_transformations)
869818
#undef OPTION
870819
};

test/llvmpasses/parsing.ll

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
; COM: NewPM-only test, tests for ability to parse Julia passes
22

33
; RUN: opt --load-pass-plugin=libjulia-codegen%shlibext -passes='module(CPUFeatures,RemoveNI,JuliaMultiVersioning,RemoveJuliaAddrspaces,LowerPTLSPass,function(DemoteFloat16,CombineMulAdd,LateLowerGCFrame,FinalLowerGC,AllocOpt,PropagateJuliaAddrspaces,LowerExcHandlers,GCInvariantVerifier,loop(LowerSIMDLoop,JuliaLICM),GCInvariantVerifier<strong>,GCInvariantVerifier<no-strong>),LowerPTLSPass<imaging>,LowerPTLSPass<no-imaging>,JuliaMultiVersioning<external>,JuliaMultiVersioning<no-external>)' -S %s -o /dev/null
4+
; RUN: opt --load-pass-plugin=libjulia-codegen%shlibext -passes="julia<level=3;llvm_only>" -S %s -o /dev/null
5+
; RUN: opt --load-pass-plugin=libjulia-codegen%shlibext -passes="julia<level=3;no_llvm_only>" -S %s -o /dev/null
6+
; RUN: opt --load-pass-plugin=libjulia-codegen%shlibext -passes="julia<level=3;no_enable_vector_pipeline>" -S %s -o /dev/null
47

58
define void @test() {
69
ret void

0 commit comments

Comments
 (0)