public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114465] New: "x % const1 % const2" should be optimized if const1 % const2 == 0
@ 2024-03-25 12:34 xry111 at gcc dot gnu.org
  2024-03-25 12:34 ` [Bug tree-optimization/114465] " xry111 at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-03-25 12:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114465

            Bug ID: 114465
           Summary: "x % const1 % const2" should be optimized if const1 %
                    const2 == 0
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at gcc dot gnu.org
  Target Milestone: ---

int test(int x) { return x % 114514 % 1847; }

This should be optimized as-is

int test(int x) { return x % 1847; }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/114465] "x % const1 % const2" should be optimized if const1 % const2 == 0
  2024-03-25 12:34 [Bug tree-optimization/114465] New: "x % const1 % const2" should be optimized if const1 % const2 == 0 xry111 at gcc dot gnu.org
@ 2024-03-25 12:34 ` xry111 at gcc dot gnu.org
  2024-03-25 18:13 ` jsm28 at gcc dot gnu.org
  2024-03-25 18:52 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-03-25 12:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114465

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |missed-optimization

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/114465] "x % const1 % const2" should be optimized if const1 % const2 == 0
  2024-03-25 12:34 [Bug tree-optimization/114465] New: "x % const1 % const2" should be optimized if const1 % const2 == 0 xry111 at gcc dot gnu.org
  2024-03-25 12:34 ` [Bug tree-optimization/114465] " xry111 at gcc dot gnu.org
@ 2024-03-25 18:13 ` jsm28 at gcc dot gnu.org
  2024-03-25 18:52 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-03-25 18:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114465

--- Comment #1 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Note that transforming x % 1 % -1 to x % -1 wouldn't strictly be valid (because
of undefined behavior from INT_MIN % -1), though hopefully cases with constant
1 or -1 get optimized to 0 anyway and the undefined behavior is only a problem
with a -1 that's not a constant.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/114465] "x % const1 % const2" should be optimized if const1 % const2 == 0
  2024-03-25 12:34 [Bug tree-optimization/114465] New: "x % const1 % const2" should be optimized if const1 % const2 == 0 xry111 at gcc dot gnu.org
  2024-03-25 12:34 ` [Bug tree-optimization/114465] " xry111 at gcc dot gnu.org
  2024-03-25 18:13 ` jsm28 at gcc dot gnu.org
@ 2024-03-25 18:52 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-25 18:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114465

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-03-25
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-25 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25 12:34 [Bug tree-optimization/114465] New: "x % const1 % const2" should be optimized if const1 % const2 == 0 xry111 at gcc dot gnu.org
2024-03-25 12:34 ` [Bug tree-optimization/114465] " xry111 at gcc dot gnu.org
2024-03-25 18:13 ` jsm28 at gcc dot gnu.org
2024-03-25 18:52 ` pinskia at gcc dot gnu.org

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).