From 7d6df34deeed5a42163f9b548945e4d785ba48cf Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 21 Oct 2022 11:20:31 +0200 Subject: [PATCH] gallivm: Fix LLVM optimization with the new pass manager The previous list of passes contained several errors: "constprop" does not exist anymore and a trailing ',' is not allowed. This made LLVMRunPasses fail, but the error is silently ignored. Thus none of the listed passes ran at all. https://reviews.llvm.org/D85159 suggests "InstSimplify really should be used anywhere ConstProp is being used" so replace constprop with instsimplify and remove the trailing comma. By enabling pass logging with LLVMPassBuilderOptionsSetDebugLogging(opts, true), the difference is visible. Before: Running pass: AlwaysInlinerPass on [module] Running analysis: InnerAnalysisManagerProxy on [module] Running analysis: ProfileSummaryAnalysis on [module] Running pass: CoroConditionalWrapper on [module] Running pass: AnnotationRemarksPass on fs_variant_partial (1162 instructions) Running analysis: TargetLibraryAnalysis on fs_variant_partial Running pass: AnnotationRemarksPass on fs_variant_whole (1110 instructions) Running analysis: TargetLibraryAnalysis on fs_variant_whole After: Running pass: AlwaysInlinerPass on [module] Running analysis: InnerAnalysisManagerProxy on [module] Running analysis: ProfileSummaryAnalysis on [module] Running pass: CoroConditionalWrapper on [module] Running pass: AnnotationRemarksPass on fs_variant_partial (1162 instructions) Running analysis: TargetLibraryAnalysis on fs_variant_partial Running pass: AnnotationRemarksPass on fs_variant_whole (1110 instructions) Running analysis: TargetLibraryAnalysis on fs_variant_whole Running analysis: InnerAnalysisManagerProxy on [module] Running pass: SROAPass on fs_variant_partial (1162 instructions) Running analysis: DominatorTreeAnalysis on fs_variant_partial Running analysis: AssumptionAnalysis on fs_variant_partial Running analysis: TargetIRAnalysis on fs_variant_partial Running pass: EarlyCSEPass on fs_variant_partial (1111 instructions) Running analysis: TargetLibraryAnalysis on fs_variant_partial Running pass: SimplifyCFGPass on fs_variant_partial (961 instructions) Running pass: ReassociatePass on fs_variant_partial (961 instructions) Running pass: PromotePass on fs_variant_partial (897 instructions) Running pass: InstCombinePass on fs_variant_partial (897 instructions) Running analysis: OptimizationRemarkEmitterAnalysis on fs_variant_partial Running analysis: AAManager on fs_variant_partial Running analysis: BasicAA on fs_variant_partial Running analysis: ScopedNoAliasAA on fs_variant_partial Running analysis: TypeBasedAA on fs_variant_partial Running analysis: OuterAnalysisManagerProxy on fs_variant_partial Running pass: SROAPass on fs_variant_whole (1110 instructions) Running analysis: DominatorTreeAnalysis on fs_variant_whole Running analysis: AssumptionAnalysis on fs_variant_whole Running analysis: TargetIRAnalysis on fs_variant_whole Running pass: EarlyCSEPass on fs_variant_whole (1059 instructions) Running analysis: TargetLibraryAnalysis on fs_variant_whole Running pass: SimplifyCFGPass on fs_variant_whole (912 instructions) Running pass: ReassociatePass on fs_variant_whole (912 instructions) Running pass: PromotePass on fs_variant_whole (844 instructions) Running pass: InstCombinePass on fs_variant_whole (844 instructions) Running analysis: OptimizationRemarkEmitterAnalysis on fs_variant_whole Running analysis: AAManager on fs_variant_whole Running analysis: BasicAA on fs_variant_whole Running analysis: ScopedNoAliasAA on fs_variant_whole Running analysis: TypeBasedAA on fs_variant_whole Running analysis: OuterAnalysisManagerProxy on fs_variant_whole Fixes: 2037c34f245 ("gallivm: move to new pass manager to handle coroutines change.") --- src/gallium/auxiliary/gallivm/lp_bld_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index f77aac75b76..cc410cc1928 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -601,7 +601,7 @@ gallivm_compile_module(struct gallivm_state *gallivm) LLVMRunPasses(gallivm->module, passes, LLVMGetExecutionEngineTargetMachine(gallivm->engine), opts); if (!(gallivm_perf & GALLIVM_PERF_NO_OPT)) - strcpy(passes, "sroa,early-cse,simplifycfg,reassociate,mem2reg,constprop,instcombine,"); + strcpy(passes, "sroa,early-cse,simplifycfg,reassociate,mem2reg,instsimplify,instcombine"); else strcpy(passes, "mem2reg"); -- 2.38.0