<div dir="ltr">heap-use-after-free is in this patch: <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15737/steps/check-clang%20asan/logs/stdio">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15737/steps/check-clang%20asan/logs/stdio</a><br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 22, 2016 at 8:28 PM Matthias Braun via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: matze<br>
Date: Mon Aug 22 22:20:09 2016<br>
New Revision: 279502<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=279502&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=279502&view=rev</a><br>
Log:<br>
CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses<br>
<br>
This patch removes the MachineFunctionAnalysis. Instead we keep a<br>
map from IR Function to MachineFunction in the MachineModuleInfo.<br>
<br>
This allows the insertion of ModulePasses into the codegen pipeline<br>
without breaking it because the MachineFunctionAnalysis gets dropped<br>
before a module pass.<br>
<br>
Peak memory should stay unchanged without a ModulePass in the codegen<br>
pipeline: Previously the MachineFunction was freed at the end of a codegen<br>
function pipeline because the MachineFunctionAnalysis was dropped; With<br>
this patch the MachineFunction is freed after the AsmPrinter has<br>
finished.<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D23736" rel="noreferrer" target="_blank">http://reviews.llvm.org/D23736</a><br>
<br>
Removed:<br>
    llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h<br>
    llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp<br>
Modified:<br>
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h<br>
    llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h<br>
    llvm/trunk/include/llvm/Target/TargetMachine.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
    llvm/trunk/lib/CodeGen/CMakeLists.txt<br>
    llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp<br>
    llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp<br>
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp<br>
    llvm/trunk/lib/CodeGen/StackMapLivenessAnalysis.cpp<br>
    llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp<br>
    llvm/trunk/lib/Target/Hexagon/HexagonCommonGEP.cpp<br>
    llvm/trunk/lib/Target/Hexagon/HexagonGenExtract.cpp<br>
    llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp<br>
    llvm/trunk/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp<br>
    llvm/trunk/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp<br>
    llvm/trunk/lib/Target/NVPTX/NVPTXAllocaHoisting.cpp<br>
    llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp<br>
    llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp<br>
    llvm/trunk/lib/Target/NVPTX/NVPTXTargetMachine.cpp<br>
    llvm/trunk/test/CodeGen/Generic/stop-after.ll<br>
    llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll<br>
    llvm/trunk/tools/llc/llc.cpp<br>
    llvm/trunk/unittests/MI/LiveIntervalTest.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Aug 22 22:20:09 2016<br>
@@ -204,11 +204,7 @@ public:<br>
   bool doFinalization(Module &M) override;<br>
<br>
   /// Emit the specified function out to the OutStreamer.<br>
-  bool runOnMachineFunction(MachineFunction &MF) override {<br>
-    SetupMachineFunction(MF);<br>
-    EmitFunctionBody();<br>
-    return false;<br>
-  }<br>
+  bool runOnMachineFunction(MachineFunction &MF) override;<br>
<br>
   //===------------------------------------------------------------------===//<br>
   // Coarse grained IR lowering routines.<br>
