diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp --- a/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp @@ -119,14 +119,11 @@ } /// Given a base library directory, append path components to form the -/// LTO directory. The LLVMRevision allows the path to be keyed to the -/// specific version of LLVM in used, as the bitcode format is not stable. -static std::string AppendLTOLibDir(const std::string &Dir, - const std::string &LLVMRevision) { - if (LLVMRevision.empty()) { - return Dir; - } - return Dir + "/llvm-lto/" + LLVMRevision; +/// LTO directory. +static std::string AppendLTOLibDir(const std::string &Dir) { + // The version allows the path to be keyed to the specific version of + // LLVM in used, as the bitcode format is not stable. + return Dir + "/llvm-lto/" LLVM_VERSION_STRING; } WebAssembly::WebAssembly(const Driver &D, const llvm::Triple &Triple, @@ -148,15 +145,11 @@ getMultiarchTriple(getDriver(), Triple, getDriver().SysRoot); auto Sysroot = getDriver().SysRoot; if (D.isUsingLTO()) { - auto LLVMRevision = getLLVMRevision(); - if (!LLVMRevision.empty()) { - // For LTO, enable use of lto-enabled sysroot libraries too, if available. - // Note that the directory is keyed to the LLVM revision, as LLVM's - // bitcode format is not stable. - auto Dir = AppendLTOLibDir(Sysroot + "/lib/" + MultiarchTriple, - LLVMRevision); - getFilePaths().push_back(Dir); - } + // For LTO, enable use of lto-enabled sysroot libraries too, if available. + // Note that the directory is keyed to the LLVM revision, as LLVM's + // bitcode format is not stable. + auto Dir = AppendLTOLibDir(Sysroot + "/lib/" + MultiarchTriple); + getFilePaths().push_back(Dir); } getFilePaths().push_back(Sysroot + "/lib/" + MultiarchTriple); } @@ -166,12 +159,9 @@ // If we're doing LTO and we have an LTO library available, use it. const auto &D = getDriver(); if (D.isUsingLTO()) { - auto LLVMRevision = getLLVMRevision(); - if (!LLVMRevision.empty()) { - auto Dir = AppendLTOLibDir(ToolChain::getCompilerRTPath(), LLVMRevision); - if (llvm::sys::fs::exists(Dir)) - return Dir; - } + auto Dir = AppendLTOLibDir(ToolChain::getCompilerRTPath()); + if (llvm::sys::fs::exists(Dir)) + return Dir; } // Otherwise just use the default.