Grab the DataLayout off of the TargetMachine since that's where
authorEric Christopher <echristo@gmail.com>
Fri, 20 Feb 2015 20:56:39 +0000 (20:56 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 20 Feb 2015 20:56:39 +0000 (20:56 +0000)
it's stored.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230059 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/GlobalMerge.cpp

index 82575671e681c696495e9d3d5ad8d8cd20606444..6da9766379e9bd699eea3048744dc01a7b57244e 100644 (file)
@@ -144,7 +144,7 @@ INITIALIZE_TM_PASS(GlobalMerge, "global-merge", "Merge global variables",
 bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
                           Module &M, bool isConst, unsigned AddrSpace) const {
   const TargetLowering *TLI = TM->getSubtargetImpl()->getTargetLowering();
 bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
                           Module &M, bool isConst, unsigned AddrSpace) const {
   const TargetLowering *TLI = TM->getSubtargetImpl()->getTargetLowering();
-  const DataLayout *DL = TLI->getDataLayout();
+  const DataLayout *DL = TM->getDataLayout();
 
   // FIXME: Infer the maximum possible offset depending on the actual users
   // (these max offsets are different for the users inside Thumb or ARM
 
   // FIXME: Infer the maximum possible offset depending on the actual users
   // (these max offsets are different for the users inside Thumb or ARM
@@ -283,7 +283,7 @@ bool GlobalMerge::doInitialization(Module &M) {
   DenseMap<unsigned, SmallVector<GlobalVariable*, 16> > Globals, ConstGlobals,
                                                         BSSGlobals;
   const TargetLowering *TLI = TM->getSubtargetImpl()->getTargetLowering();
   DenseMap<unsigned, SmallVector<GlobalVariable*, 16> > Globals, ConstGlobals,
                                                         BSSGlobals;
   const TargetLowering *TLI = TM->getSubtargetImpl()->getTargetLowering();
-  const DataLayout *DL = TLI->getDataLayout();
+  const DataLayout *DL = TM->getDataLayout();
   unsigned MaxOffset = TLI->getMaximalGlobalOffset();
   bool Changed = false;
   setMustKeepGlobalVariables(M);
   unsigned MaxOffset = TLI->getMaximalGlobalOffset();
   bool Changed = false;
   setMustKeepGlobalVariables(M);