This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/88186] New: GCC Fails to optimize arithmetic progression


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

            Bug ID: 88186
           Summary: GCC Fails to optimize arithmetic progression
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: giuliano.belinassi at usp dot br
  Target Milestone: ---

Created attachment 45087
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45087&action=edit
Somewhat a test case.

GCC fails to optimize simple arithmetic progressions. See attached code.

gcc -Ofast -o induction induction_test.c

./induction 1
Sum is 0, elapsed time: 0
Sum is 0, elapsed time: 0

./induction 600000000
Sum is 179999999700000000, elapsed time: 203883
Sum is 179999999700000000, elapsed time: 0

It takes O(n), but the expected time would be O(1) after the optimization.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]