[Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10

2020-08-22 Thread mattreecebentley at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mattreecebentley at gmail dot com Target Milestone: --- Created attachment 49102 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49102&action=edit Compiler outpu

[Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10

2020-08-24 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96750 --- Comment #4 from Matt Bentley --- (In reply to Marc Glisse from comment #2) > (In reply to Martin Liška from comment #1) > > after: > > 1794240.0 > > > > before: > > 1802710.0 > > That's less than 1% of difference (with "after" better than "

[Bug libstdc++/86471] New: GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-10 Thread mattreecebentley at gmail dot com
Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: mattreecebentley at gmail dot com Target Milestone: --- Test setup: Xubuntu 18, Core2Duo E8500 CPU, GCC 7.3 Results in release

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-10 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #2 from Matt Bentley --- (In reply to Andrew Pinski from comment #1) > Does -O3 bring the performance back? -O3 enables loop distrubtion which > should be able to detect these loops. Just tested - yes. However this is a fairly trivi

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-10 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #3 from Matt Bentley --- I thought I should note that there is also a missing optimization opportunity in the code. Clang optimizes the code I've listed to remove the benchmark loops entirely since it detects that the arrays aren't ac

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-12 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #5 from Matt Bentley --- What would be even more useful is a warning: for unused data.

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-12 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #6 from Matt Bentley --- Suggested patch for libstdc++, std_algobase.h, line 688: template inline typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type __fill_a(_ForwardIterator __first, _ForwardIterat

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-12 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #8 from Matt Bentley --- > This is incorrect for floating point types and non scalars. And it > introduces an extra check at runtime if value is not known to compile time. This is the overload for scalar types, read the function des

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-15 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #10 from Matt Bentley --- (In reply to Marc Glisse from comment #9) > (In reply to Andrew Pinski from comment #7) > We could also use __builtin_constant_p, if the function is inlined often > enough (don't know if it is). Right - so t

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-16 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #13 from Matt Bentley --- (In reply to Jonathan Wakely from comment #12) > Also you're doing a reinterpret_cast from an arbitrary iterator type, which > is not necessarily a pointer, or even a random access iterator. > > Since you do

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-16 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #14 from Matt Bentley --- (In reply to Matt Bentley from comment #13) > (In reply to Jonathan Wakely from comment #12) > > Also you're doing a reinterpret_cast from an arbitrary iterator type, which > > is not necessarily a pointer, o

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-16 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #16 from Matt Bentley --- (In reply to Jonathan Wakely from comment #15) > Look at how this exact problem is already solved elsewhere in the same file. > All the algorithms that dispatch to a __builtin_memxxx function use similar > t

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-17 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #19 from Matt Bentley --- (In reply to Jonathan Wakely from comment #18) > (In reply to Matt Bentley from comment #13) > > Well it's more that you're doing- at any rate, the issue you've noted is > > easily bypassed by changing the "r

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-17 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #20 from Matt Bentley --- (In reply to Matt Bentley from comment #19) > (In reply to Jonathan Wakely from comment #18) > > (In reply to Matt Bentley from comment #13) > > > Well it's more that you're doing- at any rate, the issue you'

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-19 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #22 from Matt Bentley --- (In reply to Jonathan Wakely from comment #21) > Surely static_cast is good enough, and doesn't rule out making the function > constexpr? It may well be, how does reinterpret_cast cause constexpr to fail, gi

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-19 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #23 from Matt Bentley --- > Actually, don't quote me on that - I may be thinking of the > 'reinterpret_cast<_Tp>(0)' - one of the two. Just to confirm, "reinterpret_cast(__first)" not required in this context, either "reinterpret_c

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-19 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #24 from Matt Bentley --- Ugh. I made a mistake. Clang only throws the warning when comparing NULL with 0 without reinterpret_cast/static_cast, not when comparing pointers in general.

[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays

2018-07-24 Thread mattreecebentley at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471 --- Comment #26 from Matt Bentley --- (In reply to Jonathan Wakely from comment #25) > What warning? Why can't you just pass 0 to __builtin_memset? It's a null > pointer constant. I don't see any warning from clang when using -Weverything. As c

[Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10

2020-09-27 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96750 --- Comment #5 from Matt Bentley --- If anyone out there is interested in working on this, I found the smallest change possible to create the same performance as GCC8- it is literally eliminating one branch possibility in one function (move-ins

[Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10

2020-09-27 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96750 --- Comment #6 from Matt Bentley --- Created attachment 49278 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49278&action=edit Demonstration of code which doesn't trigger the performance anomaly. plf_colony_fast.h does not trigger the prob

[Bug c++/100956] New: Unused variable warnings ignore "if constexpr" blocks where variables are conditionally used

2021-06-07 Thread mattreecebentley at gmail dot com via Gcc-bugs
NCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mattreecebentley at gmail dot com Target Milestone: --- For example, as part of a container class: void remove_memory_bloc

[Bug c++/100956] Unused variable warnings ignore "if constexpr" blocks where variables are conditionally used

2021-06-08 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100956 --- Comment #2 from Matt Bentley --- Thank you - I'm aware GCC might optimize it out (and failed to test with GCC10), at least in O2 mode, but other compilers might not, hence the code.

[Bug c++/117008] New: -march=native pessimization of 25% with bitset

2024-10-07 Thread mattreecebentley at gmail dot com via Gcc-bugs
: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mattreecebentley at gmail dot com Target Milestone: --- Created attachment 59292 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59292&action=edit ii file Overview: Found a sequence of code using bitset wher

[Bug target/117008] -march=native pessimization of 25% with bitset []

2024-10-08 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #11 from Matt Bentley --- Created attachment 59294 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59294&action=edit -v build output for -o2 only in second "if" variant As requested

[Bug target/117008] -march=native pessimization of 25% with bitset []

2024-10-08 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #9 from Matt Bentley --- (In reply to Jonathan Wakely from comment #7) > I'm certain it won't be, because (apart from vector) they access > memory locations that are at least one byte, not repeating very similar > bitwise ops for ev

[Bug target/117008] -march=native pessimization of 25% with bitset []

2024-10-08 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #10 from Matt Bentley --- Created attachment 59293 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59293&action=edit -v build output for -o2;-march=native for second "if" variant

[Bug c++/116931] False "duplicate 'const'" errors when typedefs used on pointer types in function definitions

2024-10-01 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116931 --- Comment #5 from Matt Bentley --- Nevermind, I realised my mistake.

[Bug target/117008] -march=native pessimization of 25% with bitset popcount

2024-10-07 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #4 from Matt Bentley --- Yeah, I know, I mentioned that in the report. It's not a bad benchmark, it's benchmarking access of individual consecutive bits, not summing. The counting is merely for preventing the compiler from optimizin

[Bug target/117008] -march=native pessimization of 25% with bitset popcount

2024-10-07 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #5 from Matt Bentley --- (In reply to Andrew Pinski from comment #1) > Can you provide the output of invoking g++ with -march=native and when > compiling? The .ii files were identical, so did you you mean .o files?

[Bug c++/116931] New: False "duplicate 'const'" errors when typedefs used on pointer types in function definitions

2024-10-01 Thread mattreecebentley at gmail dot com via Gcc-bugs
Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mattreecebentley at gmail dot com Target Milestone: --- Created attachment 59263 --> https://gcc.gnu.org/bugzilla/attachment.c

[Bug c++/116931] False "duplicate 'const'" errors when typedefs used on pointer types in function definitions

2024-10-01 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116931 --- Comment #2 from Matt Bentley --- Enlighten me here, how is this invalid C++ code? Because a typedef should mean that int_pointer is int *, so it should work, right? If it's invalid merely because it's typedef'd instead of verbatim, it's a l

[Bug c++/116931] False "duplicate 'const'" errors when typedefs used on pointer types in function definitions

2024-10-01 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116931 --- Comment #4 from Matt Bentley --- Okay, so that's a language defect, because const int * const isn't invalid, so neither should a typedef of the same.

[Bug target/117008] -march=native pessimization of 25% with bitset [] and 20% with bool array []

2024-10-15 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #13 from Matt Bentley --- Bool C-arrays also display the same problem, but only if a warm-up loop is present before the main loop (to 'warm up' the cache). I discovered this by accident the other day. char arrays and int arrays did n

[Bug target/117008] -march=native pessimization of 25% with bitset [] and 20% with bool array []

2024-10-15 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #14 from Matt Bentley --- Created attachment 59355 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59355&action=edit .ii file for vector code causing same issue

[Bug target/117008] -march=native pessimization of 25% with bitset [] and 20% with bool array []

2024-10-15 Thread mattreecebentley at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117008 --- Comment #15 from Matt Bentley --- Created attachment 59356 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59356&action=edit .ii file for bool[array] causing same issue