id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
1179	20x slow down with -O or -O2	dons		"This program:

{{{
http://www.cse.unsw.edu.au/~dons/code/nobench/spectral/calendar/
}}}

Suffers a misoptimisation when compiled with -O or -O2.
When compiled with -Onot:

{{{
serenity$ ghc -Onot --make -o calendar calendar.hs -no-recomp
[1 of 1] Compiling Main             ( calendar.hs, calendar.o )
Linking calendar ...

serenity$ time ./calendar 1993 10000 > /dev/null
./calendar 1993 10000 > /dev/null  0.02s user 0.00s system 99% cpu 0.021 total
}}}

When compiled with -O:

{{{
serenity$ ghc -O --make -o calendar calendar.hs -no-recomp
[1 of 1] Compiling Main             ( calendar.hs, calendar.o )
Linking calendar ...

serenity$ time ./calendar 1993 10000 > /dev/null
./calendar 1993 10000 > /dev/null  5.00s user 0.01s system 99% cpu 5.011 total
}}}

And with -O2:

{{{
serenity$ time ./calendar 1993 10000 > /dev/null
./calendar 1993 10000 > /dev/null  4.95s user 0.01s system 100% cpu 4.953 total
}}}

Reproduced in amd64 and x86 linux."	bug	closed	normal		Compiler	6.6	duplicate	slow		Linux	Unknown/Multiple		Unknown				
