[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 Richard Biener changed: What|Removed |Added Target Milestone|10.3|10.4 --- Comment #14 from Richard Biener --- GCC 10.3 is being released, retargeting bugs to GCC 10.4.
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 --- Comment #13 from Tobias Schlüter --- I'm sorry to say that the problem is NOT fixed on the trunk. With "ARM64 gcc trunk" on the compiler explorer, we get the below. OTOH 9.3 produces perfect code. Compiler explorer link: https://godbolt.org/z/56h67rfc4 .LC0: .string "Eigen::internal::variable_if_dynamic::variable_if_dynamic(T) [with T = long int; int Value = 0]" .LC1: .string "/opt/compiler-explorer/libs/eigen/v3.3.9/Eigen/src/Core/util/XprHelper.h" .LC2: .string "v == T(Value)" .LC3: .string "Eigen::internal::variable_if_dynamic::variable_if_dynamic(T) [with T = long int; int Value = 3]" .LC4: .string "Eigen::internal::variable_if_dynamic::variable_if_dynamic(T) [with T = long int; int Value = 4]" .LC5: .string "Eigen::internal::variable_if_dynamic::variable_if_dynamic(T) [with T = long int; int Value = 1]" func34(m34): stp x29, x30, [sp, -128]! mov x1, 0 mov x29, sp stp x19, x20, [sp, 16] mov x20, x8 mov x19, x0 add x0, sp, 40 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] add x0, sp, 41 mov x1, 0 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] str x19, [sp, 48] add x0, sp, 56 mov x1, 3 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] add x0, sp, 57 mov x1, 4 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] add x0, sp, 58 mov x1, 0 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] add x0, sp, 59 mov x1, 0 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] str x19, [sp, 80] add x0, sp, 90 mov x1, 0 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] add x0, sp, 91 mov x1, 0 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] str x19, [sp, 112] add x0, sp, 120 mov x1, 1 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] add x0, sp, 121 mov x1, 4 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] str x20, [sp, 64] add x0, sp, 72 mov x1, 3 bl Eigen::internal::variable_if_dynamic::variable_if_dynamic(long) [complete object constructor] ldp s18, s16, [x19] mov x0, x20 ldp s4, s1, [x19, 8] ldp s17, s6, [x19, 16] fcvtd18, s18 ldp s3, s0, [x19, 24] fcvtd16, s16 ldp s7, s5, [x19, 32] fcvtd4, s4 ldr s2, [x19, 40] fcvtd1, s1 fcvtd17, s17 fcvtd6, s6 fcvtd3, s3 fcvtd7, s7 fcvtd5, s5 fcvtd2, s2 fcvtd0, s0 stp d18, d17, [x20] stp d7, d16, [x20, 16] stp d6, d5, [x20, 32] stp d4, d3, [x20, 48] stp d2, d1, [x20, 64] str d0, [x20, 80] ldr s0, [x19, 44] fcvtd0, s0 str d0, [x20, 88] ldp x19, x20, [sp, 16] ldp x29, x30, [sp], 128 ret _GLOBAL__sub_I_func34(m34): ret
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 --- Comment #12 from Tobias Schlüter --- Because I posted 32bit code before, here is what the trunk does with -m32 func34(m34): fld DWORD PTR [esp+8] mov eax, DWORD PTR [esp+4] fstpQWORD PTR [eax] fld DWORD PTR [esp+24] fstpQWORD PTR [eax+8] fld DWORD PTR [esp+40] fstpQWORD PTR [eax+16] fld DWORD PTR [esp+12] fstpQWORD PTR [eax+24] fld DWORD PTR [esp+28] fstpQWORD PTR [eax+32] fld DWORD PTR [esp+44] fstpQWORD PTR [eax+40] fld DWORD PTR [esp+16] fstpQWORD PTR [eax+48] fld DWORD PTR [esp+32] fstpQWORD PTR [eax+56] fld DWORD PTR [esp+48] fstpQWORD PTR [eax+64] fld DWORD PTR [esp+20] fstpQWORD PTR [eax+72] fld DWORD PTR [esp+36] fstpQWORD PTR [eax+80] fld DWORD PTR [esp+52] fstpQWORD PTR [eax+88] ret 4 This is the same as the assembly from 9.3 in Comment 4.
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 --- Comment #11 from Tobias Schlüter --- Works on trunk now but not 10.2. Compiler explorer link: https://godbolt.org/z/1zbh4YM4W On the trunk we get the following. I'm guessing that one could enhance the read pattern by using more registers, but without benchmarking I don't believe that this can be beat: func34(m34): pxorxmm0, xmm0 mov rax, rdi cvtss2sdxmm0, DWORD PTR [rsp+8] movsd QWORD PTR [rdi], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+24] movsd QWORD PTR [rdi+8], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+40] movsd QWORD PTR [rdi+16], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+12] movsd QWORD PTR [rdi+24], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+28] movsd QWORD PTR [rdi+32], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+44] movsd QWORD PTR [rdi+40], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+16] movsd QWORD PTR [rdi+48], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+32] movsd QWORD PTR [rdi+56], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+48] movsd QWORD PTR [rdi+64], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+20] movsd QWORD PTR [rdi+72], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+36] movsd QWORD PTR [rdi+80], xmm0 pxorxmm0, xmm0 cvtss2sdxmm0, DWORD PTR [rsp+52] movsd QWORD PTR [rdi+88], xmm0 ret Thanks to whoever did that. I see that a release candidate for 10.2.1 has been cut. I would assume that it's not fixed in 10.2.1 because there would be a bugfix mentioned here. My experience is clearly not representative and I can appreciate that there was no deluge of performance regression PRs, but I would think that Eigen is an important enough library that one should consider whether breaking it like this is really something that should survive several (sub-)releases.
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 --- Comment #10 from Jakub Jelinek --- Honza, could you please have a look?
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 Jakub Jelinek changed: What|Removed |Added CC||hubicka at gcc dot gnu.org, ||jakub at gcc dot gnu.org --- Comment #9 from Jakub Jelinek --- Bisection on #c8 shows r10-4944-g1e83bd7003e03160b7d71fb959111e89b53446ab
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 Richard Biener changed: What|Removed |Added Priority|P3 |P2
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 Tobias Schlüter changed: What|Removed |Added Attachment #48779|0 |1 is obsolete|| --- Comment #8 from Tobias Schlüter --- Created attachment 48927 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48927=edit Reduced testcase (32bit, preprocessed). I've further reduced the testcase down to 800Kb. Again this is with -m32. I removed the definition of void Eigen::internal::check_for_aliasing, so this will appear in the assembly, but it's a no-op. New version attached, compiler explorer version here https://godbolt.org/z/h6YMeq I've also reproduced the bug with 10.2
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 Richard Biener changed: What|Removed |Added Target Milestone|10.2|10.3 --- Comment #7 from Richard Biener --- GCC 10.2 is released, adjusting target milestone.
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 Richard Biener changed: What|Removed |Added Status|WAITING |NEW Known to work||9.3.0 Target Milestone|--- |10.2
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 --- Comment #6 from Tobias Schlüter --- Added the regression tag to the title.
[Bug ipa/95859] [10/11 regression] Statically true asserts not recognized as such with -O2, but with -O1, -Og, -O3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95859 Tobias Schlüter changed: What|Removed |Added Summary|Statically true asserts not |[10/11 regression] |recognized as such with |Statically true asserts not |-O2, but with -O1, -Og, -O3 |recognized as such with ||-O2, but with -O1, -Og, -O3 --- Comment #5 from Tobias Schlüter --- Added the regression tag to .