[PATCH] D110599: [test] Don't run optimization-remark.c against the legacy PM

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 27 16:59:08 PDT 2021


aeubanks created this revision.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

We may not emit some inlining remarks under -O0 (which seems
reasonable), so use -O1 in these tests.

This happens to make it pass when the legacy PM is turned on by default.
Previously some RUN lines were failing due to differences in the two
pass managers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110599

Files:
  clang/test/Frontend/optimization-remark.c


Index: clang/test/Frontend/optimization-remark.c
===================================================================
--- clang/test/Frontend/optimization-remark.c
+++ clang/test/Frontend/optimization-remark.c
@@ -1,36 +1,31 @@
 // This file tests the -Rpass family of flags (-Rpass, -Rpass-missed
-// and -Rpass-analysis) with the inliner. The test is designed to
-// always trigger the inliner, so it should be independent of the
-// optimization level (under the legacy PM). The inliner is not added to the new
-// PM pipeline unless optimizations are present.
+// and -Rpass-analysis) with the inliner. We may not consider every call to be
+// inlined (new PM + -O0) so these tests run at -O1.
 
 // The inliner for the new PM does not seem to be enabled at O0, but we still
 // get the same remarks with at least O1. The remarks are also slightly
 // different and located in another test file.
-// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O0 -fno-experimental-new-pass-manager -emit-llvm-only -verify
-// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O0 -fno-experimental-new-pass-manager -emit-llvm-only -debug-info-kind=line-tables-only -verify
-// RUN: %clang_cc1 %s -Rpass=inline -emit-llvm -o - 2>/dev/null | FileCheck %s
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -emit-llvm-only -verify
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -emit-llvm-only -debug-info-kind=line-tables-only -verify
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -emit-llvm -o - 2>/dev/null | FileCheck %s
 //
 // Check that we can override -Rpass= with -Rno-pass.
-// RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
-// RUN: %clang_cc1 %s -Rpass=inline -Rno-pass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
-// RUN: %clang_cc1 %s -Rpass=inline -Rno-everything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
-// RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -Rno-everything -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
-//
-// The inliner for the new PM does not seem to be enabled at O0, but we still
-// get the same remarks with at least O1.
-// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -emit-llvm -mllvm -mandatory-inlining-first=false -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
-// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -Rno-everything -Reverything -emit-llvm -mllvm -mandatory-inlining-first=false -o -  2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -Rno-pass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -Rno-everything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -Rno-everything -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -Rno-everything -Reverything -emit-llvm -o -  2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 //
 // Check that -w doesn't disable remarks.
-// RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -w -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
-// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -w -emit-llvm -mllvm -mandatory-inlining-first=false -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -w -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass=inline -w -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 //
 // -Reverything implies -Rpass=.*.
-// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 //
 // -Rpass implies -Rpass=.*
-// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
+// RUN: %clang_cc1 %s -O1 -mllvm -mandatory-inlining-first=false -Rpass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
 
 // CHECK-REMARKS: remark:
 // CHECK-NO-REMARKS-NOT: remark:
@@ -55,7 +50,6 @@
 // twice.
 //
 int bar(int j) {
-// expected-remark at +3 {{'foz' not inlined into 'bar' because it should never be inlined (cost=never)}}
 // expected-remark at +2 {{'foz' not inlined into 'bar' because it should never be inlined (cost=never)}}
 // expected-remark at +1 {{'foo' inlined into 'bar'}}
   return foo(j, j - 2) * foz(j - 2, j);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110599.375437.patch
Type: text/x-patch
Size: 5452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210927/cf051740/attachment.bin>


More information about the cfe-commits mailing list