[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-17 Thread greg miller via Phabricator via cfe-commits
gregmiller added a comment.

The test patch worked and test is now passing again.  Thanks for the quick help 
on this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D109234#3004253 , @gregmiller 
wrote:

> Hello, 
> We are maintaining a downstream version of the monorepo based on the LLVM 
> main branch. We have not transitioned to the new PM yet. In a recent attempt 
> to merge the latest upstream commits into our monorepo we came across the 
> following test failures after your commit.

Sorry about that, it's my fault for asking Sherwin to remove the 
-fexperimental-new-pass-manager flag. I've created 
https://reviews.llvm.org/D109956


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-16 Thread greg miller via Phabricator via cfe-commits
gregmiller added a comment.

Hello, 
We are maintaining a downstream version of the monorepo based on the LLVM main 
branch. We have not transitioned to the new PM yet. In a recent attempt to 
merge the latest upstream commits into our monorepo we came across the 
following test failures after your commit.



FAIL: llvm_regressions :: Clang/CodeGen/pgo-sample-thinlto-summary.c


Script:
---

: 'RUN: at line 1';   
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/clang -cc1 
-internal-isystem 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/lib/clang/14.0.0/include
 -nostdsysteminc -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -emit-llvm -o - 2>&1 | 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/FileCheck 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -check-prefix=SAMPLEPGO-OLDPM
: 'RUN: at line 2';   
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/clang -cc1 
-internal-isystem 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/lib/clang/14.0.0/include
 -nostdsysteminc -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -emit-llvm -flto=thin -o - 2>&1 | 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/FileCheck 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -check-prefix=THINLTO-OLDPM
: 'RUN: at line 3';   
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/clang -cc1 
-internal-isystem 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/lib/clang/14.0.0/include
 -nostdsysteminc -fdebug-pass-manager -O2 
-fprofile-sample-use=/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -emit-llvm -o - 2>&1 | 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/FileCheck 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -check-prefix=SAMPLEPGO

: 'RUN: at line 4';   
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/clang -cc1 
-internal-isystem 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/lib/clang/14.0.0/include
 -nostdsysteminc -fdebug-pass-manager -O2 
-fprofile-sample-use=/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -emit-llvm -flto=thin -o - 2>&1 | 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/FileCheck 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -check-prefix=THINLTO
-

Exit Code: 1

Command Output (stderr):


+ : 'RUN: at line 1'
+ /scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/clang -cc1 
-internal-isystem 
/scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/lib/clang/14.0.0/include
 -nostdsysteminc -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -emit-llvm -o -
+ /scratch/gmiller/tools5/llvm_cgt/arm-llvm/RelWithAsserts/llvm/bin/FileCheck 
/scratch/gmiller/tools5/llvm_cgt/llvm-project/clang/test/CodeGen/pgo-sample-thinlto-summary.c
 -check-prefix=SAMPLEPGO-OLDPM
+ : 'RUN: at line 2'
+ 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-16 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG005fc11ebdd6: [PGO] Change ThinLTO test for targets with 
loop unrolling disabled (authored by Sherwin da Cruz 
59867245+sherwin...@users.noreply.github.com, committed by thopre).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,6 +11,27 @@
 g += baz(i);
 }
 
+// Checks that loop unroll and icp are invoked by normal compile, but not 
thinlto compile.
+
+// SAMPLEPGO:   Running pass: PGOIndirectCallPromotion on [module]
+// SAMPLEPGO:   Running pass: LoopUnrollPass on bar
+
+// SAMPLEPGO-OLDPM: PGOIndirectCallPromotion
+// SAMPLEPGO-OLDPM: Unroll loops
+// SAMPLEPGO-OLDPM: Unroll loops
+
+// THINLTO-NOT: Running pass: PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: Running pass: LoopUnrollPass on bar
+
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// The first Unroll loop pass is the createSimpleLoopUnrollPass that unrolls 
and peels
+// loops with small constant trip counts. The second one is skipped by ThinLTO.
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops
+
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
 // THINLTO-LABEL: define {{(dso_local )?}}void @bar
 // SAMPLEPGO-NOT: call{{.*}}foo
@@ -20,27 +39,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
-
-// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
-void unroll() {
-  for (int i = 0; i < 2; i++)
-baz(i);
-}
-
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
-void icp(void (*p)()) {
-  p();
-}
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-16 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc added a comment.

I dont have commit access, would someone be able to commit on my behalf? Thank 
You.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

lgtm, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc updated this revision to Diff 372749.
sherwin-dc added a comment.

- Modify test to correctly indicate old/new PM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,6 +11,27 @@
 g += baz(i);
 }
 
+// Checks that loop unroll and icp are invoked by normal compile, but not 
thinlto compile.
+
+// SAMPLEPGO:   Running pass: PGOIndirectCallPromotion on [module]
+// SAMPLEPGO:   Running pass: LoopUnrollPass on bar
+
+// SAMPLEPGO-OLDPM: PGOIndirectCallPromotion
+// SAMPLEPGO-OLDPM: Unroll loops
+// SAMPLEPGO-OLDPM: Unroll loops
+
+// THINLTO-NOT: Running pass: PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: Running pass: LoopUnrollPass on bar
+
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// The first Unroll loop pass is the createSimpleLoopUnrollPass that unrolls 
and peels
+// loops with small constant trip counts. The second one is skipped by ThinLTO.
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops
+
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
 // THINLTO-LABEL: define {{(dso_local )?}}void @bar
 // SAMPLEPGO-NOT: call{{.*}}foo
@@ -20,27 +39,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
-
-// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
-void unroll() {
-  for (int i = 0; i < 2; i++)
-baz(i);
-}
-
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
-void icp(void (*p)()) {
-  p();
-}
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:28
+// The first Unroll loop pass is the createSimpleLoopUnrollPass that unrolls 
and peels
+// loops with small constant trip counts. Only the second one is handled by 
ThinLTO.
+// THINLTO-OLDPM:   Unroll loops

Nit: The second one is skipped by the ThinLTO compile step (it's done in the 
ThinLTO backends).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc updated this revision to Diff 372720.
sherwin-dc added a comment.

- Modify test to correctly indicate old/new PM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,6 +11,27 @@
 g += baz(i);
 }
 
+// Checks that loop unroll and icp are invoked by normal compile, but not 
thinlto compile.
+
+// SAMPLEPGO:   Running pass: PGOIndirectCallPromotion on [module]
+// SAMPLEPGO:   Running pass: LoopUnrollPass on bar
+
+// SAMPLEPGO-OLDPM: PGOIndirectCallPromotion
+// SAMPLEPGO-OLDPM: Unroll loops
+// SAMPLEPGO-OLDPM: Unroll loops
+
+// THINLTO-NOT: Running pass: PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: Running pass: LoopUnrollPass on bar
+
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// The first Unroll loop pass is the createSimpleLoopUnrollPass that unrolls 
and peels
+// loops with small constant trip counts. Only the second one is handled by 
ThinLTO.
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops
+
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
 // THINLTO-LABEL: define {{(dso_local )?}}void @bar
 // SAMPLEPGO-NOT: call{{.*}}foo
@@ -20,27 +39,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
-
-// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
-void unroll() {
-  for (int i = 0; i < 2; i++)
-baz(i);
-}
-
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
-void icp(void (*p)()) {
-  p();
-}
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:3
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fexperimental-new-pass-manager -fdebug-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fexperimental-new-pass-manager -fdebug-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO

thopre wrote:
> While we now need to explicitely request the old pass manager, the new pass 
> manager is the default so we don't need to be explicit.
For the newPM, remove -mllvm -debug-pass=Structure since it isn't doing 
anything, and you are getting the printing from -fdebug-pass-manager. Also 
suggest moving the -fdebug-pass-manager into the position where you currently 
have  -mllvm -debug-pass=Structure so the printing options are in the 
equivalent place for both PM invocations.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:27
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops

sherwin-dc wrote:
> When printing out passes with the old PM 'Unroll loops' is printed out twice 
> with sample PGO and once with thin LTO.
I looked at the old PM, the first one is the createSimpleLoopUnrollPass that 
does some full unrolling and peeling of small constant trip count loops. Can 
you just add a comment above the check for the first Unroll loops here for 
ThinLTO to note this. It's the second invocation that we delay until the 
ThinLTO backends.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:3-4
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fexperimental-new-pass-manager -fdebug-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fexperimental-new-pass-manager -fdebug-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 

While we now need to explicitely request the old pass manager, the new pass 
manager is the default so we don't need to be explicit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:27
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops

When printing out passes with the old PM 'Unroll loops' is printed out twice 
with sample PGO and once with thin LTO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-15 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc updated this revision to Diff 372696.
sherwin-dc added a comment.

- Modify test to correctly indicate old/new PM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fexperimental-new-pass-manager -fdebug-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fexperimental-new-pass-manager -fdebug-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,6 +11,25 @@
 g += baz(i);
 }
 
+// Checks that loop unroll and icp are invoked by normal compile, but not 
thinlto compile.
+
+// SAMPLEPGO:   Running pass: PGOIndirectCallPromotion on [module]
+// SAMPLEPGO:   Running pass: LoopUnrollPass on bar
+
+// SAMPLEPGO-OLDPM: PGOIndirectCallPromotion
+// SAMPLEPGO-OLDPM: Unroll loops
+// SAMPLEPGO-OLDPM: Unroll loops
+
+// THINLTO-NOT: Running pass: PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: Running pass: LoopUnrollPass on bar
+
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops
+
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
 // THINLTO-LABEL: define {{(dso_local )?}}void @bar
 // SAMPLEPGO-NOT: call{{.*}}foo
