[Polly] Remove use of -O3 in regression test.

In addition to that regression tests should not test the intire pass
pipeline (unless they are testing the pipeline itself), the Polly-ACC
currently does not support the new pass manager. If enabled by default,
such tests will therefore fail.

Use the -polly-gpu-runtime and -polly-gpu-arch options also as default
values for the PPCGCodeGeneration pass. This requires to move the option
to be moved from the pipeline-building Register passes to the
PPCGCodeGeneration implementation.

Fixes the spir-typesize.ll buildbot fail.

GitOrigin-RevId: 3dcb535115e48a90886ed6cf275bd3eea14e354f
diff --git a/include/polly/CodeGen/PPCGCodeGeneration.h b/include/polly/CodeGen/PPCGCodeGeneration.h
index d003fb2..9a6c596 100644
--- a/include/polly/CodeGen/PPCGCodeGeneration.h
+++ b/include/polly/CodeGen/PPCGCodeGeneration.h
@@ -22,6 +22,12 @@
 
 namespace polly {
 extern bool PollyManagedMemory;
-}
+
+/// Use for pass instantiation defaults.
+/// @{
+extern GPURuntime GPURuntimeChoice;
+extern GPUArch GPUArchChoice;
+/// @}
+} // namespace polly
 
 #endif // POLLY_PPCGCODEGENERATION_H
diff --git a/lib/CodeGen/PPCGCodeGeneration.cpp b/lib/CodeGen/PPCGCodeGeneration.cpp
index 0b95900..53818a4 100644
--- a/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -117,6 +117,29 @@
                cl::desc("Minimal number of compute statements to run on GPU."),
                cl::Hidden, cl::init(10 * 512 * 512));
 
+GPURuntime polly::GPURuntimeChoice;
+static cl::opt<GPURuntime, true> XGPURuntimeChoice(
+    "polly-gpu-runtime", cl::desc("The GPU Runtime API to target"),
+    cl::values(clEnumValN(GPURuntime::CUDA, "libcudart",
+                          "use the CUDA Runtime API"),
+               clEnumValN(GPURuntime::OpenCL, "libopencl",
+                          "use the OpenCL Runtime API")),
+    cl::location(polly::GPURuntimeChoice), cl::init(GPURuntime::CUDA),
+    cl::ZeroOrMore, cl::cat(PollyCategory));
+
+GPUArch polly::GPUArchChoice;
+static cl::opt<GPUArch, true>
+    XGPUArchChoice("polly-gpu-arch", cl::desc("The GPU Architecture to target"),
+                   cl::values(clEnumValN(GPUArch::NVPTX64, "nvptx64",
+                                         "target NVIDIA 64-bit architecture"),
+                              clEnumValN(GPUArch::SPIR32, "spir32",
+                                         "target SPIR 32-bit architecture"),
+                              clEnumValN(GPUArch::SPIR64, "spir64",
+                                         "target SPIR 64-bit architecture")),
+                   cl::location(polly::GPUArchChoice),
+                   cl::init(GPUArch::NVPTX64), cl::ZeroOrMore,
+                   cl::cat(PollyCategory));
+
 extern bool polly::PerfMonitoring;
 
 /// Return  a unique name for a Scop, which is the scop region with the
@@ -2548,7 +2571,11 @@
   const DataLayout *DL;
   RegionInfo *RI;
 
-  PPCGCodeGeneration() : ScopPass(ID) {}
+  PPCGCodeGeneration() : ScopPass(ID) {
+    // Apply defaults.
+    Runtime = GPURuntimeChoice;
+    Architecture = GPUArchChoice;
+  }
 
   /// Construct compilation options for PPCG.
   ///
diff --git a/lib/Support/RegisterPasses.cpp b/lib/Support/RegisterPasses.cpp
index d9caed4..0d2a580 100644
--- a/lib/Support/RegisterPasses.cpp
+++ b/lib/Support/RegisterPasses.cpp
@@ -106,27 +106,6 @@
                           ),
            cl::init(TARGET_CPU), cl::ZeroOrMore, cl::cat(PollyCategory));
 
-#ifdef GPU_CODEGEN
-static cl::opt<GPURuntime> GPURuntimeChoice(
-    "polly-gpu-runtime", cl::desc("The GPU Runtime API to target"),
-    cl::values(clEnumValN(GPURuntime::CUDA, "libcudart",
-                          "use the CUDA Runtime API"),
-               clEnumValN(GPURuntime::OpenCL, "libopencl",
-                          "use the OpenCL Runtime API")),
-    cl::init(GPURuntime::CUDA), cl::ZeroOrMore, cl::cat(PollyCategory));
-
-static cl::opt<GPUArch>
-    GPUArchChoice("polly-gpu-arch", cl::desc("The GPU Architecture to target"),
-                  cl::values(clEnumValN(GPUArch::NVPTX64, "nvptx64",
-                                        "target NVIDIA 64-bit architecture"),
-                             clEnumValN(GPUArch::SPIR32, "spir32",
-                                        "target SPIR 32-bit architecture"),
-                             clEnumValN(GPUArch::SPIR64, "spir64",
-                                        "target SPIR 64-bit architecture")),
-                  cl::init(GPUArch::NVPTX64), cl::ZeroOrMore,
-                  cl::cat(PollyCategory));
-#endif
-
 VectorizerChoice polly::PollyVectorizerChoice;
 static cl::opt<polly::VectorizerChoice, true> Vectorizer(
     "polly-vectorizer", cl::desc("Select the vectorization strategy"),
diff --git a/test/GPGPU/spir-typesize.ll b/test/GPGPU/spir-typesize.ll
index dae75ad..2e94591 100644
--- a/test/GPGPU/spir-typesize.ll
+++ b/test/GPGPU/spir-typesize.ll
@@ -1,9 +1,9 @@
-; RUN: opt %loadPolly -O3 -polly -polly-target=gpu \
+; RUN: opt %loadPolly -polly-codegen-ppcg \
 ; RUN: -polly-gpu-arch=spir64 \
 ; RUN: -polly-acc-dump-kernel-ir -polly-process-unprofitable -disable-output < %s | \
 ; RUN: FileCheck -check-prefix=I64 %s
 
-; RUN: opt %loadPolly -O3 -polly -polly-target=gpu \
+; RUN: opt %loadPolly -polly-codegen-ppcg \
 ; RUN: -polly-gpu-arch=spir32 \
 ; RUN: -polly-acc-dump-kernel-ir -polly-process-unprofitable -disable-output < %s | \
 ; RUN: FileCheck -check-prefix=I32 %s