[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-21 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364066: [clang][NewPM] Add 
-fno-experimental-new-pass-manager to tests (authored by leonardchan, committed 
by ).

Changed prior to commit:
  https://reviews.llvm.org/D63156?vs=205906=206013#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63156

Files:
  cfe/trunk/test/CodeGen/aggregate-assign-call.c
  cfe/trunk/test/CodeGen/arm_acle.c
  cfe/trunk/test/CodeGen/cspgo-instrumentation.c
  cfe/trunk/test/CodeGen/cspgo-instrumentation_lto.c
  cfe/trunk/test/CodeGen/cspgo-instrumentation_thinlto.c
  cfe/trunk/test/CodeGen/pgo-instrumentation.c
  cfe/trunk/test/CodeGen/thinlto-debug-pm.c
  cfe/trunk/test/CodeGenCXX/auto-var-init.cpp
  cfe/trunk/test/CodeGenCXX/conditional-temporaries.cpp
  cfe/trunk/test/CodeGenCXX/member-function-pointer-calls.cpp
  cfe/trunk/test/CodeGenObjC/os_log.m
  cfe/trunk/test/CodeGenObjCXX/os_log.mm
  cfe/trunk/test/Misc/pr32207.c

Index: cfe/trunk/test/CodeGen/aggregate-assign-call.c
===
--- cfe/trunk/test/CodeGen/aggregate-assign-call.c
+++ cfe/trunk/test/CodeGen/aggregate-assign-call.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=O1
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 -fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=O1,O1-LEGACY
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 -fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=O1,O1-NEWPM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=O0
 //
 // Ensure that we place appropriate lifetime markers around indirectly returned
@@ -50,34 +51,32 @@
   struct S r;
   // O1: %[[TMP1_ALLOCA:[^ ]+]] = alloca %struct.S
   // O1: %[[TMP2_ALLOCA:[^ ]+]] = alloca %struct.S
-  // O1: br label %[[DO_BODY:.+]]
 
   do {
-// O1: [[DO_BODY]]:
 // O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
-// O1: br i1 {{[^,]+}}, label %[[IF_THEN:[^,]+]], label %[[IF_END:[^,]+]]
+// O1-LEGACY: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
+// O1-NEWPM: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* nonnull %[[P]])
 //
-// O1: [[IF_THEN]]:
-// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1: br label %[[DO_END:.*]]
+// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
+// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
+// O1-NEWPM: %[[TMP3:.*]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
+// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull %[[P]])
 //
-// O1: [[IF_END]]:
-// O1: call void @foo_int(%struct.S* sret %[[TMP1_ALLOCA]],
+// O1-LEGACY: call void @foo_int(%struct.S* sret %[[TMP1_ALLOCA]],
+// O1-NEWPM: call void @foo_int(%struct.S* nonnull sret %[[TMP1_ALLOCA]],
 // O1: call void @llvm.memcpy
-// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
-// O1: call void @foo_int(%struct.S* sret %[[TMP2_ALLOCA]],
+// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
+// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
+// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull %[[P]])
+// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
+// O1-LEGACY: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
+// O1-NEWPM: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* nonnull %[[TMP3]])
+// O1-LEGACY: call void @foo_int(%struct.S* sret %[[TMP2_ALLOCA]],
+// O1-NEWPM: call void @foo_int(%struct.S* nonnull sret %[[TMP2_ALLOCA]],
 // O1: call void @llvm.memcpy
-// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1: br label %[[DO_COND:.*]]
-//
-// O1: [[DO_COND]]:
-// O1: br label %[[DO_BODY]]
+// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
+// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
+// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull %[[TMP3]])
 r = foo_int(({
   if (*j)
 break;
@@ -87,7 +86,5 @@
 r = foo_int(i++);
} while (1);
 
-  // O1: [[DO_END]]:
-  // O1-NEXT: ret void
   return r;
 }
Index: cfe/trunk/test/CodeGen/arm_acle.c

[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-20 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-20 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments.



Comment at: clang/test/CodeGen/pgo-sample.c:12-14
+// NEWPM-DAG: PostOrderFunctionAttrsPass
+// NEWPM-DAG: SimplifyCFGPass
+// NEWPM-DAG: SampleProfileLoaderPass

chandlerc wrote:
> The DAG worries me a bit ... The point here is to check that we remove EH 
> before attaching sample profile data, and with the DAG it isn't clear that 
> this happens *before*.
It turns out that `SampleProfileLoaderPass` was added before either of these. I 
moved this into a separate patch that addresses it since it comes with a small 
clang + llvm change (D63626).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-20 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 205906.
leonardchan marked 3 inline comments as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156

Files:
  clang/test/CodeGen/aggregate-assign-call.c
  clang/test/CodeGen/arm_acle.c
  clang/test/CodeGen/cspgo-instrumentation.c
  clang/test/CodeGen/cspgo-instrumentation_lto.c
  clang/test/CodeGen/cspgo-instrumentation_thinlto.c
  clang/test/CodeGen/pgo-instrumentation.c
  clang/test/CodeGen/thinlto-debug-pm.c
  clang/test/CodeGenCXX/auto-var-init.cpp
  clang/test/CodeGenCXX/conditional-temporaries.cpp
  clang/test/CodeGenCXX/member-function-pointer-calls.cpp
  clang/test/CodeGenObjC/os_log.m
  clang/test/CodeGenObjCXX/os_log.mm
  clang/test/Misc/pr32207.c

Index: clang/test/Misc/pr32207.c
===
--- clang/test/Misc/pr32207.c
+++ clang/test/Misc/pr32207.c
@@ -1,4 +1,4 @@
 // test for r305179
-// RUN: %clang_cc1 -emit-llvm -O -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O2 -fno-experimental-new-pass-manager -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
 // CHECK: *** IR Dump After Function Integration/Inlining ***
 void foo() {}
Index: clang/test/CodeGenObjCXX/os_log.mm
===
--- clang/test/CodeGenObjCXX/os_log.mm
+++ clang/test/CodeGenObjCXX/os_log.mm
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc \
-// RUN:   -fexceptions -fcxx-exceptions -O1 | FileCheck %s
+// RUN:   -fexceptions -fcxx-exceptions -O1 -fno-experimental-new-pass-manager | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc \
+// RUN:   -fexceptions -fcxx-exceptions -O1 -fexperimental-new-pass-manager -fno-inline | FileCheck %s
 
 // Check that no EH cleanup is emitted around the call to __os_log_helper.
 namespace no_eh_cleanup {
Index: clang/test/CodeGenObjC/os_log.m
===
--- clang/test/CodeGenObjC/os_log.m
+++ clang/test/CodeGenObjC/os_log.m
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fno-experimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-LEGACY
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fexperimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-NEWPM
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O0 | FileCheck %s -check-prefix=CHECK-O0
 
 // Make sure we emit clang.arc.use before calling objc_release as part of the
@@ -22,7 +23,8 @@
   // CHECK: %[[CALL:.*]] = tail call %[[TY0:.*]]* (...) @GenString()
   // CHECK: %[[V0:.*]] = bitcast %[[TY0]]* %[[CALL]] to i8*
   // CHECK: %[[V1:.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[V0]])
-  // CHECK: %[[V2:.*]] = ptrtoint %[[TY0]]* %[[CALL]] to i64
+  // CHECK-LEGACY: %[[V2:.*]] = ptrtoint %[[TY0]]* %[[CALL]] to i64
+  // CHECK-NEWPM: %[[V2:.*]] = ptrtoint i8* %[[V1]] to i64
   // CHECK: store i8 2, i8* %[[BUF]], align 1
   // CHECK: %[[NUMARGS_I:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
   // CHECK: store i8 1, i8* %[[NUMARGS_I]], align 1
@@ -33,8 +35,10 @@
   // CHECK: %[[ARGDATA_I:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
   // CHECK: %[[ARGDATACAST_I:.*]] = bitcast i8* %[[ARGDATA_I]] to i64*
   // CHECK: store i64 %[[V2]], i64* %[[ARGDATACAST_I]], align 1
-  // CHECK: tail call void (...) @llvm.objc.clang.arc.use(%[[TY0]]* %[[CALL]])
-  // CHECK: tail call void @llvm.objc.release(i8* %[[V0]])
+  // CHECK-LEGACY: tail call void (...) @llvm.objc.clang.arc.use(%[[TY0]]* %[[CALL]])
+  // CHECK-LEGACY: tail call void @llvm.objc.release(i8* %[[V0]])
+  // CHECK-NEWPM: tail call void (...) @llvm.objc.clang.arc.use(i8* %[[V1]])
+  // CHECK-NEWPM: tail call void @llvm.objc.release(i8* %[[V1]])
   // CHECK: ret i8* %[[BUF]]
 
   // clang.arc.use is used and removed in IR optimizations. At O0, we should not
Index: clang/test/CodeGenCXX/member-function-pointer-calls.cpp
===
--- clang/test/CodeGenCXX/member-function-pointer-calls.cpp
+++ clang/test/CodeGenCXX/member-function-pointer-calls.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -fno-experimental-new-pass-manager  -o - | FileCheck %s --check-prefixes=CHECK,CHECK-LEGACY
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -fexperimental-new-pass-manager  -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NEWPM
 // RUN: %clang_cc1 %s -triple=x86_64-windows-gnu -emit-llvm -o - | FileCheck %s -check-prefix 

[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-19 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

just a minor comment on one of these...




Comment at: clang/test/CodeGen/pgo-sample.c:10
+
+// The new pass manager analog to PrunEH is a combination of 'function-attrs'
+// and 'function(simplify-cgf)'.

s/PrunEH/PruneEH/



Comment at: clang/test/CodeGen/pgo-sample.c:12-14
+// NEWPM-DAG: PostOrderFunctionAttrsPass
+// NEWPM-DAG: SimplifyCFGPass
+// NEWPM-DAG: SampleProfileLoaderPass

The DAG worries me a bit ... The point here is to check that we remove EH 
before attaching sample profile data, and with the DAG it isn't clear that this 
happens *before*.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-19 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

>> **CodeGen/pgo-sample.c [No new fix]**: The test checks that `PruneEH` runs, 
>> but there doesn’t seem to be a corresponding new PM pass for it. Should 
>> there be? If there is one then we can just check for that in the debug PM 
>> dump.
> 
> The analog would be `function-attrs` and `function(simplify-cfg)` in some 
> combination. Maybe this should just check that some specific thing is 
> optimized away at `-O2` rather than checking the specific details of pass 
> pipeline construction?

For now I added a check that those 2 extra passes are run in the debug pass 
dump. It seems that the original test just wanted to see that a particular pass 
was run, so I left it at that, but I can still add a separate test/run for 
checking that `function-attrs` and `function(simplify-cfg)` replace `invoke` 
instructions at `-O2` (which is what I think PruneEH does).

> Yeah, I think the entry/exit pass really wants to come *before* any other 
> pass. That should be possible even in the new PM by using an extension point?

Moved this into D63577 .

>> **CodeGenCXX/conditional-temporaries.cpp**: The new pm seems to be unable to 
>> statically determine the return value of some functions. For now I just add 
>> separate checks for the new PM IR.
> 
> Interesting. Definitely the right thing for this patch. Maybe file a PR to 
> track understanding why the new PM struggles here.
> 
>> **CodeGenCXX/member-function-pointer-calls.cpp**: Same as 
>> `CodeGenCXX/conditional-temporaries.cpp`. In this case, the new PM codegen 
>> also contains calls to lifetime start/end intrinsics. Perhaps this time it 
>> could be due to the intrinsics not being optimized out?
> 
> Weird, but that's also my best guess. Again, maybe we need a bug to track why 
> this is different.

Created https://bugs.llvm.org/show_bug.cgi?id=42333 to track these 2.

>> **CodeGenObjC/os_log.m**: Legacy test expects argument of `ptrtoint` and 
>> some functions to be a specific type and argument, though the new PM codegen 
>> uses a different type and argument which are also valid since 
>> `@llvm.objc.retainAutoreleasedReturnValue(val)` always returns `val`.
>> 
>> **CodeGenObjCXX/os_log.mm**: A function seems to have been inlined under the 
>> new PM. Here we just prevent inlining for the new PM run since the test 
>> expects this specific function call.
> 
> You could also use a `noinline` attribute in the code to express the 
> *specific* call that needs to be retained?

Hmm `noinline` doesn't seem to be working in this case. The call is made to a 
code generated builtin function (`__os_log_helper`).




Comment at: clang/lib/CodeGen/BackendUtil.cpp:1135-1139
+  PB.registerOptimizerLastEPCallback(
+  [](FunctionPassManager , PassBuilder::OptimizationLevel Level) {
+FPM.addPass(EntryExitInstrumenterPass(/*PostInlining=*/false));
+  });
+

chandlerc wrote:
> FYI, feel free to split out the entry/exit change (and its test) to a 
> separate patch if you want. Either way really.
Separated this into D63577



Comment at: llvm/lib/Passes/PassBuilder.cpp:815-818
+  // running remaining passes on the eliminated functions. These should be
+  // preserved during prelinking for link-time inlining decisions.
+  if (!LTOPreLink)
+MPM.addPass(EliminateAvailableExternallyPass());

chandlerc wrote:
> I'd suggest splitting this into a separate patch to LLVM and adding an 
> LLVM-side test to cover it as well.
Separated this into D63580 and added an LLVM test in that one


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-19 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 205708.
leonardchan marked 3 inline comments as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156

Files:
  clang/test/CodeGen/aggregate-assign-call.c
  clang/test/CodeGen/arm_acle.c
  clang/test/CodeGen/cspgo-instrumentation.c
  clang/test/CodeGen/cspgo-instrumentation_lto.c
  clang/test/CodeGen/cspgo-instrumentation_thinlto.c
  clang/test/CodeGen/pgo-instrumentation.c
  clang/test/CodeGen/pgo-sample.c
  clang/test/CodeGen/thinlto-debug-pm.c
  clang/test/CodeGenCXX/auto-var-init.cpp
  clang/test/CodeGenCXX/conditional-temporaries.cpp
  clang/test/CodeGenCXX/member-function-pointer-calls.cpp
  clang/test/CodeGenObjC/os_log.m
  clang/test/CodeGenObjCXX/os_log.mm
  clang/test/Misc/pr32207.c

Index: clang/test/Misc/pr32207.c
===
--- clang/test/Misc/pr32207.c
+++ clang/test/Misc/pr32207.c
@@ -1,4 +1,4 @@
 // test for r305179
-// RUN: %clang_cc1 -emit-llvm -O -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O2 -fno-experimental-new-pass-manager -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
 // CHECK: *** IR Dump After Function Integration/Inlining ***
 void foo() {}
Index: clang/test/CodeGenObjCXX/os_log.mm
===
--- clang/test/CodeGenObjCXX/os_log.mm
+++ clang/test/CodeGenObjCXX/os_log.mm
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc \
-// RUN:   -fexceptions -fcxx-exceptions -O1 | FileCheck %s
+// RUN:   -fexceptions -fcxx-exceptions -O1 -fno-experimental-new-pass-manager | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc \
+// RUN:   -fexceptions -fcxx-exceptions -O1 -fexperimental-new-pass-manager -fno-inline | FileCheck %s
 
 // Check that no EH cleanup is emitted around the call to __os_log_helper.
 namespace no_eh_cleanup {
Index: clang/test/CodeGenObjC/os_log.m
===
--- clang/test/CodeGenObjC/os_log.m
+++ clang/test/CodeGenObjC/os_log.m
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fno-experimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-LEGACY
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fexperimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-NEWPM
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O0 | FileCheck %s -check-prefix=CHECK-O0
 
 // Make sure we emit clang.arc.use before calling objc_release as part of the
@@ -22,7 +23,8 @@
   // CHECK: %[[CALL:.*]] = tail call %[[TY0:.*]]* (...) @GenString()
   // CHECK: %[[V0:.*]] = bitcast %[[TY0]]* %[[CALL]] to i8*
   // CHECK: %[[V1:.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[V0]])
-  // CHECK: %[[V2:.*]] = ptrtoint %[[TY0]]* %[[CALL]] to i64
+  // CHECK-LEGACY: %[[V2:.*]] = ptrtoint %[[TY0]]* %[[CALL]] to i64
+  // CHECK-NEWPM: %[[V2:.*]] = ptrtoint i8* %[[V1]] to i64
   // CHECK: store i8 2, i8* %[[BUF]], align 1
   // CHECK: %[[NUMARGS_I:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
   // CHECK: store i8 1, i8* %[[NUMARGS_I]], align 1
@@ -33,8 +35,10 @@
   // CHECK: %[[ARGDATA_I:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
   // CHECK: %[[ARGDATACAST_I:.*]] = bitcast i8* %[[ARGDATA_I]] to i64*
   // CHECK: store i64 %[[V2]], i64* %[[ARGDATACAST_I]], align 1
-  // CHECK: tail call void (...) @llvm.objc.clang.arc.use(%[[TY0]]* %[[CALL]])
-  // CHECK: tail call void @llvm.objc.release(i8* %[[V0]])
+  // CHECK-LEGACY: tail call void (...) @llvm.objc.clang.arc.use(%[[TY0]]* %[[CALL]])
+  // CHECK-LEGACY: tail call void @llvm.objc.release(i8* %[[V0]])
+  // CHECK-NEWPM: tail call void (...) @llvm.objc.clang.arc.use(i8* %[[V1]])
+  // CHECK-NEWPM: tail call void @llvm.objc.release(i8* %[[V1]])
   // CHECK: ret i8* %[[BUF]]
 
   // clang.arc.use is used and removed in IR optimizations. At O0, we should not
Index: clang/test/CodeGenCXX/member-function-pointer-calls.cpp
===
--- clang/test/CodeGenCXX/member-function-pointer-calls.cpp
+++ clang/test/CodeGenCXX/member-function-pointer-calls.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -fno-experimental-new-pass-manager  -o - | FileCheck %s --check-prefixes=CHECK,CHECK-LEGACY
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -fexperimental-new-pass-manager  -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NEWPM
 // RUN: %clang_cc1 %s -triple=x86_64-windows-gnu -emit-llvm -o - | 

[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-18 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

In D63156#1543937 , @leonardchan wrote:

> I did some more digging and found the following differences between PMs for 
> each test, and they seem to all differ and can be fixed for different reasons.


Awesome, and sorry this is such a big effort, but I think these are all going 
to end up being pretty interesting root causes. I guess yay, Clang's testing is 
doing its job?

> **CodeGen/aggregate-assign-call.c**: The new PM on -O1 codegen produces the 
> do/while loop differently but still emits the lifetime start/end intrinsics 
> around temporary variables, which is what the test checks for. Here we can 
> just check for the instructions while ignoring the branches generated.

Weird, but makes sense.

> **CodeGen/arm_acle.c**: A bunch of instructions seem to have been combined 
> into a call to `llvm.fshl.i32`, so we just check for those under the new PM.

Same.

> **CodeGen/available-externally-suppress.c**: `available_externally` was not 
> emitted during `-O2 -flto` runs when it should still be retained for link 
> time inlining purposes. This can be fixed by checking that we aren't 
> LTOPrelinking when adding the `EliminateAvailableExternallyPass`.

Yikes, this is a good bug to fix!

> **CodeGen/pgo-sample.c [No new fix]**: The test checks that `PruneEH` runs, 
> but there doesn’t seem to be a corresponding new PM pass for it. Should there 
> be? If there is one then we can just check for that in the debug PM dump.

The analog would be `function-attrs` and `function(simplify-cfg)` in some 
combination. Maybe this should just check that some specific thing is optimized 
away at `-O2` rather than checking the specific details of pass pipeline 
construction?

> **CodeGen/x86_64-instrument-functions.c [No new fix]**: This one's a bit 
> complicated. The initial problem seems to be that `EntryExitInstrumenterPass` 
> was not added into the pipeline to emit `__cyg_profile_func_enter/exit()` 
> calls. Adding that to the pipeline seems to instrument correctly now and add 
> these calls, but we run into a problem with inlining. `root()` expects 2 
> calls to `__cyg_profile_func_enter` and 2 calls to `__cyg_profile_func_exit` 
> in its body,
> 
>   ; Function Attrs: nounwind
>   define i32 @root(i32 returned %x) #0 {
>   entry:
> %0 = tail call i8* @llvm.returnaddress(i32 0)
> tail call void @__cyg_profile_func_enter(i8* bitcast (i32 (i32)* @root to 
> i8*), i8* %0) #2
> tail call void @__cyg_profile_func_enter(i8* bitcast (i32 (i32)* @leaf to 
> i8*), i8* %0) #2
> tail call void @__cyg_profile_func_exit(i8* bitcast (i32 (i32)* @leaf to 
> i8*), i8* %0) #2
> tail call void @__cyg_profile_func_exit(i8* bitcast (i32 (i32)* @root to 
> i8*), i8* %0) #2
> ret i32 %x
>   }
> 
> 
> but we get only 1 call
> 
>   ; Function Attrs: norecurse nounwind readnone
>   define i32 @root(i32 returned %x) local_unnamed_addr #0 {
>   entry:
> %0 = call i8* @llvm.returnaddress(i32 0)
> call void @__cyg_profile_func_enter(i8* bitcast (i32 (i32)* @root to 
> i8*), i8* %0)
> %1 = call i8* @llvm.returnaddress(i32 0)
> call void @__cyg_profile_func_exit(i8* bitcast (i32 (i32)* @root to i8*), 
> i8* %1)
> ret i32 %x
>   }
> 
> 
> I suspect this is due to the `leaf()` being inlined into `root()` even though 
> inlining should happen after it. The legacy `EntryExitInstrumenter` pass 
> seems to be added to the legacy FunctionPassManager first before all others 
> passes. Under the legacy PM, when this pass runs, `root()` should look like:
> 
>   ; Function Attrs: nounwind
>   define i32 @root(i32 %x) #1 {
>   entry:
> %x.addr = alloca i32, align 4
> store i32 %x, i32* %x.addr, align 4, !tbaa !2
> %0 = load i32, i32* %x.addr, align 4, !tbaa !2
> %call = call i32 @leaf(i32 %0)  ; this call is not yet inlined
> ret i32 %call
>   }
> 
> 
> but `root()` looks like this in the new PM pass:
> 
>   ; Function Attrs: norecurse nounwind readnone
>   define i32 @root(i32 returned %x) local_unnamed_addr #1 {
>   entry:
> ret i32 %x
>   }

Yeah, I think the entry/exit pass really wants to come *before* any other pass. 
That should be possible even in the new PM by using an extension point?

> **CodeGenCXX/auto-var-init.cpp**: Auto var initialization is performed 
> differently under new PM than legacy. With initialization for structs with 
> default values, the legacy PM will store the stream of 0xAAs, then initialize 
> the members with default values in a constructor, whereas the new PM will 
> just store the correct value for the whole struct right away without 
> initialization. In one case, it seems that ctor function was also inlined. 
> Fixed by check accounting for these checks separately.

Cool, makes sense.

> **CodeGenCXX/conditional-temporaries.cpp**: The new pm seems to be unable to 
> statically determine the return value of some functions. For now I just add 
> separate checks for the new PM IR.


[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

I did some more digging and found the following differences between PMs for 
each test, and they seem to all differ and can be fixed for different reasons.

**CodeGen/aggregate-assign-call.c**: The new PM on -O1 codegen produces the 
do/while loop differently but still emits the lifetime start/end intrinsics 
around temporary variables, which is what the test checks for. Here we can just 
check for the instructions while ignoring the branches generated.

**CodeGen/arm_acle.c**: A bunch of instructions seem to have been combined into 
a call to `llvm.fshl.i32`, so we just check for those under the new PM.

**CodeGen/available-externally-suppress.c**: `available_externally` was not 
emitted during `-O2 -flto` runs when it should still be retained for link time 
inlining purposes. This can be fixed by checking that we aren't LTOPrelinking 
when adding the `EliminateAvailableExternallyPass`.

**CodeGen/pgo-sample.c [No new fix]**: The test checks that `PruneEH` runs, but 
there doesn’t seem to be a corresponding new PM pass for it. Should there be? 
If there is one then we can just check for that in the debug PM dump.

**CodeGen/x86_64-instrument-functions.c [No new fix]**: This one's a bit 
complicated. The initial problem seems to be that `EntryExitInstrumenterPass` 
was not added into the pipeline to emit `__cyg_profile_func_enter/exit()` 
calls. Adding that to the pipeline seems to instrument correctly now and add 
these calls, but we run into a problem with inlining. `root()` expects 2 calls 
to `__cyg_profile_func_enter` and 2 calls to `__cyg_profile_func_exit` in its 
body,

  ; Function Attrs: nounwind
  define i32 @root(i32 returned %x) #0 {
  entry:
%0 = tail call i8* @llvm.returnaddress(i32 0)
tail call void @__cyg_profile_func_enter(i8* bitcast (i32 (i32)* @root to 
i8*), i8* %0) #2
tail call void @__cyg_profile_func_enter(i8* bitcast (i32 (i32)* @leaf to 
i8*), i8* %0) #2
tail call void @__cyg_profile_func_exit(i8* bitcast (i32 (i32)* @leaf to 
i8*), i8* %0) #2
tail call void @__cyg_profile_func_exit(i8* bitcast (i32 (i32)* @root to 
i8*), i8* %0) #2
ret i32 %x
  }

but we get only 1 call

  ; Function Attrs: norecurse nounwind readnone
  define i32 @root(i32 returned %x) local_unnamed_addr #0 {
  entry:
%0 = call i8* @llvm.returnaddress(i32 0)
call void @__cyg_profile_func_enter(i8* bitcast (i32 (i32)* @root to i8*), 
i8* %0)
%1 = call i8* @llvm.returnaddress(i32 0)
call void @__cyg_profile_func_exit(i8* bitcast (i32 (i32)* @root to i8*), 
i8* %1)
ret i32 %x
  }

I suspect this is due to the `leaf()` being inlined into `root()` even though 
inlining should happen after it. The legacy `EntryExitInstrumenter` pass seems 
to be added to the legacy FunctionPassManager first before all others passes. 
Under the legacy PM, when this pass runs, `root()` should look like:

  ; Function Attrs: nounwind
  define i32 @root(i32 %x) #1 {
  entry:
%x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4, !tbaa !2
%0 = load i32, i32* %x.addr, align 4, !tbaa !2
%call = call i32 @leaf(i32 %0)  ; this call is not yet inlined
ret i32 %call
  }

but `root()` looks like this in the new PM pass:

  ; Function Attrs: norecurse nounwind readnone
  define i32 @root(i32 returned %x) local_unnamed_addr #1 {
  entry:
ret i32 %x
  }

**CodeGenCXX/auto-var-init.cpp**: Auto var initialization is performed 
differently under new PM than legacy. With initialization for structs with 
default values, the legacy PM will store the stream of 0xAAs, then initialize 
the members with default values in a constructor, whereas the new PM will just 
store the correct value for the whole struct right away without initialization. 
In one case, it seems that ctor function was also inlined. Fixed by check 
accounting for these checks separately.

**CodeGenCXX/conditional-temporaries.cpp**: The new pm seems to be unable to 
statically determine the return value of some functions. For now I just add 
separate checks for the new PM IR.

**CodeGenCXX/member-function-pointer-calls.cpp**: Same as 
`CodeGenCXX/conditional-temporaries.cpp`. In this case, the new PM codegen also 
contains calls to lifetime start/end intrinsics. Perhaps this time it could be 
due to the intrinsics not being optimized out?

**CodeGenObjC/os_log.m**: Legacy test expects argument of `ptrtoint` and some 
functions to be a specific type and argument, though the new PM codegen uses a 
different type and argument which are also valid since 
`@llvm.objc.retainAutoreleasedReturnValue(val)` always returns `val`.

**CodeGenObjCXX/os_log.mm**: A function seems to have been inlined under the 
new PM. Here we just prevent inlining for the new PM run since the test expects 
this specific function call.

**Misc/pr32207.c [No new fix]**: The banner is something that appears only in 
the legacy PM. I think the test only checks that the banner is printed and not 
so much that the 

[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 204808.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/CodeGen/aggregate-assign-call.c
  clang/test/CodeGen/arm_acle.c
  clang/test/CodeGen/available-externally-suppress.c
  clang/test/CodeGen/cspgo-instrumentation.c
  clang/test/CodeGen/cspgo-instrumentation_lto.c
  clang/test/CodeGen/cspgo-instrumentation_thinlto.c
  clang/test/CodeGen/pgo-instrumentation.c
  clang/test/CodeGen/pgo-sample.c
  clang/test/CodeGen/thinlto-debug-pm.c
  clang/test/CodeGen/x86_64-instrument-functions.c
  clang/test/CodeGenCXX/auto-var-init.cpp
  clang/test/CodeGenCXX/conditional-temporaries.cpp
  clang/test/CodeGenCXX/member-function-pointer-calls.cpp
  clang/test/CodeGenObjC/os_log.m
  clang/test/CodeGenObjCXX/os_log.mm
  clang/test/Misc/pr32207.c
  llvm/lib/Passes/PassBuilder.cpp

Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -812,8 +812,10 @@
   // available externally globals. Eventually they will be suppressed during
   // codegen, but eliminating here enables more opportunity for GlobalDCE as it
   // may make globals referenced by available external functions dead and saves
-  // running remaining passes on the eliminated functions.
-  MPM.addPass(EliminateAvailableExternallyPass());
+  // running remaining passes on the eliminated functions. These should be
+  // preserved during prelinking for link-time inlining decisions.
+  if (!LTOPreLink)
+MPM.addPass(EliminateAvailableExternallyPass());
 
   if (EnableOrderFileInstrumentation)
 MPM.addPass(InstrOrderFilePass());
Index: clang/test/Misc/pr32207.c
===
--- clang/test/Misc/pr32207.c
+++ clang/test/Misc/pr32207.c
@@ -1,4 +1,4 @@
 // test for r305179
-// RUN: %clang_cc1 -emit-llvm -O -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O2 -fno-experimental-new-pass-manager -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
 // CHECK: *** IR Dump After Function Integration/Inlining ***
 void foo() {}
Index: clang/test/CodeGenObjCXX/os_log.mm
===
--- clang/test/CodeGenObjCXX/os_log.mm
+++ clang/test/CodeGenObjCXX/os_log.mm
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc \
-// RUN:   -fexceptions -fcxx-exceptions -O1 | FileCheck %s
+// RUN:   -fexceptions -fcxx-exceptions -O1 -fno-experimental-new-pass-manager | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc \
+// RUN:   -fexceptions -fcxx-exceptions -O1 -fexperimental-new-pass-manager -fno-inline | FileCheck %s
 
 // Check that no EH cleanup is emitted around the call to __os_log_helper.
 namespace no_eh_cleanup {
Index: clang/test/CodeGenObjC/os_log.m
===
--- clang/test/CodeGenObjC/os_log.m
+++ clang/test/CodeGenObjC/os_log.m
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fno-experimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-LEGACY
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fexperimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-NEWPM
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O0 | FileCheck %s -check-prefix=CHECK-O0
 
 // Make sure we emit clang.arc.use before calling objc_release as part of the
@@ -22,7 +23,8 @@
   // CHECK: %[[CALL:.*]] = tail call %[[TY0:.*]]* (...) @GenString()
   // CHECK: %[[V0:.*]] = bitcast %[[TY0]]* %[[CALL]] to i8*
   // CHECK: %[[V1:.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %[[V0]])
-  // CHECK: %[[V2:.*]] = ptrtoint %[[TY0]]* %[[CALL]] to i64
+  // CHECK-LEGACY: %[[V2:.*]] = ptrtoint %[[TY0]]* %[[CALL]] to i64
+  // CHECK-NEWPM: %[[V2:.*]] = ptrtoint i8* %[[V1]] to i64
   // CHECK: store i8 2, i8* %[[BUF]], align 1
   // CHECK: %[[NUMARGS_I:.*]] = getelementptr i8, i8* %[[BUF]], i64 1
   // CHECK: store i8 1, i8* %[[NUMARGS_I]], align 1
@@ -33,8 +35,10 @@
   // CHECK: %[[ARGDATA_I:.*]] = getelementptr i8, i8* %[[BUF]], i64 4
   // CHECK: %[[ARGDATACAST_I:.*]] = bitcast i8* %[[ARGDATA_I]] to i64*
   // CHECK: store i64 %[[V2]], i64* %[[ARGDATACAST_I]], align 1
-  // CHECK: tail call void (...) @llvm.objc.clang.arc.use(%[[TY0]]* %[[CALL]])
-  // CHECK: tail call void @llvm.objc.release(i8* %[[V0]])
+  // CHECK-LEGACY: tail call void (...) @llvm.objc.clang.arc.use(%[[TY0]]* %[[CALL]])
+  

[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-12 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

I understand the change to explicitly say `-O2`. I also understand the change 
to add an explicit `-fno-experimental-new-pass-manager` to a `RUN` line when we 
have another `RUN` line that explicitly uses `-fexperiemntal-new-pass-manager`.

But for many of these cases, there is no new-PM `RUN` line in the test. If 
we're going to fix one `RUN` line to a particular pass manager, we should fix 
both IMO unless there is something quite odd about the IR being tested that 
makes the result of optimizinng be weirdly different between the two pass 
managers. That would be somewhat surprising, so I kinda want to know if we 
actually see that so often to understand what is causing this divergence.

In general, Clang tests shouldn't be checking such complex optimizations that 
the differences between the pass managers really manifests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63156



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63156: [clang][NewPM] Add -fno-experimental-new-pass-manager to tests

2019-06-11 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision.
leonardchan added reviewers: chandlerc, echristo, phosek, serge-sans-paille.
leonardchan added a project: clang.
Herald added subscribers: dexonsmith, steven_wu, javed.absar, mehdi_amini.

As per the discussion on D58375 , we disable 
test that have optimizations under the new PM. This patch adds 
`-fno-experimental-new-pass-manager` to RUNS that:

- Already run with optimizations (`-O1` or higher) that were missed in D58375 
.
- Explicitly test new PM behavior along side some new PM RUNS, but are missing 
this flag if new PM is enabled by default.
- Specify `-O` without the number. Based on `getOptimizationLevel()`, it seems 
the default is 2, and the IR appears to be the same when changed to `-O2`, so 
update the test to explicitly say `-O2` and provide 
-fno-experimental-new-pass-manager`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63156

Files:
  clang/test/CodeGen/aggregate-assign-call.c
  clang/test/CodeGen/arm_acle.c
  clang/test/CodeGen/available-externally-suppress.c
  clang/test/CodeGen/cspgo-instrumentation.c
  clang/test/CodeGen/cspgo-instrumentation_lto.c
  clang/test/CodeGen/cspgo-instrumentation_thinlto.c
  clang/test/CodeGen/pgo-instrumentation.c
  clang/test/CodeGen/pgo-sample.c
  clang/test/CodeGen/thinlto-debug-pm.c
  clang/test/CodeGen/x86_64-instrument-functions.c
  clang/test/CodeGenCXX/auto-var-init.cpp
  clang/test/CodeGenCXX/conditional-temporaries.cpp
  clang/test/CodeGenCXX/member-function-pointer-calls.cpp
  clang/test/CodeGenObjC/os_log.m
  clang/test/CodeGenObjCXX/os_log.mm
  clang/test/Misc/pr32207.c

Index: clang/test/Misc/pr32207.c
===
--- clang/test/Misc/pr32207.c
+++ clang/test/Misc/pr32207.c
@@ -1,4 +1,4 @@
 // test for r305179
-// RUN: %clang_cc1 -emit-llvm -O -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O2 -fno-experimental-new-pass-manager -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
 // CHECK: *** IR Dump After Function Integration/Inlining ***
 void foo() {}
Index: clang/test/CodeGenObjCXX/os_log.mm
===
--- clang/test/CodeGenObjCXX/os_log.mm
+++ clang/test/CodeGenObjCXX/os_log.mm
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc \
-// RUN:   -fexceptions -fcxx-exceptions -O1 | FileCheck %s
+// RUN:   -fexceptions -fcxx-exceptions -O1 -fno-experimental-new-pass-manager | FileCheck %s
 
 // Check that no EH cleanup is emitted around the call to __os_log_helper.
 namespace no_eh_cleanup {
Index: clang/test/CodeGenObjC/os_log.m
===
--- clang/test/CodeGenObjC/os_log.m
+++ clang/test/CodeGenObjC/os_log.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fno-experimental-new-pass-manager | FileCheck %s
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O0 | FileCheck %s -check-prefix=CHECK-O0
 
 // Make sure we emit clang.arc.use before calling objc_release as part of the
Index: clang/test/CodeGenCXX/member-function-pointer-calls.cpp
===
--- clang/test/CodeGenCXX/member-function-pointer-calls.cpp
+++ clang/test/CodeGenCXX/member-function-pointer-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -fno-experimental-new-pass-manager  -o - | FileCheck %s
 // RUN: %clang_cc1 %s -triple=x86_64-windows-gnu -emit-llvm -o - | FileCheck %s -check-prefix MINGW64
 struct A {
   virtual int vf1() { return 1; }
Index: clang/test/CodeGenCXX/conditional-temporaries.cpp
===
--- clang/test/CodeGenCXX/conditional-temporaries.cpp
+++ clang/test/CodeGenCXX/conditional-temporaries.cpp
@@ -1,7 +1,7 @@
 // REQUIRES: amdgpu-registered-target
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O2 -disable-llvm-passes | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O2 | FileCheck %s --check-prefixes=CHECK,CHECK-OPT
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=amdgcn-amd-amdhsa -O2 | FileCheck %s --check-prefixes=CHECK,CHECK-OPT
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O2 -fno-experimental-new-pass-manager -disable-llvm-passes | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -O2 -fno-experimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-OPT
+// RUN: %clang_cc1 -emit-llvm