Make DataLayout Non-Optional in the Module
[oota-llvm.git] / lib / Transforms / Scalar / SROA.cpp
index 3ab5973643cb03a3141674b9e7ec1f4ee1f3f1e6..09670c63080f59bdb3e80d04572a0720bead475d 100644 (file)
@@ -4423,12 +4423,7 @@ bool SROA::runOnFunction(Function &F) {
 
   DEBUG(dbgs() << "SROA function: " << F.getName() << "\n");
   C = &F.getContext();
-  DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
-  if (!DLP) {
-    DEBUG(dbgs() << "  Skipping SROA -- no target data!\n");
-    return false;
-  }
-  DL = &DLP->getDataLayout();
+  DL = &F.getParent()->getDataLayout();
   DominatorTreeWrapperPass *DTWP =
       getAnalysisIfAvailable<DominatorTreeWrapperPass>();
   DT = DTWP ? &DTWP->getDomTree() : nullptr;