[InstCombine] Signed saturation patterns
[llvm-core.git] / test / Bindings / OCaml / passmgr_builder.ml
blob355a627ff710790b17adea6be69d325b0bd0e306
1 (* RUN: rm -rf %t && mkdir -p %t && cp %s %t/passmgr_builder.ml
2 * RUN: %ocamlc -g -w +A -package llvm.passmgr_builder -linkpkg %t/passmgr_builder.ml -o %t/executable
3 * RUN: %t/executable %t/bitcode.bc
4 * RUN: %ocamlopt -g -w +A -package llvm.passmgr_builder -linkpkg %t/passmgr_builder.ml -o %t/executable
5 * RUN: %t/executable %t/bitcode.bc
6 * XFAIL: vg_leak
7 *)
9 (* Note: It takes several seconds for ocamlopt to link an executable with
10 libLLVMCore.a, so it's better to write a big test than a bunch of
11 little ones. *)
13 open Llvm
14 open Llvm_passmgr_builder
16 let context = global_context ()
17 let void_type = Llvm.void_type context
19 (* Tiny unit test framework - really just to help find which line is busted *)
20 let print_checkpoints = false
22 let suite name f =
23 if print_checkpoints then
24 prerr_endline (name ^ ":");
25 f ()
28 (*===-- Fixture -----------------------------------------------------------===*)
30 let filename = Sys.argv.(1)
31 let m = create_module context filename
34 (*===-- Pass Manager Builder ----------------------------------------------===*)
36 let test_pmbuilder () =
37 let (++) x f = ignore (f x); x in
39 let module_passmgr = PassManager.create () in
40 let func_passmgr = PassManager.create_function m in
41 let lto_passmgr = PassManager.create () in
43 ignore (Llvm_passmgr_builder.create ()
44 ++ set_opt_level 3
45 ++ set_size_level 1
46 ++ set_disable_unit_at_a_time false
47 ++ set_disable_unroll_loops false
48 ++ use_inliner_with_threshold 10
49 ++ populate_function_pass_manager func_passmgr
50 ++ populate_module_pass_manager module_passmgr
51 ++ populate_lto_pass_manager lto_passmgr
52 ~internalize:false ~run_inliner:false);
53 Gc.compact ();
55 PassManager.dispose module_passmgr;
56 PassManager.dispose func_passmgr;
57 PassManager.dispose lto_passmgr
60 (*===-- Driver ------------------------------------------------------------===*)
62 let _ =
63 suite "pass manager builder" test_pmbuilder;
64 dispose_module m