[PATCH] D52212: [LLVM-C][OCaml] Add UnifyFunctionExitNodes pass to C and OCaml APIs
Josh Berdine via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 17 18:26:09 PDT 2018
jberdine created this revision.
jberdine added a reviewer: whitequark.
Herald added a reviewer: deadalnix.
Herald added a subscriber: llvm-commits.
Adds LLVMAddUnifyFunctionExitNodesPass to expose
createUnifyFunctionExitNodesPass to the C and OCaml APIs.
Repository:
rL LLVM
https://reviews.llvm.org/D52212
Files:
bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml
bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli
bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c
include/llvm-c/Transforms/Scalar.h
lib/Transforms/Scalar/Scalar.cpp
Index: lib/Transforms/Scalar/Scalar.cpp
===================================================================
--- lib/Transforms/Scalar/Scalar.cpp
+++ lib/Transforms/Scalar/Scalar.cpp
@@ -26,6 +26,7 @@
#include "llvm/InitializePasses.h"
#include "llvm/Transforms/Scalar/GVN.h"
#include "llvm/Transforms/Scalar/SimpleLoopUnswitch.h"
+#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
using namespace llvm;
@@ -278,3 +279,7 @@
void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createLowerExpectIntrinsicPass());
}
+
+void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM) {
+ unwrap(PM)->add(createUnifyFunctionExitNodesPass());
+}
Index: include/llvm-c/Transforms/Scalar.h
===================================================================
--- include/llvm-c/Transforms/Scalar.h
+++ include/llvm-c/Transforms/Scalar.h
@@ -153,6 +153,9 @@
/** See llvm::createBasicAliasAnalysisPass function */
void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM);
+/** See llvm::createUnifyFunctionExitNodesPass function */
+void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM);
+
/**
* @}
*/
Index: bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c
===================================================================
--- bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c
+++ bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c
@@ -247,3 +247,9 @@
LLVMAddBasicAliasAnalysisPass(PM);
return Val_unit;
}
+
+/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
+CAMLprim value llvm_add_merge_return(LLVMPassManagerRef PM) {
+ LLVMAddUnifyFunctionExitNodesPass(PM);
+ return Val_unit;
+}
Index: bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli
===================================================================
--- bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli
+++ bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli
@@ -201,3 +201,8 @@
external add_basic_alias_analysis
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_basic_alias_analysis"
+
+(** See the [llvm::createUnifyFunctionExitNodesPass] function. *)
+external add_merge_return
+ : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
+ = "llvm_add_merge_return"
Index: bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml
===================================================================
--- bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml
+++ bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml
@@ -121,3 +121,6 @@
external add_basic_alias_analysis
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_basic_alias_analysis"
+external add_merge_return
+ : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
+ = "llvm_add_merge_return"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52212.165870.patch
Type: text/x-patch
Size: 2794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/0c34ef12/attachment.bin>
More information about the llvm-commits
mailing list