From a34948a2c5d7cd296abda6970652a9513d67feb7 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 28 Mar 2013 16:47:33 -0700 Subject: [PATCH] rustllvm: Initialize target analysis passes Without this the target info for certain optimizations will not be created and the compiler will sometimes crash --- src/rustllvm/RustWrapper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 68483b0280f..5d422b2d2ed 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -452,6 +452,8 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR, Options.NoFramePointerElim = true; Options.EnableSegmentedStacks = EnableSegmentedStacks; + PassManager *PM = unwrap(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(PMR); std::string ErrorInfo; raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);