From d363c1fc28d8227b27b4506ebeb089845c5b0af6 Mon Sep 17 00:00:00 2001 From: "andy@galois.com" Date: Wed, 20 Jun 2007 06:49:43 +0000 Subject: [PATCH] Turning off case liberation when using the hpc option, for now Consider the following code f = g (case v of V a b -> a : t f) where g is expensive. Liberate case will turn this into f = g (case v of V a b -> a : t (letrec f = g (case v of V a b -> a : f t) in f) ) Yikes! We evaluate g twice. This leads to a O(2^n) explosion if g calls back to the same code recursively. This happen sometimes in HPC, because every tick is a liberate-able case, but is a general problem to case liberation (I think). --- compiler/main/DynFlags.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index c8615da..b3ee6fb 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -59,7 +59,7 @@ import PrelNames ( mAIN ) import StaticFlags ( opt_Static ) #endif import StaticFlags ( opt_PIC, WayName(..), v_Ways, v_Build_tag, - v_RTS_Build_tag ) + v_RTS_Build_tag, opt_Hpc ) import {-# SOURCE #-} Packages (PackageState) import DriverPhases ( Phase(..), phaseInputExt ) import Config @@ -677,6 +677,7 @@ getCoreToDo dflags cse = dopt Opt_CSE dflags spec_constr = dopt Opt_SpecConstr dflags liberate_case = dopt Opt_LiberateCase dflags + && not opt_Hpc rule_check = ruleCheck dflags core_todo = -- 1.7.10.4