<br>
Removed: llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h?rev=279501&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h?rev=279501&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h (removed)<br>
@@ -1,55 +0,0 @@<br>
-//===-- MachineFunctionAnalysis.h - Owner of MachineFunctions ----*-C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// This file declares the MachineFunctionAnalysis class.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef LLVM_CODEGEN_MACHINEFUNCTIONANALYSIS_H<br>
-#define LLVM_CODEGEN_MACHINEFUNCTIONANALYSIS_H<br>
-<br>
-#include "llvm/Pass.h"<br>
-<br>
-namespace llvm {<br>
-<br>
-class MachineFunction;<br>
-class MachineFunctionInitializer;<br>
-class TargetMachine;<br>
-<br>
-/// MachineFunctionAnalysis - This class is a Pass that manages a<br>
-/// MachineFunction object.<br>
-struct MachineFunctionAnalysis : public FunctionPass {<br>
-private:<br>
-  const TargetMachine &TM;<br>
-  MachineFunction *MF;<br>
-  unsigned NextFnNum;<br>
-  MachineFunctionInitializer *MFInitializer;<br>
-<br>
-public:<br>
-  static char ID;<br>
-  explicit MachineFunctionAnalysis(const TargetMachine &tm,<br>
-                                   MachineFunctionInitializer *MFInitializer);<br>
-  ~MachineFunctionAnalysis() override;<br>
-<br>
-  MachineFunction &getMF() const { return *MF; }<br>
-<br>
-  const char* getPassName() const override {<br>
-    return "Machine Function Analysis";<br>
-  }<br>
-<br>
-private:<br>
-  bool doInitialization(Module &M) override;<br>
-  bool runOnFunction(Function &F) override;<br>
-  void releaseMemory() override;<br>
-  void getAnalysisUsage(AnalysisUsage &AU) const override;<br>
-};<br>
-<br>
-} // End llvm namespace<br>
-<br>
-#endif<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Mon Aug 22 22:20:09 2016<br>
@@ -54,6 +54,7 @@ class BlockAddress;<br>
 class MDNode;<br>
 class MMIAddrLabelMap;<br>
 class MachineBasicBlock;<br>
+class MachineFunctionInitializer;<br>
 class MachineFunction;<br>
 class Module;<br>
 class PointerType;<br>
@@ -107,6 +108,8 @@ protected:<br>
 /// schemes and reformated for specific use.<br>
 ///<br>
 class MachineModuleInfo : public ImmutablePass {<br>
+  const TargetMachine &TM;<br>
+<br>
   /// Context - This is the MCContext used for the entire code generator.<br>
   MCContext Context;<br>
<br>
@@ -184,6 +187,12 @@ class MachineModuleInfo : public Immutab<br>
<br>
   EHPersonality PersonalityTypeCache;<br>
<br>
+  MachineFunctionInitializer *MFInitializer;<br>
+  /// Maps IR Functions to their corresponding MachineFunctions.<br>
+  DenseMap<const Function*, std::unique_ptr<MachineFunction>> MachineFunctions;<br>
+  const Function *LastRequest = nullptr; ///< Used for shortcut/cache.<br>
+  MachineFunction *LastResult = nullptr; ///< Used for shortcut/cache.<br>
+<br>
 public:<br>
   static char ID; // Pass identification, replacement for typeid<br>
<br>
@@ -202,8 +211,9 @@ public:<br>
<br>
   MachineModuleInfo();  // DUMMY CONSTRUCTOR, DO NOT CALL.<br>
   // Real constructor.<br>
-  MachineModuleInfo(const MCAsmInfo &MAI, const MCRegisterInfo &MRI,<br>
-                    const MCObjectFileInfo *MOFI);<br>
+  MachineModuleInfo(const TargetMachine &TM, const MCAsmInfo &MAI,<br>
+                    const MCRegisterInfo &MRI, const MCObjectFileInfo *MOFI,<br>
+                    MachineFunctionInitializer *MFInitializer = nullptr);<br>
   ~MachineModuleInfo() override;<br>
<br>
   // Initialization and Finalization<br>
@@ -220,6 +230,15 @@ public:<br>
   void setModule(const Module *M) { TheModule = M; }<br>
   const Module *getModule() const { return TheModule; }<br>
<br>
+  /// Returns the MachineFunction constructed for the IR function \p F.<br>
+  /// Creates a new MachineFunction and runs the MachineFunctionInitializer<br>
+  /// if none exists yet.<br>
+  MachineFunction &getMachineFunction(const Function &F);<br>
+<br>
+  /// \brief Delete the MachineFunction \p MF and reset the link in the IR<br>
+  /// Function to Machine Function map.<br>
+  void deleteMachineFunction(MachineFunction &MF);<br>
+<br>
   /// getInfo - Keep track of various per-function pieces of information for<br>
   /// backends that would like to do so.<br>
   ///<br>
<br>
Modified: llvm/trunk/include/llvm/Target/TargetMachine.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Target/TargetMachine.h (original)<br>
+++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Aug 22 22:20:09 2016<br>
@@ -314,11 +314,8 @@ public:<br>
                          bool DisableVerify = true) override;<br>
