From 360c7ed497b73fe71e646ab094b789fe6d4c98f6 Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Wed, 29 Oct 2014 08:15:21 +0000 Subject: [PATCH] [OCaml] Synchronize transformations with LLVM-C. Also, rearrange the functions in a way that allows to quickly compare C headers and .mli/glue files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220842 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/ocaml/transforms/ipo/ipo_ocaml.c | 10 +- bindings/ocaml/transforms/ipo/llvm_ipo.ml | 70 ++-- bindings/ocaml/transforms/ipo/llvm_ipo.mli | 98 +++--- .../passmgr_builder/llvm_passmgr_builder.mli | 20 +- .../transforms/scalar/llvm_scalar_opts.ml | 218 +++++++------ .../transforms/scalar/llvm_scalar_opts.mli | 306 ++++++++++-------- .../transforms/scalar/scalar_opts_ocaml.c | 234 ++++++++------ .../transforms/vectorize/llvm_vectorize.ml | 15 +- .../transforms/vectorize/llvm_vectorize.mli | 17 +- test/Bindings/Ocaml/ipo_opts.ml | 4 +- test/Bindings/Ocaml/scalar_opts.ml | 51 +-- test/Bindings/Ocaml/vectorize_opts.ml | 2 +- 12 files changed, 572 insertions(+), 473 deletions(-) diff --git a/bindings/ocaml/transforms/ipo/ipo_ocaml.c b/bindings/ocaml/transforms/ipo/ipo_ocaml.c index 4ad8afbc9cc..9d8fb1eb711 100644 --- a/bindings/ocaml/transforms/ipo/ipo_ocaml.c +++ b/bindings/ocaml/transforms/ipo/ipo_ocaml.c @@ -55,12 +55,6 @@ CAMLprim value llvm_add_always_inliner(LLVMPassManagerRef PM) { return Val_unit; } -/* [`Module] Llvm.PassManager.t -> unit */ -CAMLprim value llvm_add_always_inliner_pass(LLVMPassManagerRef PM) { - LLVMAddAlwaysInlinerPass(PM); - return Val_unit; -} - /* [`Module] Llvm.PassManager.t -> unit */ CAMLprim value llvm_add_global_dce(LLVMPassManagerRef PM) { LLVMAddGlobalDCEPass(PM); @@ -74,7 +68,7 @@ CAMLprim value llvm_add_global_optimizer(LLVMPassManagerRef PM) { } /* [`Module] Llvm.PassManager.t -> unit */ -CAMLprim value llvm_add_ipc_propagation(LLVMPassManagerRef PM) { +CAMLprim value llvm_add_ip_constant_propagation(LLVMPassManagerRef PM) { LLVMAddIPConstantPropagationPass(PM); return Val_unit; } @@ -91,7 +85,7 @@ CAMLprim value llvm_add_ipsccp(LLVMPassManagerRef PM) { return Val_unit; } -/* [`Module] Llvm.PassManager.t -> bool -> unit */ +/* [`Module] Llvm.PassManager.t -> all_but_main:bool -> unit */ CAMLprim value llvm_add_internalize(LLVMPassManagerRef PM, value AllButMain) { LLVMAddInternalizePass(PM, Bool_val(AllButMain)); return Val_unit; diff --git a/bindings/ocaml/transforms/ipo/llvm_ipo.ml b/bindings/ocaml/transforms/ipo/llvm_ipo.ml index 93f564a1257..1af7d67eac5 100644 --- a/bindings/ocaml/transforms/ipo/llvm_ipo.ml +++ b/bindings/ocaml/transforms/ipo/llvm_ipo.ml @@ -7,31 +7,45 @@ * *===----------------------------------------------------------------------===*) -external add_argument_promotion : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_argument_promotion" -external add_constant_merge : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_constant_merge" -external add_dead_arg_elimination : - [ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_dead_arg_elimination" -external add_function_attrs : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_function_attrs" -external add_function_inlining : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_function_inlining" -external add_always_inliner : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_always_inliner" -external add_global_dce : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_global_dce" -external add_global_optimizer : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_global_optimizer" -external add_ipc_propagation : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_ipc_propagation" -external add_prune_eh : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_prune_eh" -external add_ipsccp : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_ipsccp" -external add_internalize : [ | `Module ] Llvm.PassManager.t -> bool -> unit = - "llvm_add_internalize" -external add_strip_dead_prototypes : - [ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_strip_dead_prototypes" -external add_strip_symbols : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_strip_symbols" +external add_argument_promotion + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_argument_promotion" +external add_constant_merge + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_constant_merge" +external add_dead_arg_elimination + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_dead_arg_elimination" +external add_function_attrs + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_function_attrs" +external add_function_inlining + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_function_inlining" +external add_always_inliner + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_always_inliner" +external add_global_dce + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_global_dce" +external add_global_optimizer + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_global_optimizer" +external add_ipc_propagation + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_ip_constant_propagation" +external add_prune_eh + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_prune_eh" +external add_ipsccp + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_ipsccp" +external add_internalize + : [ `Module ] Llvm.PassManager.t -> all_but_main:bool -> unit + = "llvm_add_internalize" +external add_strip_dead_prototypes + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_strip_dead_prototypes" +external add_strip_symbols + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_strip_symbols" diff --git a/bindings/ocaml/transforms/ipo/llvm_ipo.mli b/bindings/ocaml/transforms/ipo/llvm_ipo.mli index 1944c30b06c..09a4860b91e 100644 --- a/bindings/ocaml/transforms/ipo/llvm_ipo.mli +++ b/bindings/ocaml/transforms/ipo/llvm_ipo.mli @@ -12,58 +12,72 @@ This interface provides an OCaml API for LLVM interprocedural optimizations, the classes in the [LLVMIPO] library. *) -(** See llvm::createAddArgumentPromotionPass *) -external add_argument_promotion : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_argument_promotion" +(** See the [llvm::createAddArgumentPromotionPass] function. *) +external add_argument_promotion + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_argument_promotion" -(** See llvm::createConstantMergePass function. *) -external add_constant_merge : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_constant_merge" +(** See the [llvm::createConstantMergePass] function. *) +external add_constant_merge + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_constant_merge" -(** See llvm::createDeadArgEliminationPass function. *) -external add_dead_arg_elimination : - [ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_dead_arg_elimination" +(** See the [llvm::createDeadArgEliminationPass] function. *) +external add_dead_arg_elimination + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_dead_arg_elimination" -(** See llvm::createFunctionAttrsPass function. *) -external add_function_attrs : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_function_attrs" +(** See the [llvm::createFunctionAttrsPass] function. *) +external add_function_attrs + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_function_attrs" -(** See llvm::createFunctionInliningPass function. *) -external add_function_inlining : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_function_inlining" +(** See the [llvm::createFunctionInliningPass] function. *) +external add_function_inlining + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_function_inlining" -(** See llvm::createAlwaysInlinerPass function. *) -external add_always_inliner : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_always_inliner" +(** See the [llvm::createAlwaysInlinerPass] function. *) +external add_always_inliner + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_always_inliner" -(** See llvm::createGlobalDCEPass function. *) -external add_global_dce : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_global_dce" +(** See the [llvm::createGlobalDCEPass] function. *) +external add_global_dce + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_global_dce" -(** See llvm::createGlobalOptimizerPass function. *) -external add_global_optimizer : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_global_optimizer" +(** See the [llvm::createGlobalOptimizerPass] function. *) +external add_global_optimizer + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_global_optimizer" -(** See llvm::createIPConstantPropagationPass function. *) -external add_ipc_propagation : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_ipc_propagation" +(** See the [llvm::createIPConstantPropagationPass] function. *) +external add_ipc_propagation + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_ip_constant_propagation" -(** See llvm::createPruneEHPass function. *) -external add_prune_eh : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_prune_eh" +(** See the [llvm::createPruneEHPass] function. *) +external add_prune_eh + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_prune_eh" -(** See llvm::createIPSCCPPass function. *) -external add_ipsccp : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_ipsccp" +(** See the [llvm::createIPSCCPPass] function. *) +external add_ipsccp + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_ipsccp" -(** See llvm::createInternalizePass function. *) -external add_internalize : [ | `Module ] Llvm.PassManager.t -> bool -> unit = - "llvm_add_internalize" +(** See the [llvm::createInternalizePass] function. *) +external add_internalize + : [ `Module ] Llvm.PassManager.t -> all_but_main:bool -> unit + = "llvm_add_internalize" -(** See llvm::createStripDeadPrototypesPass function. *) -external add_strip_dead_prototypes : - [ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_strip_dead_prototypes" +(** See the [llvm::createStripDeadPrototypesPass] function. *) +external add_strip_dead_prototypes + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_strip_dead_prototypes" -(** See llvm::createStripSymbolsPass function. *) -external add_strip_symbols : [ | `Module ] Llvm.PassManager.t -> unit = - "llvm_add_strip_symbols" +(** See the [llvm::createStripSymbolsPass] function. *) +external add_strip_symbols + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_strip_symbols" diff --git a/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli b/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli index 66b0981ea24..ce162b1213f 100644 --- a/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli +++ b/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli @@ -14,41 +14,41 @@ type t -(** See [llvm::PassManagerBuilder]. *) +(** See the [llvm::PassManagerBuilder] function. *) external create : unit -> t = "llvm_pmbuilder_create" -(** See [llvm::PassManagerBuilder::OptLevel]. *) +(** See the [llvm::PassManagerBuilder::OptLevel] function. *) external set_opt_level : int -> t -> unit = "llvm_pmbuilder_set_opt_level" -(** See [llvm::PassManagerBuilder::SizeLevel]. *) +(** See the [llvm::PassManagerBuilder::SizeLevel] function. *) external set_size_level : int -> t -> unit = "llvm_pmbuilder_set_size_level" -(** See [llvm::PassManagerBuilder::DisableUnitAtATime]. *) +(** See the [llvm::PassManagerBuilder::DisableUnitAtATime] function. *) external set_disable_unit_at_a_time : bool -> t -> unit = "llvm_pmbuilder_set_disable_unit_at_a_time" -(** See [llvm::PassManagerBuilder::DisableUnrollLoops]. *) +(** See the [llvm::PassManagerBuilder::DisableUnrollLoops] function. *) external set_disable_unroll_loops : bool -> t -> unit = "llvm_pmbuilder_set_disable_unroll_loops" -(** See [llvm::PassManagerBuilder::Inliner]. *) +(** See the [llvm::PassManagerBuilder::Inliner] function. *) external use_inliner_with_threshold : int -> t -> unit = "llvm_pmbuilder_use_inliner_with_threshold" -(** See [llvm::PassManagerBuilder::populateFunctionPassManager]. *) +(** See the [llvm::PassManagerBuilder::populateFunctionPassManager] function. *) external populate_function_pass_manager : [ `Function ] Llvm.PassManager.t -> t -> unit = "llvm_pmbuilder_populate_function_pass_manager" -(** See [llvm::PassManagerBuilder::populateModulePassManager]. *) +(** See the [llvm::PassManagerBuilder::populateModulePassManager] function. *) external populate_module_pass_manager : [ `Module ] Llvm.PassManager.t -> t -> unit = "llvm_pmbuilder_populate_module_pass_manager" -(** See [llvm::PassManagerBuilder::populateLTOPassManager]. *) +(** See the [llvm::PassManagerBuilder::populateLTOPassManager] function. *) external populate_lto_pass_manager : [ `Module ] Llvm.PassManager.t -> internalize:bool -> run_inliner:bool -> t -> unit - = "llvm_pmbuilder_populate_lto_pass_manager" \ No newline at end of file + = "llvm_pmbuilder_populate_lto_pass_manager" diff --git a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml index 3035b103f13..b90d0aecd2a 100644 --- a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml +++ b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml @@ -1,4 +1,4 @@ -(*===-- llvm_scalar_opts.ml - LLVM OCaml Interface -------------*- OCaml -*-===* +(*===-- llvm_scalar_opts.ml - LLVM OCaml Interface ------------*- OCaml -*-===* * * The LLVM Compiler Infrastructure * @@ -7,108 +7,114 @@ * *===----------------------------------------------------------------------===*) -external add_constant_propagation : [ unit - = "llvm_add_constant_propagation" -external add_sccp : [ unit - = "llvm_add_sccp" -external add_dead_store_elimination : [ unit - = "llvm_add_dead_store_elimination" -external add_aggressive_dce : [ unit - = "llvm_add_aggressive_dce" -external -add_scalar_repl_aggregation : [ unit - = "llvm_add_scalar_repl_aggregation" - -external -add_scalar_repl_aggregation_ssa : [ unit - = "llvm_add_scalar_repl_aggregation_ssa" - -external -add_scalar_repl_aggregation_with_threshold : int -> [ unit - = "llvm_add_scalar_repl_aggregation_with_threshold" -external add_ind_var_simplification : [ unit - = "llvm_add_ind_var_simplification" -external -add_instruction_combination : [ unit - = "llvm_add_instruction_combination" -external add_licm : [ unit - = "llvm_add_licm" -external add_loop_unswitch : [ unit - = "llvm_add_loop_unswitch" -external add_loop_unroll : [ unit - = "llvm_add_loop_unroll" -external add_loop_rotation : [ unit - = "llvm_add_loop_rotation" -external -add_memory_to_register_promotion : [ unit - = "llvm_add_memory_to_register_promotion" -external -add_memory_to_register_demotion : [ unit - = "llvm_add_memory_to_register_demotion" -external add_reassociation : [ unit - = "llvm_add_reassociation" -external add_jump_threading : [ unit - = "llvm_add_jump_threading" -external add_cfg_simplification : [ unit - = "llvm_add_cfg_simplification" -external -add_tail_call_elimination : [ unit - = "llvm_add_tail_call_elimination" -external add_gvn : [ unit - = "llvm_add_gvn" -external add_memcpy_opt : [ unit - = "llvm_add_memcpy_opt" -external add_loop_deletion : [ unit - = "llvm_add_loop_deletion" - -external add_loop_idiom : [ unit - = "llvm_add_loop_idiom" - -external -add_lib_call_simplification : [ unit - = "llvm_add_lib_call_simplification" - -external -add_verifier : [ unit - = "llvm_add_verifier" - -external -add_correlated_value_propagation : [ unit - = "llvm_add_correlated_value_propagation" - -external -add_early_cse : [ unit - = "llvm_add_early_cse" - -external -add_lower_expect_intrinsic : [ unit - = "llvm_add_lower_expect_intrinsic" - -external -add_type_based_alias_analysis : [ unit - = "llvm_add_type_based_alias_analysis" - -external -add_basic_alias_analysis : [ unit - = "llvm_add_basic_alias_analysis" - -external -add_partially_inline_lib_calls : [ unit - = "llvm_add_partially_inline_lib_calls" +external add_aggressive_dce + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_aggressive_dce" +external add_alignment_from_assumptions + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_alignment_from_assumptions" +external add_cfg_simplification + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_cfg_simplification" +external add_dead_store_elimination + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_dead_store_elimination" +external add_scalarizer + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalarizer" +external add_merged_load_store_motion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_merged_load_store_motion" +external add_gvn + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_gvn" +external add_ind_var_simplification + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_ind_var_simplify" +external add_instruction_combination + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_instruction_combining" +external add_jump_threading + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_jump_threading" +external add_licm + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_licm" +external add_loop_deletion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_deletion" +external add_loop_idiom + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_idiom" +external add_loop_rotation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_rotate" +external add_loop_reroll + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_reroll" +external add_loop_unroll + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_unroll" +external add_loop_unswitch + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_unswitch" +external add_memcpy_opt + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_memcpy_opt" +external add_partially_inline_lib_calls + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_partially_inline_lib_calls" +external add_lower_switch + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_lower_switch" +external add_memory_to_register_promotion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_promote_memory_to_register" +external add_reassociation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_reassociation" +external add_sccp + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_sccp" +external add_scalar_repl_aggregation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalar_repl_aggregates" +external add_scalar_repl_aggregation_ssa + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalar_repl_aggregates_ssa" +external add_scalar_repl_aggregation_with_threshold + : int -> [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalar_repl_aggregates_with_threshold" +external add_lib_call_simplification + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_simplify_lib_calls" +external add_tail_call_elimination + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_tail_call_elimination" +external add_constant_propagation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_constant_propagation" +external add_memory_to_register_demotion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_demote_memory_to_register" +external add_verifier + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_verifier" +external add_correlated_value_propagation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_correlated_value_propagation" +external add_early_cse + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_early_cse" +external add_lower_expect_intrinsic + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_lower_expect_intrinsic" +external add_type_based_alias_analysis + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_type_based_alias_analysis" +external add_scoped_no_alias_alias_analysis + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scoped_no_alias_aa" +external add_basic_alias_analysis + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_basic_alias_analysis" diff --git a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli index ca900d9cd68..b4cefed76d5 100644 --- a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli +++ b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli @@ -1,4 +1,4 @@ -(*===-- llvm_scalar_opts.mli - LLVM OCaml Interface ------------*- OCaml -*-===* +(*===-- llvm_scalar_opts.mli - LLVM OCaml Interface -----------*- OCaml -*-===* * * The LLVM Compiler Infrastructure * @@ -12,157 +12,187 @@ This interface provides an OCaml API for LLVM scalar transforms, the classes in the [LLVMScalarOpts] library. *) -(** See the [llvm::createConstantPropagationPass] function. *) -external add_constant_propagation : [ unit - = "llvm_add_constant_propagation" +(** See the [llvm::createAggressiveDCEPass] function. *) +external add_aggressive_dce + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_aggressive_dce" -(** See the [llvm::createSCCPPass] function. *) -external add_sccp : [ unit - = "llvm_add_sccp" - -(** See [llvm::createDeadStoreEliminationPass] function. *) -external add_dead_store_elimination : [ unit - = "llvm_add_dead_store_elimination" - -(** See The [llvm::createAggressiveDCEPass] function. *) -external add_aggressive_dce : [ unit - = "llvm_add_aggressive_dce" - -(** See the [llvm::createScalarReplAggregatesPass] function. *) -external -add_scalar_repl_aggregation : [ unit - = "llvm_add_scalar_repl_aggregation" - -(** See the [llvm::createScalarReplAggregatesPassSSA] function. *) -external -add_scalar_repl_aggregation_ssa : [ unit - = "llvm_add_scalar_repl_aggregation_ssa" - -(** See the [llvm::createScalarReplAggregatesWithThreshold] function. *) -external -add_scalar_repl_aggregation_with_threshold : int -> [ unit - = "llvm_add_scalar_repl_aggregation_with_threshold" - -(** See the [llvm::createIndVarSimplifyPass] function. *) -external add_ind_var_simplification : [ unit - = "llvm_add_ind_var_simplification" - -(** See the [llvm::createInstructionCombiningPass] function. *) -external -add_instruction_combination : [ unit - = "llvm_add_instruction_combination" - -(** See the [llvm::createLICMPass] function. *) -external add_licm : [ unit - = "llvm_add_licm" - -(** See the [llvm::createLoopUnswitchPass] function. *) -external add_loop_unswitch : [ unit - = "llvm_add_loop_unswitch" - -(** See the [llvm::createLoopUnrollPass] function. *) -external add_loop_unroll : [ unit - = "llvm_add_loop_unroll" - -(** See the [llvm::createLoopRotatePass] function. *) -external add_loop_rotation : [ unit - = "llvm_add_loop_rotation" - -(** See the [llvm::createPromoteMemoryToRegisterPass] function. *) -external -add_memory_to_register_promotion : [ unit - = "llvm_add_memory_to_register_promotion" - -(** See the [llvm::createDemoteMemoryToRegisterPass] function. *) -external -add_memory_to_register_demotion : [ unit - = "llvm_add_memory_to_register_demotion" - -(** See the [llvm::createReassociatePass] function. *) -external add_reassociation : [ unit - = "llvm_add_reassociation" - -(** See the [llvm::createJumpThreadingPass] function. *) -external add_jump_threading : [ unit - = "llvm_add_jump_threading" +(** See the [llvm::createAlignmentFromAssumptionsPass] function. *) +external add_alignment_from_assumptions + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_alignment_from_assumptions" (** See the [llvm::createCFGSimplificationPass] function. *) -external add_cfg_simplification : [ unit - = "llvm_add_cfg_simplification" +external add_cfg_simplification + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_cfg_simplification" -(** See the [llvm::createTailCallEliminationPass] function. *) -external -add_tail_call_elimination : [ unit - = "llvm_add_tail_call_elimination" +(** See [llvm::createDeadStoreEliminationPass] function. *) +external add_dead_store_elimination + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_dead_store_elimination" + +(** See [llvm::createScalarizerPass] function. *) +external add_scalarizer + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalarizer" + +(** See [llvm::createMergedLoadStoreMotionPass] function. *) +external add_merged_load_store_motion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_merged_load_store_motion" (** See the [llvm::createGVNPass] function. *) -external add_gvn : [ unit - = "llvm_add_gvn" +external add_gvn + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_gvn" -(** See the [llvm::createMemCpyOptPass] function. *) -external add_memcpy_opt : [ unit - = "llvm_add_memcpy_opt" +(** See the [llvm::createIndVarSimplifyPass] function. *) +external add_ind_var_simplification + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_ind_var_simplify" + +(** See the [llvm::createInstructionCombiningPass] function. *) +external add_instruction_combination + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_instruction_combining" + +(** See the [llvm::createJumpThreadingPass] function. *) +external add_jump_threading + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_jump_threading" + +(** See the [llvm::createLICMPass] function. *) +external add_licm + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_licm" (** See the [llvm::createLoopDeletionPass] function. *) -external add_loop_deletion : [ unit - = "llvm_add_loop_deletion" +external add_loop_deletion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_deletion" -external add_loop_idiom : [ unit - = "llvm_add_loop_idiom" +(** See the [llvm::createLoopIdiomPass] function. *) +external add_loop_idiom + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_idiom" -(** See the [llvm::createSimplifyLibCallsPass] function. *) -external -add_lib_call_simplification : [ unit - = "llvm_add_lib_call_simplification" +(** See the [llvm::createLoopRotatePass] function. *) +external add_loop_rotation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_rotate" -(** See the [llvm::createVerifierPass] function. *) -external -add_verifier : [ unit - = "llvm_add_verifier" +(** See the [llvm::createLoopRerollPass] function. *) +external add_loop_reroll + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_reroll" -(** See the [llvm::createCorrelatedValuePropagationPass] function. *) -external -add_correlated_value_propagation : [ unit - = "llvm_add_correlated_value_propagation" +(** See the [llvm::createLoopUnrollPass] function. *) +external add_loop_unroll + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_unroll" -(** See the [llvm::createEarlyCSE] function. *) -external -add_early_cse : [ unit - = "llvm_add_early_cse" +(** See the [llvm::createLoopUnswitchPass] function. *) +external add_loop_unswitch + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_loop_unswitch" -(** See the [llvm::createLowerExpectIntrinsicPass] function. *) -external -add_lower_expect_intrinsic : [ unit - = "llvm_add_lower_expect_intrinsic" - -(** See the [llvm::createTypeBasedAliasAnalysisPass] function. *) -external -add_type_based_alias_analysis : [ unit - = "llvm_add_type_based_alias_analysis" - -(** See the [llvm::createBasicAliasAnalysisPass] function. *) -external -add_basic_alias_analysis : [ unit - = "llvm_add_basic_alias_analysis" +(** See the [llvm::createMemCpyOptPass] function. *) +external add_memcpy_opt + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_memcpy_opt" (** See the [llvm::createPartiallyInlineLibCallsPass] function. *) -external -add_partially_inline_lib_calls : [ unit - = "llvm_add_partially_inline_lib_calls" +external add_partially_inline_lib_calls + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_partially_inline_lib_calls" + +(** See the [llvm::createLowerSwitchPass] function. *) +external add_lower_switch + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_lower_switch" + +(** See the [llvm::createPromoteMemoryToRegisterPass] function. *) +external add_memory_to_register_promotion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_promote_memory_to_register" + +(** See the [llvm::createReassociatePass] function. *) +external add_reassociation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_reassociation" + +(** See the [llvm::createSCCPPass] function. *) +external add_sccp + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_sccp" + +(** See the [llvm::createScalarReplAggregatesPass] function. *) +external add_scalar_repl_aggregation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalar_repl_aggregates" + +(** See the [llvm::createScalarReplAggregatesPassSSA] function. *) +external add_scalar_repl_aggregation_ssa + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalar_repl_aggregates_ssa" + +(** See the [llvm::createScalarReplAggregatesWithThreshold] function. *) +external add_scalar_repl_aggregation_with_threshold + : int -> [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scalar_repl_aggregates_with_threshold" + +(** See the [llvm::createSimplifyLibCallsPass] function. *) +external add_lib_call_simplification + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_simplify_lib_calls" + +(** See the [llvm::createTailCallEliminationPass] function. *) +external add_tail_call_elimination + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_tail_call_elimination" + +(** See the [llvm::createConstantPropagationPass] function. *) +external add_constant_propagation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_constant_propagation" + +(** See the [llvm::createDemoteMemoryToRegisterPass] function. *) +external add_memory_to_register_demotion + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_demote_memory_to_register" + +(** See the [llvm::createVerifierPass] function. *) +external add_verifier + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_verifier" + +(** See the [llvm::createCorrelatedValuePropagationPass] function. *) +external add_correlated_value_propagation + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_correlated_value_propagation" + +(** See the [llvm::createEarlyCSE] function. *) +external add_early_cse + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_early_cse" + +(** See the [llvm::createLowerExpectIntrinsicPass] function. *) +external add_lower_expect_intrinsic + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_lower_expect_intrinsic" + +(** See the [llvm::createTypeBasedAliasAnalysisPass] function. *) +external add_type_based_alias_analysis + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_type_based_alias_analysis" + +(** See the [llvm::createScopedNoAliasAAPass] function. *) +external add_scoped_no_alias_alias_analysis + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_scoped_no_alias_aa" + +(** See the [llvm::createBasicAliasAnalysisPass] function. *) +external add_basic_alias_analysis + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_basic_alias_analysis" diff --git a/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c b/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c index 47e17902baa..bae4e31710e 100644 --- a/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c +++ b/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c @@ -19,24 +19,6 @@ #include "caml/mlvalues.h" #include "caml/misc.h" -/* [ unit */ -CAMLprim value llvm_add_constant_propagation(LLVMPassManagerRef PM) { - LLVMAddConstantPropagationPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_sccp(LLVMPassManagerRef PM) { - LLVMAddSCCPPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_dead_store_elimination(LLVMPassManagerRef PM) { - LLVMAddDeadStoreEliminationPass(PM); - return Val_unit; -} - /* [ unit */ CAMLprim value llvm_add_aggressive_dce(LLVMPassManagerRef PM) { LLVMAddAggressiveDCEPass(PM); @@ -44,81 +26,8 @@ CAMLprim value llvm_add_aggressive_dce(LLVMPassManagerRef PM) { } /* [ unit */ -CAMLprim value llvm_add_scalar_repl_aggregation(LLVMPassManagerRef PM) { - LLVMAddScalarReplAggregatesPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_scalar_repl_aggregation_ssa(LLVMPassManagerRef PM) { - LLVMAddScalarReplAggregatesPassSSA(PM); - return Val_unit; -} - -/* [ int -> unit */ -CAMLprim value llvm_add_scalar_repl_aggregation_with_threshold(value threshold, - LLVMPassManagerRef PM) { - LLVMAddScalarReplAggregatesPassWithThreshold(PM, Int_val(threshold)); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_ind_var_simplification(LLVMPassManagerRef PM) { - LLVMAddIndVarSimplifyPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_instruction_combination(LLVMPassManagerRef PM) { - LLVMAddInstructionCombiningPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_licm(LLVMPassManagerRef PM) { - LLVMAddLICMPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_loop_unswitch(LLVMPassManagerRef PM) { - LLVMAddLoopUnswitchPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_loop_unroll(LLVMPassManagerRef PM) { - LLVMAddLoopUnrollPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_loop_rotation(LLVMPassManagerRef PM) { - LLVMAddLoopRotatePass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_memory_to_register_promotion(LLVMPassManagerRef PM) { - LLVMAddPromoteMemoryToRegisterPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_memory_to_register_demotion(LLVMPassManagerRef PM) { - LLVMAddDemoteMemoryToRegisterPass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_reassociation(LLVMPassManagerRef PM) { - LLVMAddReassociatePass(PM); - return Val_unit; -} - -/* [ unit */ -CAMLprim value llvm_add_jump_threading(LLVMPassManagerRef PM) { - LLVMAddJumpThreadingPass(PM); +CAMLprim value llvm_add_alignment_from_assumptions(LLVMPassManagerRef PM) { + LLVMAddAlignmentFromAssumptionsPass(PM); return Val_unit; } @@ -129,8 +38,14 @@ CAMLprim value llvm_add_cfg_simplification(LLVMPassManagerRef PM) { } /* [ unit */ -CAMLprim value llvm_add_tail_call_elimination(LLVMPassManagerRef PM) { - LLVMAddTailCallEliminationPass(PM); +CAMLprim value llvm_add_dead_store_elimination(LLVMPassManagerRef PM) { + LLVMAddDeadStoreEliminationPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_scalarizer(LLVMPassManagerRef PM) { + LLVMAddScalarizerPass(PM); return Val_unit; } @@ -147,8 +62,26 @@ CAMLprim value llvm_add_gvn(LLVMPassManagerRef PM) { } /* [ unit */ -CAMLprim value llvm_add_memcpy_opt(LLVMPassManagerRef PM) { - LLVMAddMemCpyOptPass(PM); +CAMLprim value llvm_add_ind_var_simplify(LLVMPassManagerRef PM) { + LLVMAddIndVarSimplifyPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_instruction_combining(LLVMPassManagerRef PM) { + LLVMAddInstructionCombiningPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_jump_threading(LLVMPassManagerRef PM) { + LLVMAddJumpThreadingPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_licm(LLVMPassManagerRef PM) { + LLVMAddLICMPass(PM); return Val_unit; } @@ -165,11 +98,108 @@ CAMLprim value llvm_add_loop_idiom(LLVMPassManagerRef PM) { } /* [ unit */ -CAMLprim value llvm_add_lib_call_simplification(LLVMPassManagerRef PM) { +CAMLprim value llvm_add_loop_rotate(LLVMPassManagerRef PM) { + LLVMAddLoopRotatePass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_loop_reroll(LLVMPassManagerRef PM) { + LLVMAddLoopRerollPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_loop_unroll(LLVMPassManagerRef PM) { + LLVMAddLoopUnrollPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_loop_unswitch(LLVMPassManagerRef PM) { + LLVMAddLoopUnswitchPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_memcpy_opt(LLVMPassManagerRef PM) { + LLVMAddMemCpyOptPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_partially_inline_lib_calls(LLVMPassManagerRef PM) { + LLVMAddPartiallyInlineLibCallsPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_lower_switch(LLVMPassManagerRef PM) { + LLVMAddLowerSwitchPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_promote_memory_to_register(LLVMPassManagerRef PM) { + LLVMAddPromoteMemoryToRegisterPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_reassociation(LLVMPassManagerRef PM) { + LLVMAddReassociatePass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_sccp(LLVMPassManagerRef PM) { + LLVMAddSCCPPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_scalar_repl_aggregates(LLVMPassManagerRef PM) { + LLVMAddScalarReplAggregatesPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_scalar_repl_aggregates_ssa(LLVMPassManagerRef PM) { + LLVMAddScalarReplAggregatesPassSSA(PM); + return Val_unit; +} + +/* int -> [ unit */ +CAMLprim value llvm_add_scalar_repl_aggregates_with_threshold(value threshold, + LLVMPassManagerRef PM) { + LLVMAddScalarReplAggregatesPassWithThreshold(PM, Int_val(threshold)); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_simplify_lib_calls(LLVMPassManagerRef PM) { LLVMAddSimplifyLibCallsPass(PM); return Val_unit; } +/* [ unit */ +CAMLprim value llvm_add_tail_call_elimination(LLVMPassManagerRef PM) { + LLVMAddTailCallEliminationPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_constant_propagation(LLVMPassManagerRef PM) { + LLVMAddConstantPropagationPass(PM); + return Val_unit; +} + +/* [ unit */ +CAMLprim value llvm_add_demote_memory_to_register(LLVMPassManagerRef PM) { + LLVMAddDemoteMemoryToRegisterPass(PM); + return Val_unit; +} + /* [ unit */ CAMLprim value llvm_add_verifier(LLVMPassManagerRef PM) { LLVMAddVerifierPass(PM); @@ -201,13 +231,13 @@ CAMLprim value llvm_add_type_based_alias_analysis(LLVMPassManagerRef PM) { } /* [ unit */ -CAMLprim value llvm_add_basic_alias_analysis(LLVMPassManagerRef PM) { - LLVMAddBasicAliasAnalysisPass(PM); +CAMLprim value llvm_add_scoped_no_alias_aa(LLVMPassManagerRef PM) { + LLVMAddScopedNoAliasAAPass(PM); return Val_unit; } /* [ unit */ -CAMLprim value llvm_add_partially_inline_lib_calls(LLVMPassManagerRef PM) { - LLVMAddPartiallyInlineLibCallsPass(PM); +CAMLprim value llvm_add_basic_alias_analysis(LLVMPassManagerRef PM) { + LLVMAddBasicAliasAnalysisPass(PM); return Val_unit; } diff --git a/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml b/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml index 4fc53c6da3e..88831daf519 100644 --- a/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml +++ b/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml @@ -7,9 +7,12 @@ * *===----------------------------------------------------------------------===*) -external add_bb_vectorize : [ unit - = "llvm_add_bb_vectorize" -external add_loop_vectorize : [ unit - = "llvm_add_loop_vectorize" -external add_slp_vectorize : [ unit - = "llvm_add_slp_vectorize" +external add_bb_vectorize + : [ unit + = "llvm_add_bb_vectorize" +external add_loop_vectorize + : [ unit + = "llvm_add_loop_vectorize" +external add_slp_vectorize + : [ unit + = "llvm_add_slp_vectorize" diff --git a/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli b/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli index 02530398512..23a68a28dad 100644 --- a/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli +++ b/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli @@ -13,13 +13,16 @@ classes in the [LLVMVectorize] library. *) (** See the [llvm::createBBVectorizePass] function. *) -external add_bb_vectorize : [ unit - = "llvm_add_bb_vectorize" +external add_bb_vectorize + : [ unit + = "llvm_add_bb_vectorize" (** See the [llvm::createLoopVectorizePass] function. *) -external add_loop_vectorize : [ unit - = "llvm_add_loop_vectorize" +external add_loop_vectorize + : [ unit + = "llvm_add_loop_vectorize" -(** See [llvm::createSLPVectorizerPass] function. *) -external add_slp_vectorize : [ unit - = "llvm_add_slp_vectorize" +(** See the [llvm::createSLPVectorizerPass] function. *) +external add_slp_vectorize + : [ unit + = "llvm_add_slp_vectorize" diff --git a/test/Bindings/Ocaml/ipo_opts.ml b/test/Bindings/Ocaml/ipo_opts.ml index 50fc303a358..d79006e5610 100644 --- a/test/Bindings/Ocaml/ipo_opts.ml +++ b/test/Bindings/Ocaml/ipo_opts.ml @@ -36,7 +36,7 @@ let m = create_module context filename (*===-- Transforms --------------------------------------------------------===*) let test_transforms () = - let (++) x f = ignore (f x); x in + let (++) x f = f x; x in let fty = function_type i8_type [| |] in let fn = define_function "fn" fty m in @@ -58,7 +58,7 @@ let test_transforms () = ++ add_ipc_propagation ++ add_prune_eh ++ add_ipsccp - ++ add_internalize + ++ add_internalize ~all_but_main:true ++ add_strip_dead_prototypes ++ add_strip_symbols ++ PassManager.run_module m diff --git a/test/Bindings/Ocaml/scalar_opts.ml b/test/Bindings/Ocaml/scalar_opts.ml index c6069bd2c17..1ae4fe9d2a9 100644 --- a/test/Bindings/Ocaml/scalar_opts.ml +++ b/test/Bindings/Ocaml/scalar_opts.ml @@ -35,45 +35,50 @@ let m = create_module context filename (*===-- Transforms --------------------------------------------------------===*) let test_transforms () = - let (++) x f = ignore (f x); x in + let (++) x f = f x; x in let fty = function_type void_type [| |] in let fn = define_function "fn" fty m in ignore (build_ret_void (builder_at_end context (entry_block fn))); ignore (PassManager.create_function m - ++ add_verifier - ++ add_constant_propagation - ++ add_sccp - ++ add_dead_store_elimination ++ add_aggressive_dce + ++ add_alignment_from_assumptions + ++ add_cfg_simplification + ++ add_dead_store_elimination + ++ add_scalarizer + ++ add_merged_load_store_motion + ++ add_gvn + ++ add_ind_var_simplification + ++ add_instruction_combination + ++ add_jump_threading + ++ add_licm + ++ add_loop_deletion + ++ add_loop_idiom + ++ add_loop_rotation + ++ add_loop_reroll + ++ add_loop_unroll + ++ add_loop_unswitch + ++ add_memcpy_opt + ++ add_partially_inline_lib_calls + ++ add_lower_switch + ++ add_memory_to_register_promotion + ++ add_reassociation + ++ add_sccp ++ add_scalar_repl_aggregation ++ add_scalar_repl_aggregation_ssa ++ add_scalar_repl_aggregation_with_threshold 4 - ++ add_ind_var_simplification - ++ add_instruction_combination - ++ add_licm - ++ add_loop_unswitch - ++ add_loop_unroll - ++ add_loop_rotation - ++ add_memory_to_register_promotion - ++ add_memory_to_register_demotion - ++ add_reassociation - ++ add_jump_threading - ++ add_cfg_simplification - ++ add_tail_call_elimination - ++ add_gvn - ++ add_memcpy_opt - ++ add_loop_deletion - ++ add_loop_idiom ++ add_lib_call_simplification + ++ add_tail_call_elimination + ++ add_constant_propagation + ++ add_memory_to_register_demotion + ++ add_verifier ++ add_correlated_value_propagation ++ add_early_cse ++ add_lower_expect_intrinsic ++ add_type_based_alias_analysis + ++ add_scoped_no_alias_alias_analysis ++ add_basic_alias_analysis - ++ add_partially_inline_lib_calls - ++ add_verifier ++ PassManager.initialize ++ PassManager.run_function fn ++ PassManager.finalize diff --git a/test/Bindings/Ocaml/vectorize_opts.ml b/test/Bindings/Ocaml/vectorize_opts.ml index 05bbfe227f6..08f15d37a1b 100644 --- a/test/Bindings/Ocaml/vectorize_opts.ml +++ b/test/Bindings/Ocaml/vectorize_opts.ml @@ -35,7 +35,7 @@ let m = create_module context filename (*===-- Transforms --------------------------------------------------------===*) let test_transforms () = - let (++) x f = ignore (f x); x in + let (++) x f = f x; x in let fty = function_type void_type [| |] in let fn = define_function "fn" fty m in