[llvm-readobj] - Simplify stack-sizes.test test case.
[llvm-complete.git] / test / Bindings / OCaml / vectorize.ml
blob72cd191b362655fef8983be5c7d2f67382badf52
1 (* RUN: rm -rf %t && mkdir -p %t && cp %s %t/vectorize_opts.ml
2 * RUN: %ocamlc -g -w +A -package llvm.vectorize -linkpkg %t/vectorize_opts.ml -o %t/executable
3 * RUN: %t/executable %t/bitcode.bc
4 * RUN: %ocamlopt -g -w +A -package llvm.vectorize -linkpkg %t/vectorize_opts.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_vectorize
15 open Llvm_target
17 let context = global_context ()
18 let void_type = Llvm.void_type context
20 (* Tiny unit test framework - really just to help find which line is busted *)
21 let print_checkpoints = false
23 let suite name f =
24 if print_checkpoints then
25 prerr_endline (name ^ ":");
26 f ()
29 (*===-- Fixture -----------------------------------------------------------===*)
31 let filename = Sys.argv.(1)
32 let m = create_module context filename
35 (*===-- Transforms --------------------------------------------------------===*)
37 let test_transforms () =
38 let (++) x f = f x; x in
40 let fty = function_type void_type [| |] in
41 let fn = define_function "fn" fty m in
42 ignore (build_ret_void (builder_at_end context (entry_block fn)));
44 ignore (PassManager.create ()
45 ++ add_loop_vectorize
46 ++ add_slp_vectorize
47 ++ PassManager.run_module m
48 ++ PassManager.dispose)
51 (*===-- Driver ------------------------------------------------------------===*)
53 let _ =
54 suite "transforms" test_transforms;
55 dispose_module m