public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/105638] New: Redundant stores aren't removed by DSE Date: Tue, 17 May 2022 23:29:05 +0000 [thread overview] Message-ID: <bug-105638-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105638 Bug ID: 105638 Summary: Redundant stores aren't removed by DSE Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com Target Milestone: --- For $ cat foo.cpp #include <stdint.h> #include <vector> #include <tr1/array> class FastBoard { public: typedef std::pair<int, int> movescore_t; typedef std::tr1::array<movescore_t, 24> scoredlist_t; protected: std::vector<int> m_critical; int m_boardsize; }; class FastState { public: FastBoard board; int movenum; protected: FastBoard::scoredlist_t scoredmoves; }; class KoState : public FastState { private: std::vector<uint64_t> ko_hash_history; std::vector<uint64_t> hash_history; }; class GameState : public KoState { public: void foo (); private: std::vector<KoState> game_history; }; void GameState::foo() { game_history.resize(movenum); } $ g++ -O2 -march=skylake foo.cpp -S generates: ... movl $280, %edx xorl %esi, %esi call memset movq %rax, %rcx vpxor %xmm0, %xmm0, %xmm0 addq $280, %rcx vmovdqu %xmm0, 36(%rax) vmovdqu %xmm0, 52(%rax) vmovdqu %xmm0, 68(%rax) vmovdqu %xmm0, 84(%rax) vmovdqu %xmm0, 100(%rax) vmovdqu %xmm0, 116(%rax) vmovdqu %xmm0, 132(%rax) vmovdqu %xmm0, 148(%rax) vmovdqu %xmm0, 164(%rax) vmovdqu %xmm0, 180(%rax) vmovdqu %xmm0, 196(%rax) vmovdqu %xmm0, 212(%rax) ... Here memset has cleared 280 bytes starting from RAX. There is no need to clear these bytes again. The optimized tree dump shows: <bb 14> [local count: 444773291]: # __cur_154 = PHI <__cur_42(14), _6(13)> # __n_155 = PHI <__n_41(14), __n_20(D)(13)> *__cur_154 = {}; MEM[(int * *)__cur_154] = 0B; MEM[(int * *)__cur_154 + 8B] = 0B; MEM[(int * *)__cur_154 + 16B] = 0B; MEM[(struct array *)__cur_154 + 36B]._M_instance = {}; MEM <vector(4) long unsigned int> [(long unsigned int * *)__cur_154 + 232B] = { 0, 0, 0, 0 }; MEM[(long unsigned int * *)__cur_154 + 264B] = 0B; MEM[(long unsigned int * *)__cur_154 + 272B] = 0B; Some of them are removed by RTL DSE. But vector stores aren't. Should SSA DSE remove them?
next reply other threads:[~2022-05-17 23:29 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-17 23:29 hjl.tools at gmail dot com [this message] 2022-05-18 12:42 ` [Bug middle-end/105638] " rguenth at gcc dot gnu.org 2022-06-01 21:23 ` cvs-commit at gcc dot gnu.org 2022-06-14 13:53 ` hjl.tools at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105638-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).