Commit 194a2e7c by Yang Chen Committed by Tianqi Chen

Added LLVM TargetIRAnalysis pass (#2386)

parent 536ba30b
......@@ -235,6 +235,16 @@ void CodeGenLLVM::InitPassManagerBuilder(llvm::PassManagerBuilder* builder) {
}
void CodeGenLLVM::Optimize() {
// pass manager
FPassManager fpass(module_.get());
MPassManager mpass;
mpass.add(llvm::createTargetTransformInfoWrapperPass(
target_machine_ ? target_machine_->getTargetIRAnalysis() :
llvm::TargetIRAnalysis()));
fpass.add(llvm::createTargetTransformInfoWrapperPass(
target_machine_ ? target_machine_->getTargetIRAnalysis() :
llvm::TargetIRAnalysis()));
// place optimization pass
llvm::PassManagerBuilder builder;
builder.OptLevel = 3;
......@@ -252,9 +262,6 @@ void CodeGenLLVM::Optimize() {
target_machine_->adjustPassManager(builder);
#endif
// pass manager
FPassManager fpass(module_.get());
MPassManager mpass;
builder.populateFunctionPassManager(fpass);
builder.populateModulePassManager(mpass);
......
......@@ -9,6 +9,7 @@
#include <llvm/ExecutionEngine/MCJIT.h>
#include <llvm/Analysis/TargetTransformInfo.h>
#include <llvm/Bitcode/BitcodeWriter.h>
#include <llvm/Support/SourceMgr.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment