A simple case of HEAD producing worse code than 5.00.2

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
24 Jul 2001 19:20:06 GMT


module Test where
foo:: Int
foo = foldl (+) 0 [1,2,3]


ghc-5.00.2 produced the following STG code of the main loop:

Test.$wlgo =
    \r [ww w]
	case w of wild {
	  PrelBase.: x xs1 ->
	      case x of wild1 {
		PrelBase.I# y ->
		    case +# [ww y] of sat_sMV { DEFAULT -> Test.$wlgo sat_sMV xs1 };
	      };
	  PrelBase.[] -> PrelBase.I# [ww];
	};


HEAD produces the following:

Test.$wlgo =
    \r [w ww w1]
	case w1 of wild {
	  PrelBase.: x xs1 ->
	      case w of wild1 {
		PrelBase.I# x1 ->
		    case x of wild11 {
		      PrelBase.I# y ->
			  case +# [x1 y] of a {
			    DEFAULT ->
				let { sat_sWi = NO_CCS PrelBase.I#! [a];
				} in  Test.$wlgo sat_sWi a xs1
			  };
		    };
	      };
	  PrelBase.[] -> w;
	};

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK