[PATCH] D59304: Fix invocation of Gold plugin with LTO after r355331

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 16:54:29 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL356111: Fix invocation of Gold plugin with LTO after r355331 (authored by nemanjai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59304?vs=190429&id=190543#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59304/new/

https://reviews.llvm.org/D59304

Files:
  cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
  cfe/trunk/test/Driver/cspgo-lto.c


Index: cfe/trunk/test/Driver/cspgo-lto.c
===================================================================
--- cfe/trunk/test/Driver/cspgo-lto.c
+++ cfe/trunk/test/Driver/cspgo-lto.c
@@ -0,0 +1,6 @@
+// RUN: touch %t.o
+//
+// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto=thin \
+// RUN:   -fprofile-use 2>&1 | FileCheck %s
+
+// CHECK: -plugin-opt=cs-profile-path=default.profdata
Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
@@ -464,8 +464,12 @@
       CmdArgs.push_back(
           Args.MakeArgString("-plugin-opt=cs-profile-path=default_%m.profraw"));
   } else if (ProfileUseArg) {
+    SmallString<128> Path(
+        ProfileUseArg->getNumValues() == 0 ? "" : ProfileUseArg->getValue());
+    if (Path.empty() || llvm::sys::fs::is_directory(Path))
+      llvm::sys::path::append(Path, "default.profdata");
     CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=cs-profile-path=") +
-                                         ProfileUseArg->getValue()));
+                                         Path));
   }
 
   // Need this flag to turn on new pass manager via Gold plugin.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59304.190543.patch
Type: text/x-patch
Size: 1281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190313/81465eb8/attachment.bin>


More information about the cfe-commits mailing list