<br>
   /// Add MachineModuleInfo pass to pass manager.<br>
-  MachineModuleInfo &addMachineModuleInfo(PassManagerBase &PM) const;<br>
-<br>
-  /// Add MachineFunctionAnalysis pass to pass manager.<br>
-  void addMachineFunctionAnalysis(PassManagerBase &PM,<br>
-      MachineFunctionInitializer *MFInitializer) const;<br>
+  MachineModuleInfo &addMachineModuleInfo(PassManagerBase &PM,<br>
+      MachineFunctionInitializer *MFI = nullptr) const;<br>
 };<br>
<br>
 } // End llvm namespace<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Aug 22 22:20:09 2016<br>
@@ -2571,7 +2571,14 @@ isBlockOnlyReachableByFallthrough(const<br>
   return true;<br>
 }<br>
<br>
+bool AsmPrinter::runOnMachineFunction(MachineFunction &MF) {<br>
+  SetupMachineFunction(MF);<br>
+  EmitFunctionBody();<br>
<br>
+  MachineModuleInfo &MMI = getAnalysis<MachineModuleInfo>();<br>
+  MMI.deleteMachineFunction(MF);<br>
+  return false;<br>
+}<br>
<br>
 GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy &S) {<br>
   if (!S.usesMetadata())<br>
<br>
Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/CMakeLists.txt (original)<br>
+++ llvm/trunk/lib/CodeGen/CMakeLists.txt Mon Aug 22 22:20:09 2016<br>
@@ -59,7 +59,6 @@ add_llvm_library(LLVMCodeGen<br>
   MachineCSE.cpp<br>
   MachineDominanceFrontier.cpp<br>
   MachineDominators.cpp<br>
-  MachineFunctionAnalysis.cpp<br>
   MachineFunction.cpp<br>
   MachineFunctionPass.cpp<br>
   MachineFunctionPrinterPass.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Aug 22 22:20:09 2016<br>
@@ -15,7 +15,6 @@<br>
 #include "llvm/Analysis/Passes.h"<br>
 #include "llvm/CodeGen/AsmPrinter.h"<br>
 #include "llvm/CodeGen/BasicTTIImpl.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/MachineModuleInfo.h"<br>
 #include "llvm/CodeGen/Passes.h"<br>
 #include "llvm/CodeGen/TargetPassConfig.h"<br>
@@ -103,19 +102,15 @@ TargetIRAnalysis LLVMTargetMachine::getT<br>
 }<br>
<br>
 MachineModuleInfo &<br>
-LLVMTargetMachine::addMachineModuleInfo(PassManagerBase &PM) const {<br>
-  MachineModuleInfo *MMI = new MachineModuleInfo(*getMCAsmInfo(),<br>
+LLVMTargetMachine::addMachineModuleInfo(PassManagerBase &PM,<br>
+                                        MachineFunctionInitializer *MFI) const {<br>
+  MachineModuleInfo *MMI = new MachineModuleInfo(*this, *getMCAsmInfo(),<br>
                                                  *getMCRegisterInfo(),<br>
-                                                 getObjFileLowering());<br>
+                                                 getObjFileLowering(), MFI);<br>
   PM.add(MMI);<br>
   return *MMI;<br>
 }<br>
<br>
-void LLVMTargetMachine::addMachineFunctionAnalysis(PassManagerBase &PM,<br>
-    MachineFunctionInitializer *MFInitializer) const {<br>
-  PM.add(new MachineFunctionAnalysis(*this, MFInitializer));<br>
-}<br>
-<br>
 /// addPassesToX helper drives creation and initialization of TargetPassConfig.<br>
 static MCContext *<br>
 addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,<br>
@@ -150,8 +145,7 @@ addPassesToGenerateCode(LLVMTargetMachin<br>
<br>
   PassConfig->addISelPrepare();<br>
<br>
-  MachineModuleInfo &MMI = TM->addMachineModuleInfo(PM);<br>
-  TM->addMachineFunctionAnalysis(PM, MFInitializer);<br>
+  MachineModuleInfo &MMI = TM->addMachineModuleInfo(PM, MFInitializer);<br>
<br>
   // Enable FastISel with -fast, but allow that to be overridden.<br>
   TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE);<br>
<br>
Removed: llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp?rev=279501&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp?rev=279501&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp (removed)<br>
@@ -1,62 +0,0 @@<br>
-//===-- MachineFunctionAnalysis.cpp ---------------------------------------===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// This file contains the definitions of the MachineFunctionAnalysis members.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
-#include "llvm/CodeGen/GCMetadata.h"<br>
-#include "llvm/CodeGen/MachineFunction.h"<br>
-#include "llvm/CodeGen/MachineModuleInfo.h"<br>
-#include "llvm/CodeGen/MachineFunctionInitializer.h"<br>
-using namespace llvm;<br>
-<br>
-char MachineFunctionAnalysis::ID = 0;<br>
-<br>
-MachineFunctionAnalysis::MachineFunctionAnalysis(<br>
-    const TargetMachine &tm, MachineFunctionInitializer *MFInitializer)<br>
-    : FunctionPass(ID), TM(tm), MF(nullptr), MFInitializer(MFInitializer) {<br>
-  initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());<br>
-}<br>
-<br>
-MachineFunctionAnalysis::~MachineFunctionAnalysis() {<br>
-  releaseMemory();<br>
-  assert(!MF && "MachineFunctionAnalysis left initialized!");<br>
-}<br>
-<br>
-void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {<br>
-  AU.setPreservesAll();<br>
-  AU.addRequired<MachineModuleInfo>();<br>
-}<br>
-<br>
-bool MachineFunctionAnalysis::doInitialization(Module &M) {<br>
-  MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();<br>
-  assert(MMI && "MMI not around yet??");<br>
-  MMI->setModule(&M);<br>
-  NextFnNum = 0;<br>
-  return false;<br>
-}<br>
-<br>
-<br>
-bool MachineFunctionAnalysis::runOnFunction(Function &F) {<br>
-  assert(!MF && "MachineFunctionAnalysis already initialized!");<br>
-  MF = new MachineFunction(&F, TM, NextFnNum++,<br>
-                           getAnalysis<MachineModuleInfo>());<br>
-  if (MFInitializer) {<br>
-    if (MFInitializer->initializeMachineFunction(*MF))<br>
-      report_fatal_error("Unable to initialize machine function");<br>
-  }<br>
-  return false;<br>
-}<br>
-<br>
-void MachineFunctionAnalysis::releaseMemory() {<br>
-  delete MF;<br>
-  MF = nullptr;<br>
-}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp Mon Aug 22 22:20:09 2016<br>
@@ -22,7 +22,7 @@<br>
 #include "llvm/Analysis/ScalarEvolution.h"<br>
 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"<br>
 #include "llvm/CodeGen/MachineFunction.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
+#include "llvm/CodeGen/MachineModuleInfo.h"<br>
 #include "llvm/CodeGen/Passes.h"<br>
 #include "llvm/CodeGen/StackProtector.h"<br>
 #include "llvm/IR/Dominators.h"<br>
@@ -41,7 +41,9 @@ bool MachineFunctionPass::runOnFunction(<br>
   if (F.hasAvailableExternallyLinkage())<br>
     return false;<br>
<br>
-  MachineFunction &MF = getAnalysis<MachineFunctionAnalysis>().getMF();<br>
+  MachineModuleInfo &MMI = getAnalysis<MachineModuleInfo>();<br>
+  MachineFunction &MF = MMI.getMachineFunction(F);<br>
+<br>
   MachineFunctionProperties &MFProps = MF.getProperties();<br>
<br>
 #ifndef NDEBUG<br>
@@ -65,8 +67,8 @@ bool MachineFunctionPass::runOnFunction(<br>
 }<br>
<br>
 void MachineFunctionPass::getAnalysisUsage(AnalysisUsage &AU) const {<br>
-  AU.addRequired<MachineFunctionAnalysis>();<br>
-  AU.addPreserved<MachineFunctionAnalysis>();<br>
+  AU.addRequired<MachineModuleInfo>();<br>
+  AU.addPreserved<MachineModuleInfo>();<br>
<br>
   // MachineFunctionPass preserves all LLVM IR passes, but there's no<br>
   // high-level way to express this. Instead, just list a bunch of<br>
<br>
Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Mon Aug 22 22:20:09 2016<br>
@@ -13,6 +13,7 @@<br>
 #include "llvm/Analysis/EHPersonalities.h"<br>
 #include "llvm/Analysis/ValueTracking.h"<br>
 #include "llvm/CodeGen/MachineFunction.h"<br>
+#include "llvm/CodeGen/MachineFunctionInitializer.h"<br>
 #include "llvm/CodeGen/MachineFunctionPass.h"<br>
 #include "llvm/CodeGen/Passes.h"<br>
 #include "llvm/IR/Constants.h"<br>
@@ -186,15 +187,19 @@ void MMIAddrLabelMapCallbackPtr::allUses<br>
<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI,<br>
+MachineModuleInfo::MachineModuleInfo(const TargetMachine &TM,<br>
+                                     const MCAsmInfo &MAI,<br>
                                      const MCRegisterInfo &MRI,<br>
-                                     const MCObjectFileInfo *MOFI)<br>
-  : ImmutablePass(ID), Context(&MAI, &MRI, MOFI, nullptr, false) {<br>
+                                     const MCObjectFileInfo *MOFI,<br>
+                                     MachineFunctionInitializer *MFI)<br>
+  : ImmutablePass(ID), TM(TM), Context(&MAI, &MRI, MOFI, nullptr, false),<br>
+    MFInitializer(MFI) {<br>
   initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());<br>
 }<br>
<br>
 MachineModuleInfo::MachineModuleInfo()<br>
-  : ImmutablePass(ID), Context(nullptr, nullptr, nullptr) {<br>
+  : ImmutablePass(ID), TM(*((TargetMachine*)nullptr)),<br>
+    Context(nullptr, nullptr, nullptr) {<br>
   llvm_unreachable("This MachineModuleInfo constructor should never be called, "<br>
                    "MMI should always be explicitly constructed by "<br>
                    "LLVMTargetMachine");<br>
@@ -213,7 +218,7 @@ bool MachineModuleInfo::doInitialization<br>
   DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false;<br>
   PersonalityTypeCache = EHPersonality::Unknown;<br>
   AddrLabelSymbols = nullptr;<br>
-  TheModule = nullptr;<br>
+  TheModule = &M;<br>
<br>
   return false;<br>
 }<br>
@@ -461,3 +466,42 @@ try_next:;<br>
   FilterIds.push_back(0); // terminator<br>
   return FilterID;<br>
 }<br>
+<br>
+MachineFunction &MachineModuleInfo::getMachineFunction(const Function &F) {<br>
+  // Shortcut for the common case where a sequence of MachineFunctionPasses<br>
+  // all query for the same Function.<br>
+  if (LastRequest == &F)<br>
+    return *LastResult;<br>
+<br>
+  auto I = MachineFunctions.insert(<br>
+      std::make_pair(&F, std::unique_ptr<MachineFunction>()));<br>
+  MachineFunction *MF;<br>
+  if (I.second) {<br>
+    // No pre-existing machine function, create a new one.<br>
+    unsigned FunctionNum = (unsigned)MachineFunctions.size() - 1;<br>
+    MF = new MachineFunction(&F, TM, FunctionNum, *this);<br>
+    // Update the set entry.<br>
+    I.first->second.reset(MF);<br>
+<br>
+    if (MFInitializer)<br>
+      if (MFInitializer->initializeMachineFunction(*MF))<br>
+        report_fatal_error("Unable to initialize machine function");<br>
+  } else {<br>
+    MF = I.first->second.get();<br>
+  }<br>
+<br>
+  LastRequest = &F;<br>
+  LastResult = MF;<br>
+  return *MF;<br>
+}<br>
+<br>
+void MachineModuleInfo::deleteMachineFunction(MachineFunction &MF) {<br>
+  if (LastResult == &MF) {<br>
+    LastRequest = nullptr;<br>
+    LastResult = nullptr;<br>
+  }<br>
+<br>
+  auto I = MachineFunctions.find(MF.getFunction());<br>
+  assert(I != MachineFunctions.end() && "MachineFunction is known");<br>
+  I->second.reset(nullptr);<br>
+}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/StackMapLivenessAnalysis.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackMapLivenessAnalysis.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackMapLivenessAnalysis.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/StackMapLivenessAnalysis.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/StackMapLivenessAnalysis.cpp Mon Aug 22 22:20:09 2016<br>
@@ -17,7 +17,6 @@<br>
 #include "llvm/CodeGen/LivePhysRegs.h"<br>
 #include "llvm/CodeGen/MachineFrameInfo.h"<br>
 #include "llvm/CodeGen/MachineFunction.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/MachineFunctionPass.h"<br>
 #include "llvm/CodeGen/Passes.h"<br>
 #include "llvm/Support/CommandLine.h"<br>
<br>
Modified: llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp (original)<br>
+++ llvm/trunk/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp Mon Aug 22 22:20:09 2016<br>
@@ -18,7 +18,6 @@<br>
 #include "llvm/ADT/Statistic.h"<br>
 #include "llvm/CodeGen/MachineDominators.h"<br>
 #include "llvm/CodeGen/MachineFunction.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/MachineFunctionPass.h"<br>
 #include "llvm/CodeGen/MachineInstrBuilder.h"<br>
 #include "llvm/CodeGen/MachineJumpTableInfo.h"<br>
@@ -144,11 +143,10 @@ public:<br>
   }<br>
<br>
   void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
-    AU.addPreserved<MachineFunctionAnalysis>();<br>
-    AU.addRequired<MachineFunctionAnalysis>();<br>
     AU.addRequired<MachineDominatorTree>();<br>
     AU.addRequired<MachinePostDominatorTree>();<br>
     AU.addRequired<MachineLoopInfo>();<br>
+    MachineFunctionPass::getAnalysisUsage(AU);<br>
   }<br>
