jlebar updated this revision to Diff 44155.
jlebar added a comment.

Fix rebase conflict.


http://reviews.llvm.org/D15936

Files:
  lib/Driver/Driver.cpp

Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1297,11 +1297,12 @@
   SmallVector<const char *, 4> GpuArchList;
   llvm::StringSet<> GpuArchNames;
   for (Arg *A : Args) {
-    if (A->getOption().matches(options::OPT_cuda_gpu_arch_EQ)) {
-      A->claim();
-      if (GpuArchNames.insert(A->getValue()).second)
-        GpuArchList.push_back(A->getValue());
+    if (!A->getOption().matches(options::OPT_cuda_gpu_arch_EQ)) {
+      continue;
     }
+    A->claim();
+    if (GpuArchNames.insert(A->getValue()).second)
+      GpuArchList.push_back(A->getValue());
   }
 
   // Default to sm_20 which is the lowest common denominator for supported 
GPUs.
@@ -1324,13 +1325,11 @@
          "Failed to create actions for all devices");
 
   // Check whether any of device actions stopped before they could generate 
PTX.
-  bool PartialCompilation = false;
-  for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
-    if (CudaDeviceActions[I]->getKind() != Action::BackendJobClass) {
-      PartialCompilation = true;
-      break;
-    }
-  }
+  bool PartialCompilation =
+      std::any_of(CudaDeviceActions.begin(), CudaDeviceActions.end(),
+                  [](const std::shared_ptr<Action> a) {
+                    return a->getKind() != Action::BackendJobClass;
+                  });
 
   // Figure out what to do with device actions -- pass them as inputs to the
   // host action or run each of them independently.
@@ -1468,12 +1467,11 @@
       continue;
     }
 
-    phases::ID CudaInjectionPhase = FinalPhase;
-    for (const auto &Phase : PL)
-      if (Phase <= FinalPhase && Phase == phases::Compile) {
-        CudaInjectionPhase = Phase;
-        break;
-      }
+    phases::ID CudaInjectionPhase =
+        (phases::Compile < FinalPhase &&
+         std::find(PL.begin(), PL.end(), phases::Compile) != PL.end())
+            ? phases::Compile
+            : FinalPhase;
 
     // Build the pipeline for this file.
     std::shared_ptr<Action> Current =


Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1297,11 +1297,12 @@
   SmallVector<const char *, 4> GpuArchList;
   llvm::StringSet<> GpuArchNames;
   for (Arg *A : Args) {
-    if (A->getOption().matches(options::OPT_cuda_gpu_arch_EQ)) {
-      A->claim();
-      if (GpuArchNames.insert(A->getValue()).second)
-        GpuArchList.push_back(A->getValue());
+    if (!A->getOption().matches(options::OPT_cuda_gpu_arch_EQ)) {
+      continue;
     }
+    A->claim();
+    if (GpuArchNames.insert(A->getValue()).second)
+      GpuArchList.push_back(A->getValue());
   }
 
   // Default to sm_20 which is the lowest common denominator for supported GPUs.
@@ -1324,13 +1325,11 @@
          "Failed to create actions for all devices");
 
   // Check whether any of device actions stopped before they could generate PTX.
-  bool PartialCompilation = false;
-  for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
-    if (CudaDeviceActions[I]->getKind() != Action::BackendJobClass) {
-      PartialCompilation = true;
-      break;
-    }
-  }
+  bool PartialCompilation =
+      std::any_of(CudaDeviceActions.begin(), CudaDeviceActions.end(),
+                  [](const std::shared_ptr<Action> a) {
+                    return a->getKind() != Action::BackendJobClass;
+                  });
 
   // Figure out what to do with device actions -- pass them as inputs to the
   // host action or run each of them independently.
@@ -1468,12 +1467,11 @@
       continue;
     }
 
-    phases::ID CudaInjectionPhase = FinalPhase;
-    for (const auto &Phase : PL)
-      if (Phase <= FinalPhase && Phase == phases::Compile) {
-        CudaInjectionPhase = Phase;
-        break;
-      }
+    phases::ID CudaInjectionPhase =
+        (phases::Compile < FinalPhase &&
+         std::find(PL.begin(), PL.end(), phases::Compile) != PL.end())
+            ? phases::Compile
+            : FinalPhase;
 
     // Build the pipeline for this file.
     std::shared_ptr<Action> Current =
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to