[PH] Teach the new PM code path to support -disable-llvm-passes.

This is kind of funny because I specifically did work to make this easy
and then it didn't actually get implemented.

I've also ported a set of tests that rely on this functionality to run
with the new PM as well as the old PM so that we don't mess this up in
the future.

llvm-svn: 290558
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 3a5fdb4..5f4878b 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -780,17 +780,20 @@
   PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
 
   ModulePassManager MPM;
-  if (CodeGenOpts.OptimizationLevel == 0) {
-    // Build a minimal pipeline based on the semantics required by Clang, which
-    // is just that always inlining occurs.
-    MPM.addPass(AlwaysInlinerPass());
-  } else {
-    // Otherwise, use the default pass pipeline. We also have to map our
-    // optimization levels into one of the distinct levels used to configure
-    // the pipeline.
-    PassBuilder::OptimizationLevel Level = mapToLevel(CodeGenOpts);
 
-    MPM = PB.buildPerModuleDefaultPipeline(Level);
+  if (!CodeGenOpts.DisableLLVMPasses) {
+    if (CodeGenOpts.OptimizationLevel == 0) {
+      // Build a minimal pipeline based on the semantics required by Clang,
+      // which is just that always inlining occurs.
+      MPM.addPass(AlwaysInlinerPass());
+    } else {
+      // Otherwise, use the default pass pipeline. We also have to map our
+      // optimization levels into one of the distinct levels used to configure
+      // the pipeline.
+      PassBuilder::OptimizationLevel Level = mapToLevel(CodeGenOpts);
+
+      MPM = PB.buildPerModuleDefaultPipeline(Level);
+    }
   }
 
   // FIXME: We still use the legacy pass manager to do code generation. We