<br>
   /// Perform the CFG structurization<br>
<br>
Modified: llvm/trunk/lib/Target/Hexagon/HexagonCommonGEP.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonCommonGEP.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonCommonGEP.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/Hexagon/HexagonCommonGEP.cpp (original)<br>
+++ llvm/trunk/lib/Target/Hexagon/HexagonCommonGEP.cpp Mon Aug 22 22:20:09 2016<br>
@@ -14,7 +14,6 @@<br>
 #include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/Analysis/LoopInfo.h"<br>
 #include "llvm/Analysis/PostDominators.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/IR/Constants.h"<br>
 #include "llvm/IR/Dominators.h"<br>
 #include "llvm/IR/Function.h"<br>
<br>
Modified: llvm/trunk/lib/Target/Hexagon/HexagonGenExtract.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonGenExtract.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonGenExtract.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/Hexagon/HexagonGenExtract.cpp (original)<br>
+++ llvm/trunk/lib/Target/Hexagon/HexagonGenExtract.cpp Mon Aug 22 22:20:09 2016<br>
@@ -8,7 +8,6 @@<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "llvm/ADT/STLExtras.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/IR/Constants.h"<br>
 #include "llvm/IR/Dominators.h"<br>
 #include "llvm/IR/Function.h"<br>
@@ -60,7 +59,6 @@ namespace {<br>
     virtual void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
       AU.addRequired<DominatorTreeWrapperPass>();<br>
       AU.addPreserved<DominatorTreeWrapperPass>();<br>
-      AU.addPreserved<MachineFunctionAnalysis>();<br>
       FunctionPass::getAnalysisUsage(AU);<br>
     }<br>
   private:<br>
