]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Prevent unrolling of main in LTO test [PR116683]
authorAlex Coplan <alex.coplan@arm.com>
Thu, 26 Sep 2024 15:36:48 +0000 (16:36 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Mon, 7 Oct 2024 09:39:06 +0000 (10:39 +0100)
In r15-3585-g9759f6299d9633cabac540e5c893341c708093ac I added a test which
started failing on PowerPC.  The test checks that we unroll exactly one loop
three times with the following:

// { dg-final { scan-ltrans-rtl-dump-times "Unrolled loop 3 times" 1 "loop2_unroll" } }

which passes on most targets.  However, on PowerPC, the loop in main
gets unrolled too, causing the scan-ltrans-rtl-dump-times check to fail
as the statement now appears twice in the dump.  I think the extra
unrolling is due to different unrolling heuristics in the rs6000 port.

This patch therefore explicitly tries to block the unrolling in main with an
appropriate #pragma.

gcc/testsuite/ChangeLog:

PR testsuite/116683
* g++.dg/ext/pragma-unroll-lambda-lto.C (main): Add #pragma to
prevent unrolling of the setup loop.

gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C

index ddf11730e338d95a3e362382605a7249bdde65ab..0db57c8d3a01985e1e76bb9f8a52613179060f19 100644 (file)
@@ -25,6 +25,7 @@ short *use_find(short *p)
 int main(void)
 {
   short a[1024];
+#pragma GCC unroll 0
   for (int i = 0; i < 1024; i++)
     a[i] = rand ();