Index: llvm/trunk/bindings/ocaml/transforms/ipo/ipo_ocaml.c =================================================================== --- llvm/trunk/bindings/ocaml/transforms/ipo/ipo_ocaml.c +++ llvm/trunk/bindings/ocaml/transforms/ipo/ipo_ocaml.c @@ -32,6 +32,12 @@ } /* [`Module] Llvm.PassManager.t -> unit */ +CAMLprim value llvm_add_merge_functions(LLVMPassManagerRef PM) { + LLVMAddMergeFunctionsPass(PM); + return Val_unit; +} + +/* [`Module] Llvm.PassManager.t -> unit */ CAMLprim value llvm_add_dead_arg_elimination(LLVMPassManagerRef PM) { LLVMAddDeadArgEliminationPass(PM); return Val_unit; Index: llvm/trunk/bindings/ocaml/transforms/ipo/llvm_ipo.ml =================================================================== --- llvm/trunk/bindings/ocaml/transforms/ipo/llvm_ipo.ml +++ llvm/trunk/bindings/ocaml/transforms/ipo/llvm_ipo.ml @@ -12,6 +12,9 @@ external add_constant_merge : [ `Module ] Llvm.PassManager.t -> unit = "llvm_add_constant_merge" +external add_merge_functions + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_merge_functions" external add_dead_arg_elimination : [ `Module ] Llvm.PassManager.t -> unit = "llvm_add_dead_arg_elimination" Index: llvm/trunk/bindings/ocaml/transforms/ipo/llvm_ipo.mli =================================================================== --- llvm/trunk/bindings/ocaml/transforms/ipo/llvm_ipo.mli +++ llvm/trunk/bindings/ocaml/transforms/ipo/llvm_ipo.mli @@ -21,6 +21,11 @@ : [ `Module ] Llvm.PassManager.t -> unit = "llvm_add_constant_merge" +(** See the [llvm::createMergeFunctionsPass] function. *) +external add_merge_functions + : [ `Module ] Llvm.PassManager.t -> unit + = "llvm_add_merge_functions" + (** See the [llvm::createDeadArgEliminationPass] function. *) external add_dead_arg_elimination : [ `Module ] Llvm.PassManager.t -> unit Index: llvm/trunk/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml =================================================================== --- llvm/trunk/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml +++ llvm/trunk/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml @@ -9,6 +9,9 @@ external add_aggressive_dce : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit = "llvm_add_aggressive_dce" +external add_dce + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_dce" external add_alignment_from_assumptions : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit = "llvm_add_alignment_from_assumptions" Index: llvm/trunk/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli =================================================================== --- llvm/trunk/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli +++ llvm/trunk/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli @@ -16,6 +16,11 @@ : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit = "llvm_add_aggressive_dce" +(** See the [llvm::createDCEPass] function. *) +external add_dce + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_dce" + (** See the [llvm::createAlignmentFromAssumptionsPass] function. *) external add_alignment_from_assumptions : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit Index: llvm/trunk/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c =================================================================== --- llvm/trunk/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c +++ llvm/trunk/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c @@ -26,6 +26,11 @@ return Val_unit; } +CAMLprim value llvm_add_dce(LLVMPassManagerRef PM) { + LLVMAddDCEPass(PM); + return Val_unit; +} + /* [ unit */ CAMLprim value llvm_add_alignment_from_assumptions(LLVMPassManagerRef PM) { LLVMAddAlignmentFromAssumptionsPass(PM); Index: llvm/trunk/include/llvm-c/Transforms/IPO.h =================================================================== --- llvm/trunk/include/llvm-c/Transforms/IPO.h +++ llvm/trunk/include/llvm-c/Transforms/IPO.h @@ -34,6 +34,9 @@ /** See llvm::createConstantMergePass function. */ void LLVMAddConstantMergePass(LLVMPassManagerRef PM); +/** See llvm::createMergeFunctionsPass function. */ +void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM); + /** See llvm::createCalledValuePropagationPass function. */ void LLVMAddCalledValuePropagationPass(LLVMPassManagerRef PM); Index: llvm/trunk/include/llvm-c/Transforms/Scalar.h =================================================================== --- llvm/trunk/include/llvm-c/Transforms/Scalar.h +++ llvm/trunk/include/llvm-c/Transforms/Scalar.h @@ -35,6 +35,9 @@ /** See llvm::createAggressiveDCEPass function. */ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM); +/** See llvm::createDeadCodeEliminationPass function. */ +void LLVMAddDCEPass(LLVMPassManagerRef PM); + /** See llvm::createBitTrackingDCEPass function. */ void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM); Index: llvm/trunk/lib/Transforms/IPO/IPO.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/IPO.cpp +++ llvm/trunk/lib/Transforms/IPO/IPO.cpp @@ -114,6 +114,10 @@ unwrap(PM)->add(createIPSCCPPass()); } +void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createMergeFunctionsPass()); +} + void LLVMAddInternalizePass(LLVMPassManagerRef PM, unsigned AllButMain) { auto PreserveMain = [=](const GlobalValue &GV) { return AllButMain && GV.getName() == "main"; Index: llvm/trunk/lib/Transforms/Scalar/Scalar.cpp =================================================================== --- llvm/trunk/lib/Transforms/Scalar/Scalar.cpp +++ llvm/trunk/lib/Transforms/Scalar/Scalar.cpp @@ -123,6 +123,10 @@ unwrap(PM)->add(createAggressiveDCEPass()); } +void LLVMAddDCEPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createDeadCodeEliminationPass()); +} + void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createBitTrackingDCEPass()); }