rustllvm: Initialize target analysis passes

Without this the target info for certain optimizations will not be
created and the compiler will sometimes crash
This commit is contained in:
Brian Anderson 2013-03-28 16:47:33 -07:00
parent 344628fe91
commit a34948a2c5

View File

@ -452,6 +452,8 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
Options.NoFramePointerElim = true;
Options.EnableSegmentedStacks = EnableSegmentedStacks;
PassManager *PM = unwrap<PassManager>(PMR);
std::string Err;
std::string Trip(Triple::normalize(triple));
std::string FeaturesStr;
@ -461,8 +463,9 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
TheTarget->createTargetMachine(Trip, CPUStr, FeaturesStr,
Options, Reloc::PIC_,
CodeModel::Default, OptLevel);
Target->addAnalysisPasses(*PM);
bool NoVerify = false;
PassManager *PM = unwrap<PassManager>(PMR);
std::string ErrorInfo;
raw_fd_ostream OS(path, ErrorInfo,
raw_fd_ostream::F_Binary);