<br>
Modified: llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp (original)<br>
+++ llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp Mon Aug 22 22:20:09 2016<br>
@@ -29,7 +29,6 @@<br>
 #include "HexagonTargetMachine.h"<br>
 #include "llvm/ADT/Statistic.h"<br>
 #include "llvm/CodeGen/LiveVariables.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/MachineFunctionPass.h"<br>
 #include "llvm/CodeGen/MachineInstrBuilder.h"<br>
 #include "llvm/CodeGen/MachineRegisterInfo.h"<br>
<br>
Modified: llvm/trunk/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp (original)<br>
+++ llvm/trunk/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp Mon Aug 22 22:20:09 2016<br>
@@ -12,7 +12,6 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/StackProtector.h"<br>
 #include "llvm/IR/Function.h"<br>
 #include "llvm/IR/Instructions.h"<br>
@@ -43,8 +42,6 @@ namespace {<br>
     }<br>
<br>
     void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
-      AU.addRequired<MachineFunctionAnalysis>();<br>
-      AU.addPreserved<MachineFunctionAnalysis>();<br>
       AU.addPreserved<StackProtector>();<br>
       FunctionPass::getAnalysisUsage(AU);<br>
     }<br>
<br>
Modified: llvm/trunk/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp (original)<br>
+++ llvm/trunk/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp Mon Aug 22 22:20:09 2016<br>
@@ -22,7 +22,6 @@<br>
 #include "HexagonVLIWPacketizer.h"<br>
 #include "llvm/Analysis/AliasAnalysis.h"<br>
 #include "llvm/CodeGen/MachineDominators.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/MachineFunctionPass.h"<br>
 #include "llvm/CodeGen/MachineLoopInfo.h"<br>
 #include "llvm/CodeGen/MachineRegisterInfo.h"<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAllocaHoisting.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAllocaHoisting.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAllocaHoisting.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXAllocaHoisting.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAllocaHoisting.cpp Mon Aug 22 22:20:09 2016<br>
