	switch (build_context.optimization_level) {
	case -1:
		array_add(&passes, "function(annotation-remarks)");
		break;
	case 0:
		array_add(&passes, "always-inline");
		if (build_context.internal_llvm_mem2reg) {
			array_add(&passes, "function<eager-inv>(mem2reg)");
		}
		array_add(&passes, "function(annotation-remarks)");
		break;
	case 1:
// default<Os>
// Passes removed: coro, openmp, sroa
#if LLVM_VERSION_MAJOR == 17
		array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1000;no-use-loop-info>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline<only-mandatory>,
		inline,
		function-attrs<skip-non-recursive>,
		function<eager-inv;no-rerun>(
			early-cse<memssa>,
			speculative-execution,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>,
			aggressive-instcombine,
			constraint-elimination,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			reassociate,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>,
			loop(
				loop-idiom,
				indvars,
				loop-deletion,
				loop-unroll-full
			),
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1000;no-use-loop-info>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	loop-load-elim,
	instcombine<max-iterations=1000;no-use-loop-info>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1000;no-use-loop-info>,
	loop-unroll<O2>,
	transform-warning,
	instcombine<max-iterations=1000;no-use-loop-info>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");
#elif LLVM_VERSION_MAJOR < 20
		array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
	sroa<modify-cfg>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			aggressive-instcombine,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	loop-unroll<O2>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");
#elif LLVM_VERSION_MAJOR < 22 // LLVM 20 & 21 (same config)
	array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	ee-instrument<>,
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	sroa<modify-cfg>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			aggressive-instcombine,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				extra-simple-loop-unswitch-passes,
				loop-deletion,loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-unroll<O2>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");

#else // LLVM 22
// Passes removed: coro, openmp
	array_add(&passes, u8R"(
memprof-remove-attributes,
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	ee-instrument<>,
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	sroa<modify-cfg>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			aggressive-instcombine,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				extra-simple-loop-unswitch-passes,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	drop-unnecessary-assumes,
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	drop-unnecessary-assumes,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-unroll<O2>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>
),
alloc-token,
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");

#endif
		break;
// default<O2>
// Passes removed: coro, openmp, sroa
	case 2:
#if LLVM_VERSION_MAJOR == 17
		array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1000;no-use-loop-info>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline<only-mandatory>,
		inline,
		function-attrs<skip-non-recursive>,
		function<eager-inv;no-rerun>(
			early-cse<memssa>,
			speculative-execution,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>,
			aggressive-instcombine,
			constraint-elimination,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			reassociate,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>,
			loop(
				loop-idiom,
				indvars,
				loop-deletion,
				loop-unroll-full
			),
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1000;no-use-loop-info>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	loop-load-elim,
	instcombine<max-iterations=1000;no-use-loop-info>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1000;no-use-loop-info>,
	loop-unroll<O2>,
	transform-warning,
	instcombine<max-iterations=1000;no-use-loop-info>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");
#elif LLVM_VERSION_MAJOR < 20
		array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
	sroa<modify-cfg>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			aggressive-instcombine,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	loop-unroll<O2>,
	transform-warning,
	sroa<modify-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");
#elif LLVM_VERSION_MAJOR < 22 // LLVM 20 & 21 (same config)
	array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	ee-instrument<>,
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	sroa<modify-cfg>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			aggressive-instcombine,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				extra-simple-loop-unswitch-passes,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-unroll<O2>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");

#else // LLVM 22
// Passes removed: coro, openmp
	array_add(&passes, u8R"(
memprof-remove-attributes,
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	ee-instrument<>,
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	sroa<modify-cfg>,
	early-cse<>
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			aggressive-instcombine,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<no-nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				extra-simple-loop-unswitch-passes,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	drop-unnecessary-assumes,
	float2int,
	lower-constant-intrinsics,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	drop-unnecessary-assumes,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-unroll<O2>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>
),
alloc-token,
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");
#endif
		break;

	case 3:
// default<O3>
// Passes removed: coro, openmp, sroa
#if LLVM_VERSION_MAJOR == 17
		array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
	early-cse<>,
	callsite-splitting
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1000;no-use-loop-info>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline<only-mandatory>,
		inline,
		function-attrs<skip-non-recursive>,
		argpromotion,
		function<eager-inv;no-rerun>(
			early-cse<memssa>,
			speculative-execution,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>,
			aggressive-instcombine,
			constraint-elimination,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			reassociate,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>,
			loop(
				loop-idiom,
				indvars,
				loop-deletion,
				loop-unroll-full
			),
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1000;no-use-loop-info>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1000;no-use-loop-info>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	chr,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	loop-load-elim,
	instcombine<max-iterations=1000;no-use-loop-info>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1000;no-use-loop-info>,
	loop-unroll<O3>,
	transform-warning,
	instcombine<max-iterations=1000;no-use-loop-info>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");

#elif LLVM_VERSION_MAJOR < 20
		array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
	sroa<modify-cfg>,
	early-cse<>,
	callsite-splitting
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
always-inline,
require<globals-aa>,
function(invalidate<aa>),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		argpromotion,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			aggressive-instcombine,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(licm<allowspeculation>),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
			instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	chr,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	loop-unroll<O3>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,
	loop-mssa(licm<allowspeculation>),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");
#elif LLVM_VERSION_MAJOR < 22 // LLVM 20 & 21 (same config)
	array_add(&passes, u8R"(
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	ee-instrument<>,
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	sroa<modify-cfg>,
	early-cse<>,
	callsite-splitting
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		argpromotion,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			aggressive-instcombine,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				extra-simple-loop-unswitch-passes,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	float2int,
	lower-constant-intrinsics,
	chr,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-unroll<O3>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>
),
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify

)");

#else // LLVM 22
// Passes removed: coro, openmp
	array_add(&passes, u8R"(
memprof-remove-attributes,
annotation2metadata,
forceattrs,
inferattrs,
function<eager-inv>(
	ee-instrument<>,
	lower-expect,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	sroa<modify-cfg>,
	early-cse<>,
	callsite-splitting
),
ipsccp,
called-value-propagation,
globalopt,
function<eager-inv>(
	mem2reg,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>
),
always-inline,
require<globals-aa>,
function(
	invalidate<aa>
),
require<profile-summary>,
cgscc(
	devirt<4>(
		inline,
		function-attrs<skip-non-recursive-function-attrs>,
		argpromotion,
		function<eager-inv;no-rerun>(
			sroa<modify-cfg>,
			early-cse<memssa>,
			speculative-execution<only-if-divergent-target>,
			jump-threading,
			correlated-propagation,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			aggressive-instcombine,
			libcalls-shrinkwrap,
			tailcallelim,
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			reassociate,
			constraint-elimination,
			loop-mssa(
				loop-instsimplify,
				loop-simplifycfg,
				licm<no-allowspeculation>,
				loop-rotate<header-duplication;no-prepare-for-lto>,
				licm<allowspeculation>,
				simple-loop-unswitch<nontrivial;trivial>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			loop(
				loop-idiom,
				indvars,
				extra-simple-loop-unswitch-passes,
				loop-deletion,
				loop-unroll-full
			),
			sroa<modify-cfg>,
			vector-combine,
			mldst-motion<no-split-footer-bb>,
			gvn<>,
			sccp,
			bdce,
			instcombine<max-iterations=1;no-verify-fixpoint>,
			jump-threading,
			correlated-propagation,
			adce,
			memcpyopt,
			dse,
			move-auto-init,
			loop-mssa(
				licm<allowspeculation>
			),
			simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
			instcombine<max-iterations=1;no-verify-fixpoint>
		),
		function-attrs,
		function(
			require<should-not-run-function-passes>
		)
	)
),
deadargelim,
globalopt,
globaldce,
elim-avail-extern,
rpo-function-attrs,
recompute-globalsaa,
function<eager-inv>(
	drop-unnecessary-assumes,
	float2int,
	lower-constant-intrinsics,
	chr,
	loop(
		loop-rotate<header-duplication;no-prepare-for-lto>,
		loop-deletion
	),
	loop-distribute,
	inject-tli-mappings,
	loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,
	drop-unnecessary-assumes,
	infer-alignment,
	loop-load-elim,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,
	slp-vectorizer,
	vector-combine,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-unroll<O3>,
	transform-warning,
	sroa<preserve-cfg>,
	infer-alignment,
	instcombine<max-iterations=1;no-verify-fixpoint>,
	loop-mssa(
		licm<allowspeculation>
	),
	alignment-from-assumptions,
	loop-sink,
	instsimplify,
	div-rem-pairs,
	tailcallelim,
	simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>
),
alloc-token,
globaldce,
constmerge,
cg-profile,
rel-lookup-table-converter,
function(
	annotation-remarks
),
verify
)");

#endif
		break;
	}
