From: Craig Topper Date: Tue, 24 Apr 2018 00:39:29 +0000 (+0000) Subject: [AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API. X-Git-Tag: llvmorg-7.0.0-rc1~7574 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1bcb258ba319c380b206c2ab7d9f8baaffcb2058;p=platform%2Fupstream%2Fllvm.git [AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API. I just tried to copy what was done for regular InstCombine. Hopefully I didn't miss anything. llvm-svn: 330668 --- diff --git a/llvm/bindings/python/llvm/core.py b/llvm/bindings/python/llvm/core.py index 47e81dd..6b3da6d 100644 --- a/llvm/bindings/python/llvm/core.py +++ b/llvm/bindings/python/llvm/core.py @@ -456,6 +456,9 @@ def register_library(library): library.LLVMInitializeInstCombine.argtypes = [PassRegistry] library.LLVMInitializeInstCombine.restype = None + library.LLVMInitializeAggressiveInstCombiner.argtypes = [PassRegistry] + library.LLVMInitializeAggressiveInstCombiner.restype = None + library.LLVMInitializeIPO.argtypes = [PassRegistry] library.LLVMInitializeIPO.restype = None diff --git a/llvm/include/llvm-c/Initialization.h b/llvm/include/llvm-c/Initialization.h index 90c8396..e45eafb 100644 --- a/llvm/include/llvm-c/Initialization.h +++ b/llvm/include/llvm-c/Initialization.h @@ -37,6 +37,7 @@ void LLVMInitializeScalarOpts(LLVMPassRegistryRef R); void LLVMInitializeObjCARCOpts(LLVMPassRegistryRef R); void LLVMInitializeVectorization(LLVMPassRegistryRef R); void LLVMInitializeInstCombine(LLVMPassRegistryRef R); +void LLVMInitializeAggressiveInstCombiner(LLVMPassRegistryRef R); void LLVMInitializeIPO(LLVMPassRegistryRef R); void LLVMInitializeInstrumentation(LLVMPassRegistryRef R); void LLVMInitializeAnalysis(LLVMPassRegistryRef R); diff --git a/llvm/include/llvm-c/Transforms/Scalar.h b/llvm/include/llvm-c/Transforms/Scalar.h index c828813..88fff2a 100644 --- a/llvm/include/llvm-c/Transforms/Scalar.h +++ b/llvm/include/llvm-c/Transforms/Scalar.h @@ -35,6 +35,9 @@ extern "C" { /** See llvm::createAggressiveDCEPass function. */ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM); +/** See llvm::createAggressiveInstCombinerPass function. */ +void LLVMAddAggressiveInstCombinerPass(LLVMPassManagerRef PM); + /** See llvm::createBitTrackingDCEPass function. */ void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM); diff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp index 1feeec5..27d2fb0 100644 --- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp +++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp @@ -116,6 +116,10 @@ void llvm::initializeAggressiveInstCombine(PassRegistry &Registry) { initializeAggressiveInstCombinerLegacyPassPass(Registry); } +void LLVMInitializeAggressiveInstCombiner(LLVMPassRegistryRef R) { + initializeAggressiveInstCombinerLegacyPassPass(*unwrap(R)); +} + FunctionPass *llvm::createAggressiveInstCombinerPass() { return new AggressiveInstCombinerLegacyPass(); } diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp index accb307..9541766 100644 --- a/llvm/lib/Transforms/Scalar/Scalar.cpp +++ b/llvm/lib/Transforms/Scalar/Scalar.cpp @@ -114,6 +114,10 @@ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createAggressiveDCEPass()); } +void LLVMAddAggressiveInstCombinerPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createAggressiveInstCombinerPass()); +} + void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createBitTrackingDCEPass()); }