diff -uNr cfe-3.9.0.src.orig/lib/Driver/Tools.cpp cfe-3.9.0.src/lib/Driver/Tools.cpp
--- cfe-3.9.0.src.orig/lib/Driver/Tools.cpp	2016-08-13 16:43:56.000000000 -0400
+++ cfe-3.9.0.src/lib/Driver/Tools.cpp	2016-10-29 07:57:22.000000000 -0400
@@ -7637,22 +7637,22 @@
       CmdArgs.push_back("-object_path_lto");
       CmdArgs.push_back(TmpPath);
     }
+  }
 
-    // Use -lto_library option to specify the libLTO.dylib path. Try to find
-    // it in clang installed libraries. If not found, the option is not used
-    // and 'ld' will use its default mechanism to search for libLTO.dylib.
-    if (Version[0] >= 133) {
-      // Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
-      StringRef P = llvm::sys::path::parent_path(D.getInstalledDir());
-      SmallString<128> LibLTOPath(P);
-      llvm::sys::path::append(LibLTOPath, "lib");
-      llvm::sys::path::append(LibLTOPath, "libLTO.dylib");
-      if (llvm::sys::fs::exists(LibLTOPath)) {
-        CmdArgs.push_back("-lto_library");
-        CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
-      } else {
-        D.Diag(diag::warn_drv_lto_libpath);
-      }
+  // Use -lto_library option to specify the libLTO.dylib path. Try to find
+  // it in clang installed libraries. If not found, the option is not used
+  // and 'ld' will use its default mechanism to search for libLTO.dylib.
+  if (Version[0] >= 133) {
+    // Search for libLTO in <InstalledDir>/../lib/libLTO.dylib
+    StringRef P = llvm::sys::path::parent_path(D.Dir);
+    SmallString<128> LibLTOPath(P);
+    llvm::sys::path::append(LibLTOPath, "lib");
+    llvm::sys::path::append(LibLTOPath, "libLTO.dylib");
+    if (llvm::sys::fs::exists(LibLTOPath)) {
+      CmdArgs.push_back("-lto_library");
+      CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
+    } else {
+      D.Diag(diag::warn_drv_lto_libpath);
     }
   }
 
diff -uNr cfe-3.9.0.src.orig/test/Driver/darwin-ld-lto.c cfe-3.9.0.src/test/Driver/darwin-ld-lto.c
--- cfe-3.9.0.src.orig/test/Driver/darwin-ld-lto.c	2015-10-02 11:10:33.000000000 -0400
+++ cfe-3.9.0.src/test/Driver/darwin-ld-lto.c	2016-10-29 07:58:30.000000000 -0400
@@ -3,7 +3,7 @@
 // Check that ld gets "-lto_library" and warnings about libLTO.dylib path.
 
 // RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN:   -mlinker-version=133 -flto 2> %t.log
+// RUN:   -mlinker-version=133 2> %t.log
 // RUN: cat %t.log
 // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s < %t.log
 //
@@ -11,14 +11,14 @@
 // LINK_LTOLIB_PATH: "-lto_library"
 
 // RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 -flto 2> %t.log
+// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
 // RUN: cat %t.log
 // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_WRN %s < %t.log
 //
 // LINK_LTOLIB_PATH_WRN: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead
 
 // RUN: %clang -target x86_64-apple-darwin10 -### %s \
-// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto -flto 2> %t.log
+// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto 2> %t.log
 // RUN: cat %t.log
 // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_NOWRN %s < %t.log
 //