@@ -20,27 +37,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
-
-// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
-void unroll() {
-  for (int i = 0; i < 2; i++)
-baz(i);
-}
-
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
-void icp(void (*p)()) {
-  p();
-}
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-14 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:1
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO

sherwin-dc wrote:
> tejohnson wrote:
> > -opt-bisect-limit seems like a roundabout way to get the pass invocations 
> > printed. How about just -mllvm -debug-pass=Structure?
> I had tried using `-mllvm -debug-pass=Structure` but could not get anything 
> to print out. It only worked when I removed `-cc1 -nostdsysteminc` and 
> `-emit-llvm` which is used when lit runs the tests.
I see - this doesn't work with the new PM which is now default. For that you 
can use -fdebug-pass-manager. For the old PM the -mllvm -debug-pass=Structure 
does work with -cc1 -emit-llvm. Since the first couple invocations appear meant 
to check the oldPM, I would add an explicit -fno-experimental-new-pass-manager 
to their invocations, since that is no longer the default. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-14 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc added a comment.

@tejohnson would you be able to take another look at this again


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-08 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc updated this revision to Diff 371315.
sherwin-dc added a comment.

- Consolidate test cases into one


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,6 +11,16 @@
 g += baz(i);
 }
 
+// Checks that loop unroll and icp are invoked by normal compile, but not 
thinlto compile.
+// SAMPLEPGO-LABEL: running pass ({{[0-9]+}}) {{[a-zA-Z0-9]+}} on
+// THINLTO-LABEL: running pass ({{[0-9]+}}) {{[a-zA-Z0-9]+}} on
+// SAMPLEPGO: running pass ({{[0-9]+}}) PGOIndirectCallPromotion on [module]
+// SAMPLEPGO: running pass ({{[0-9]+}}) LoopUnrollPass on bar
+// THINLTO-NOT: running pass ({{[0-9]+}}) PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: running pass ({{[0-9]+}}) LoopUnrollPass on bar
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
 // THINLTO-LABEL: define {{(dso_local )?}}void @bar
 // SAMPLEPGO-NOT: call{{.*}}foo
@@ -20,27 +28,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
-
-// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
-void unroll() {
-  for (int i = 0; i < 2; i++)
-baz(i);
-}
-
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
-void icp(void (*p)()) {
-  p();
-}
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-08 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc marked 2 inline comments as done.
sherwin-dc added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:1
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO

tejohnson wrote:
> -opt-bisect-limit seems like a roundabout way to get the pass invocations 
> printed. How about just -mllvm -debug-pass=Structure?
I had tried using `-mllvm -debug-pass=Structure` but could not get anything to 
print out. It only worked when I removed `-cc1 -nostdsysteminc` and 
`-emit-llvm` which is used when lit runs the tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-07 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:1
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO

-opt-bisect-limit seems like a roundabout way to get the pass invocations 
printed. How about just -mllvm -debug-pass=Structure?



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:16
 // Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
+// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
+// SAMPLEPGO-LABEL: running pass ({{[0-9]+}}) {{[a-zA-Z0-9]+}} on

Nit, consolidate this and the prior sentence.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:28
 
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
 void icp(void (*p)()) {
   p();

No need for 2 functions named "unroll" and "icp" anymore, since we are just 
checking the passes. Why not remove both of these, and just use bar below for 
checking the passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-07 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc updated this revision to Diff 371040.
sherwin-dc added a comment.

[PGO] Change tests to look at passes run


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,34 +11,31 @@
 g += baz(i);
 }
 
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
-// THINLTO-LABEL: define {{(dso_local )?}}void @bar
-// SAMPLEPGO-NOT: call{{.*}}foo
-// THINLTO: call{{.*}}foo
-void bar(int n) {
-  for (int i = 0; i < n; i++)
-foo(i);
-}
 
 // Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
+// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
+// SAMPLEPGO-LABEL: running pass ({{[0-9]+}}) {{[a-zA-Z0-9]+}} on
+// THINLTO-LABEL: running pass ({{[0-9]+}}) {{[a-zA-Z0-9]+}} on
+// SAMPLEPGO: running pass ({{[0-9]+}}) PGOIndirectCallPromotion on [module]
+// SAMPLEPGO: running pass ({{[0-9]+}}) LoopUnrollPass on unroll
+// THINLTO-NOT: running pass ({{[0-9]+}}) PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: running pass ({{[0-9]+}}) LoopUnrollPass on unroll
 void unroll() {
-  for (int i = 0; i < 2; i++)
+  for (int i = 0; i < 3; i++)
 baz(i);
 }
 
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
 void icp(void (*p)()) {
   p();
 }
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
+// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
+// THINLTO-LABEL: define {{(dso_local )?}}void @bar
+// SAMPLEPGO-NOT: call{{.*}}foo
+// THINLTO: call{{.*}}foo
+void bar(int n) {
+  for (int i = 0; i < n; i++)
+foo(i);
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-07 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc added a comment.

I have changed the unroll and icp tests to instead look at the passes that were 
run, which are shown with the `-mllvm -opt-bisect-limit=-1` flag. This should 
allow checking that the Loop Unrolling and Indirect Call Promotion passes are 
run with samplepgo but not thinlto.

To clarify, the backend that I am working on does not disable the Loop 
Unrolling pass from running, but uses target hooks within the pass to stop the 
loop from being unrolled, hence this would work for targets that would choose 
to disable loop unrolling in this way.

The bottom 2 tests are combined together now because of the way the passes are 
printed out. Though if there is a better way of arranging the tests please let 
me know. For reference this is what the output looks like:

F18895609: thinlto.txt 

F18895608: samplepgo.txt 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-07 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc updated this revision to Diff 371036.
sherwin-dc edited the summary of this revision.
sherwin-dc added a comment.

[PGO] Change tests to look at which passes were run


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -mllvm -opt-bisect-limit=-1 -O2 
-fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,34 +11,31 @@
 g += baz(i);
 }
 
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
-// THINLTO-LABEL: define {{(dso_local )?}}void @bar
-// SAMPLEPGO-NOT: call{{.*}}foo
-// THINLTO: call{{.*}}foo
-void bar(int n) {
-  for (int i = 0; i < n; i++)
-foo(i);
-}
 
 // Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
+// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
+// SAMPLEPGO-LABEL: running pass ({{[0-9]+}}) {{[a-zA-Z0-9]+}} on
+// THINLTO-LABEL: running pass ({{[0-9]+}}) {{[a-zA-Z0-9]+}} on
+// SAMPLEPGO: running pass ({{[0-9]+}}) PGOIndirectCallPromotion on [module]
+// SAMPLEPGO: running pass ({{[0-9]+}}) LoopUnrollPass on unroll
+// THINLTO-NOT: running pass ({{[0-9]+}}) PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: running pass ({{[0-9]+}}) LoopUnrollPass on unroll
 void unroll() {
-  for (int i = 0; i < 2; i++)
+  for (int i = 0; i < 3; i++)
 baz(i);
 }
 
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.false.orig_indirect
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.false.orig_indirect
 void icp(void (*p)()) {
   p();
 }
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
+// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
+// THINLTO-LABEL: define {{(dso_local )?}}void @bar
+// SAMPLEPGO-NOT: call{{.*}}foo
+// THINLTO: call{{.*}}foo
+void bar(int n) {
+  for (int i = 0; i < n; i++)
+foo(i);
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-03 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:25
 
 // Checks if loop unroll is invoked by normal compile, but not thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll

tejohnson wrote:
> It seems this test is explicitly checking for loop unrolling, so I'm not sure 
> if it will fundamentally work the same if loop unrolling is off. Do you know 
> why the below checking that "loop unroll is invoked by normal compile, but 
> not thinlto compile" is not failing due to your target's change?
> 
> I wonder if this test should be converted somehow to an LLVM test.
Thats a good question. I guess I was too focused on the failing test below.

In the above file `samplepgo_nounroll.ll` I had ran this test on just the x86 
backend without thinlto and with loop unrolling disabled in clang, but the loop 
still unrolled and the test passed. (Same story with the custom backend I am 
working on)

After changing the loop iterations from 2 to 3 then the test was failing which 
should have been the correct behavior with loop unrolling disabled. Not 100% 
sure on this but it looks as if a SimplifyCFG pass was unrolling the loop when 
it was 2 iterations, but not 3. So it looks like this needs to be changed if 
testing whether the loop-unroll pass was used.

Knowing this, I'm not sure what the next step would be. I dont know if any of 
the upstream backends had disabled loop unrolling, or how this could be tested 
in a target-independent way. (I'm quite new to LLVM)



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-03 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:25
 
 // Checks if loop unroll is invoked by normal compile, but not thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll

It seems this test is explicitly checking for loop unrolling, so I'm not sure 
if it will fundamentally work the same if loop unrolling is off. Do you know 
why the below checking that "loop unroll is invoked by normal compile, but not 
thinlto compile" is not failing due to your target's change?

I wonder if this test should be converted somehow to an LLVM test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109234

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