Enable alias analysis and the function attributes pass.
The C API extension is already upstream, we can drop the local copy once the bots are updated.
This commit is contained in:
parent
6909e7ca78
commit
e7b8db2e63
@ -775,6 +775,8 @@ native mod llvm = llvm_lib {
|
||||
fn LLVMAddSimplifyLibCallsPass(PassManagerRef PM);
|
||||
fn LLVMAddLoopIdiomPass(PassManagerRef PM);
|
||||
fn LLVMAddEarlyCSEPass(PassManagerRef PM);
|
||||
fn LLVMAddTypeBasedAliasAnalysisPass(PassManagerRef PM);
|
||||
fn LLVMAddBasicAliasAnalysisPass(PassManagerRef PM);
|
||||
|
||||
/** Destroys a memory buffer. */
|
||||
fn LLVMDisposeMemoryBuffer(MemoryBufferRef MemBuf);
|
||||
|
@ -6647,6 +6647,8 @@ fn run_passes(ModuleRef llmod, bool opt) {
|
||||
auto fpm = mk_pass_manager();
|
||||
|
||||
// createStandardFunctionPasses
|
||||
llvm.LLVMAddTypeBasedAliasAnalysisPass(fpm.llpm);
|
||||
llvm.LLVMAddBasicAliasAnalysisPass(fpm.llpm);
|
||||
llvm.LLVMAddCFGSimplificationPass(fpm.llpm);
|
||||
llvm.LLVMAddScalarReplAggregatesPass(fpm.llpm);
|
||||
llvm.LLVMAddEarlyCSEPass(fpm.llpm);
|
||||
@ -6654,6 +6656,8 @@ fn run_passes(ModuleRef llmod, bool opt) {
|
||||
llvm.LLVMRunPassManager(fpm.llpm, llmod);
|
||||
|
||||
// createStandardModulePasses
|
||||
llvm.LLVMAddTypeBasedAliasAnalysisPass(pm.llpm);
|
||||
llvm.LLVMAddBasicAliasAnalysisPass(pm.llpm);
|
||||
llvm.LLVMAddGlobalOptimizerPass(pm.llpm);
|
||||
llvm.LLVMAddIPSCCPPass(pm.llpm);
|
||||
llvm.LLVMAddDeadArgEliminationPass(pm.llpm);
|
||||
@ -6661,10 +6665,7 @@ fn run_passes(ModuleRef llmod, bool opt) {
|
||||
llvm.LLVMAddCFGSimplificationPass(pm.llpm);
|
||||
llvm.LLVMAddPruneEHPass(pm.llpm);
|
||||
llvm.LLVMAddFunctionInliningPass(pm.llpm);
|
||||
|
||||
// FIXME: crashes!
|
||||
// llvm.LLVMAddFunctionAttrsPass(pm.llpm);
|
||||
|
||||
llvm.LLVMAddFunctionAttrsPass(pm.llpm);
|
||||
llvm.LLVMAddScalarReplAggregatesPassSSA(pm.llpm);
|
||||
llvm.LLVMAddEarlyCSEPass(pm.llpm);
|
||||
llvm.LLVMAddSimplifyLibCallsPass(pm.llpm);
|
||||
|
14
src/rustllvm/Passes.cpp
Normal file
14
src/rustllvm/Passes.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm-c/Core.h"
|
||||
|
||||
using namespace llvm;
|
||||
extern "C" {
|
||||
void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createTypeBasedAliasAnalysisPass());
|
||||
}
|
||||
|
||||
void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createBasicAliasAnalysisPass());
|
||||
}
|
||||
}
|
@ -31,3 +31,8 @@ extern "C" const char *LLVMRustGetLastError(void) {
|
||||
|
||||
LLVMOpaqueObjectFile* (*RustHackToFetchObjectO)(LLVMOpaqueMemoryBuffer*)
|
||||
= LLVMCreateObjectFile;
|
||||
|
||||
extern "C" void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM);
|
||||
|
||||
void (*RustHackToFetchPassesO)(LLVMPassManagerRef PM) =
|
||||
LLVMAddBasicAliasAnalysisPass;
|
||||
|
@ -15,6 +15,7 @@ LLVMAddAggressiveDCEPass
|
||||
LLVMAddAlias
|
||||
LLVMAddArgumentPromotionPass
|
||||
LLVMAddAttribute
|
||||
LLVMaddBasicAliasAnalysisPass
|
||||
LLVMAddCFGSimplificationPass
|
||||
LLVMAddCase
|
||||
LLVMAddConstantMergePass
|
||||
@ -67,6 +68,7 @@ LLVMAddStripDeadPrototypesPass
|
||||
LLVMAddStripSymbolsPass
|
||||
LLVMAddTailCallEliminationPass
|
||||
LLVMAddTargetData
|
||||
LLVMAddTypeBasedAliasAnalysisPass
|
||||
LLVMAddTypeName
|
||||
LLVMAddVerifierPass
|
||||
LLVMAlignOf
|
||||
|
Loading…
Reference in New Issue
Block a user