@@ -12,7 +12,6 @@<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "NVPTXAllocaHoisting.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/StackProtector.h"<br>
 #include "llvm/IR/Constants.h"<br>
 #include "llvm/IR/Function.h"<br>
@@ -28,7 +27,6 @@ public:<br>
   NVPTXAllocaHoisting() : FunctionPass(ID) {}<br>
<br>
   void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
-    AU.addPreserved<MachineFunctionAnalysis>();<br>
     AU.addPreserved<StackProtector>();<br>
   }<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp Mon Aug 22 22:20:09 2016<br>
@@ -15,7 +15,6 @@<br>
 #include "NVPTX.h"<br>
 #include "MCTargetDesc/NVPTXBaseInfo.h"<br>
 #include "NVPTXUtilities.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/ValueTypes.h"<br>
 #include "llvm/IR/Constants.h"<br>
 #include "llvm/IR/DerivedTypes.h"<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp Mon Aug 22 22:20:09 2016<br>
@@ -14,7 +14,6 @@<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "NVPTXLowerAggrCopies.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/StackProtector.h"<br>
 #include "llvm/IR/Constants.h"<br>
 #include "llvm/IR/DataLayout.h"<br>
@@ -41,7 +40,6 @@ struct NVPTXLowerAggrCopies : public Fun<br>
   NVPTXLowerAggrCopies() : FunctionPass(ID) {}<br>
