This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/88186] New: GCC Fails to optimize arithmetic progression
- From: "giuliano.belinassi at usp dot br" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 24 Nov 2018 19:38:06 +0000
- Subject: [Bug tree-optimization/88186] New: GCC Fails to optimize arithmetic progression
- Auto-submitted: auto-generated
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.