[llvm] r310531 - [Path] Sink predicate computations to their uses. NFCI.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 15:06:32 PDT 2017


Author: d0k
Date: Wed Aug  9 15:06:32 2017
New Revision: 310531

URL: http://llvm.org/viewvc/llvm-project?rev=310531&view=rev
Log:
[Path] Sink predicate computations to their uses. NFCI.

Modified:
    llvm/trunk/lib/Support/Path.cpp

Modified: llvm/trunk/lib/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=310531&r1=310530&r2=310531&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Path.cpp (original)
+++ llvm/trunk/lib/Support/Path.cpp Wed Aug  9 15:06:32 2017
@@ -439,10 +439,6 @@ void append(SmallVectorImpl<char> &path,
   for (auto &component : components) {
     bool path_has_sep =
         !path.empty() && is_separator(path[path.size() - 1], style);
-    bool component_has_sep =
-        !component.empty() && is_separator(component[0], style);
-    bool is_root_name = has_root_name(component, style);
-
     if (path_has_sep) {
       // Strip separators from beginning of component.
       size_t loc = component.find_first_not_of(separators(style));
@@ -453,7 +449,10 @@ void append(SmallVectorImpl<char> &path,
       continue;
     }
 
-    if (!component_has_sep && !(path.empty() || is_root_name)) {
+    bool component_has_sep =
+        !component.empty() && is_separator(component[0], style);
+    if (!component_has_sep &&
+        !(path.empty() || has_root_name(component, style))) {
       // Add a separator.
       path.push_back(preferred_separator(style));
     }




More information about the llvm-commits mailing list