<br>
   void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
-    AU.addPreserved<MachineFunctionAnalysis>();<br>
     AU.addPreserved<StackProtector>();<br>
   }<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXTargetMachine.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXTargetMachine.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXTargetMachine.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXTargetMachine.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXTargetMachine.cpp Mon Aug 22 22:20:09 2016<br>
@@ -20,7 +20,6 @@<br>
 #include "NVPTXTargetTransformInfo.h"<br>
 #include "llvm/Analysis/Passes.h"<br>
 #include "llvm/CodeGen/AsmPrinter.h"<br>
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"<br>
 #include "llvm/CodeGen/MachineModuleInfo.h"<br>
 #include "llvm/CodeGen/Passes.h"<br>
 #include "llvm/CodeGen/TargetPassConfig.h"<br>
<br>
Modified: llvm/trunk/test/CodeGen/Generic/stop-after.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/stop-after.ll?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/stop-after.ll?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/Generic/stop-after.ll (original)<br>
+++ llvm/trunk/test/CodeGen/Generic/stop-after.ll Mon Aug 22 22:20:09 2016<br>
@@ -3,7 +3,6 @@<br>
<br>
 ; STOP: -loop-reduce<br>
 ; STOP: Loop Strength Reduction<br>
-; STOP-NEXT: Machine Function Analysis<br>
 ; STOP-NEXT: MIR Printing Pass<br>
