Bug 113539 - [14 Regression] perlbench miscompiled on aarch64 since r14-8223-g1c1853a70f
Summary: [14 Regression] perlbench miscompiled on aarch64 since r14-8223-g1c1853a70f
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 14.0
: P1 normal
Target Milestone: 14.0
Assignee: Tamar Christina
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2024-01-22 10:37 UTC by Alex Coplan
Modified: 2024-02-05 21:12 UTC (History)
7 users (show)

See Also:
Host:
Target: aarch64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-01-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Coplan 2024-01-22 10:37:16 UTC
I'm seeing miscompares of perlbench (both from SPEC CPU 2006 and SPEC CPU 2017) on aarch64 with recent trunk changes, a bisect pointed to r14-8223-g1c1853a70f9422169190e65e568dcccbce02d95c :

commit 1c1853a70f9422169190e65e568dcccbce02d95c
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 18 10:22:34 2024

    Fix memory leak in vect_analyze_loop_form

The miscompares are with the checkspam.pl workload, I see:

*** Miscompare of checkspam.2500.5.25.11.150.1.1.1.1.out

I've seen this with:

-flto=auto -fomit-frame-pointer -O3 -fno-strict-aliasing

and various -mcpu options (at least -mcpu=cortex-a72 and -mcpu=neoverse-v1).
Comment 1 Tamar Christina 2024-01-22 10:49:20 UTC
If that's the commit that's miscomparing then it's probably a bug in early-break vect.

So I'll take a look.

+         if ((integer_zerop (may_be_zero)
+              || integer_nonzerop (may_be_zero)

is odd though, isn't that basically accepting all values of may_be_zero?
Comment 2 Richard Biener 2024-01-22 10:54:15 UTC
It accepts all constant known may_be_zero - we can handle all of those later.

I suspect this just triggers a latent issue (vectorizing now simply using
a different exit as canonical in one case).
Comment 3 Tamar Christina 2024-01-22 10:56:49 UTC
(In reply to Richard Biener from comment #2)
> It accepts all constant known may_be_zero - we can handle all of those later.
> 
> I suspect this just triggers a latent issue (vectorizing now simply using
> a different exit as canonical in one case).

Indeed, I'll take a look.
Comment 4 Alex Coplan 2024-01-22 11:03:51 UTC
Reproduces with just -O3 -fno-strict-aliasing FWIW, no LTO or -mcpu needed.
Comment 5 Hongtao Liu 2024-01-24 05:04:39 UTC
502.gcc_r hangs after  r14-8223-g1c1853a70f9422169190e65e568dcccbce02d95cwhen compiled with -O3 -march=sapphirerapids or -O3 -march=znver4 -mprefer-vector-width=128(or 256). Not sure if they're the same issue.
Comment 6 Filip Kastl 2024-01-24 14:08:38 UTC
I just reproduced the same issue on an x86_64 zen3 machine. Running both 500.perlbench_r and 400.perlbench with options -Ofast -march=native -mtune=native -g -flto=32 results in

*** Miscompare of checkspam.2500.5.25.11.150.1.1.1.1.out

That means this is probably not only an aarch64 issue.
Comment 7 Filip Kastl 2024-01-24 14:10:28 UTC
I just reproduced the same issue on an x86_64 zen3 machine. Running both 500.perlbench_r and 400.perlbench with options -Ofast -march=native -mtune=native -g -flto=32 results in

*** Miscompare of checkspam.2500.5.25.11.150.1.1.1.1.out

That means this is probably not only an aarch64 issue.
Comment 8 Richard Biener 2024-01-26 13:29:28 UTC
Does this still happen after r14-8413-g578c7b91f418eb?
Comment 9 Filip Kastl 2024-01-26 14:09:16 UTC
(In reply to Richard Biener from comment #8)
> Does this still happen after r14-8413-g578c7b91f418eb?

I think it doesn't happen anymore.

I can confirm that both on aarch64 and zen3, both the SPEC2006 and SPEC2017, with -Ofast -march=native -mtune=native -flto perlbench compiles correctly now.
Comment 10 Jakub Jelinek 2024-02-05 20:56:11 UTC
So can we close this then?
Comment 11 Tamar Christina 2024-02-05 21:12:12 UTC
oh forgot about this one, yes it's fixed now.  Nightlies are clean.