<br>
 ; START: -machine-branch-prob -pre-isel-intrinsic-lowering<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/hidden-vis-pic.ll Mon Aug 22 22:20:09 2016<br>
@@ -17,7 +17,7 @@ entry:<br>
<br>
 ; This must use movl of the stub, not an lea, since the function isn't being<br>
 ; emitted here.<br>
-; CHECK: movl L__ZNSbIcED1Ev$non_lazy_ptr-L1$pb(<br>
+; CHECK: movl L__ZNSbIcED1Ev$non_lazy_ptr-L0$pb(<br>
<br>
<br>
<br>
<br>
Modified: llvm/trunk/tools/llc/llc.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llc/llc.cpp (original)<br>
+++ llvm/trunk/tools/llc/llc.cpp Mon Aug 22 22:20:09 2016<br>
@@ -450,8 +450,7 @@ static int compileModule(char **argv, LL<br>
       LLVMTargetMachine &LLVMTM = static_cast<LLVMTargetMachine&>(*Target);<br>
       TargetPassConfig &TPC = *LLVMTM.createPassConfig(PM);<br>
       PM.add(&TPC);<br>
-      LLVMTM.addMachineModuleInfo(PM);<br>
-      LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());<br>
+      LLVMTM.addMachineModuleInfo(PM, MIR.get());<br>
       TPC.printAndVerify("");<br>
<br>
       for (const std::string &RunPassName : *RunPassNames) {<br>
<br>
Modified: llvm/trunk/unittests/MI/LiveIntervalTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MI/LiveIntervalTest.cpp?rev=279502&r1=279501&r2=279502&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MI/LiveIntervalTest.cpp?rev=279502&r1=279501&r2=279502&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/MI/LiveIntervalTest.cpp (original)<br>
+++ llvm/trunk/unittests/MI/LiveIntervalTest.cpp Mon Aug 22 22:20:09 2016<br>
@@ -70,8 +70,7 @@ std::unique_ptr<Module> parseMIR(LLVMCon<br>
     return nullptr;<br>
<br>
   const LLVMTargetMachine &LLVMTM = static_cast<const LLVMTargetMachine&>(TM);<br>
-  LLVMTM.addMachineModuleInfo(PM);<br>
-  LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());<br>
+  LLVMTM.addMachineModuleInfo(PM, MIR.get());<br>
<br>
   return M;<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>