diff options
author | Bartosz Nitka <niteria@gmail.com> | 2016-06-07 07:19:30 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2016-06-07 08:23:37 -0700 |
commit | 5db93d2e567ecb7169b06097244361327ec1eb2a (patch) | |
tree | 5032e35eaf6895baf9a0bf5f6a43fe7a21a9120a /compiler | |
parent | 3b698e8938ccfa3e0dbf192abf4984d6937a196e (diff) | |
download | haskell-5db93d2e567ecb7169b06097244361327ec1eb2a.tar.gz |
Make vectInfoParallelVars a DVarSet
We dump it in the interface file, so we need to do it in a
deterministic order. I haven't seen any problems with this
during my testing, but that's probably because it's unused.
Test Plan: ./validate
Reviewers: simonmar, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2313
GHC Trac Issues: #4012
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/iface/MkIface.hs | 2 | ||||
-rw-r--r-- | compiler/iface/TcIface.hs | 2 | ||||
-rw-r--r-- | compiler/main/HscTypes.hs | 6 | ||||
-rw-r--r-- | compiler/main/TidyPgm.hs | 11 | ||||
-rw-r--r-- | compiler/vectorise/Vectorise/Env.hs | 7 | ||||
-rw-r--r-- | compiler/vectorise/Vectorise/Exp.hs | 4 | ||||
-rw-r--r-- | compiler/vectorise/Vectorise/Monad.hs | 2 | ||||
-rw-r--r-- | compiler/vectorise/Vectorise/Monad/Global.hs | 2 |
8 files changed, 19 insertions, 17 deletions
diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 67bbd9505b..fcf63af369 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -327,7 +327,7 @@ mkIface_ hsc_env maybe_old_fingerprint { ifaceVectInfoVar = [Var.varName v | (v, _ ) <- varEnvElts vVar] , ifaceVectInfoTyCon = [tyConName t | (t, t_v) <- nameEnvElts vTyCon, t /= t_v] , ifaceVectInfoTyConReuse = [tyConName t | (t, t_v) <- nameEnvElts vTyCon, t == t_v] - , ifaceVectInfoParallelVars = [Var.varName v | v <- varSetElems vParallelVars] + , ifaceVectInfoParallelVars = [Var.varName v | v <- dVarSetElems vParallelVars] , ifaceVectInfoParallelTyCons = nameSetElemsStable vParallelTyCons } diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index 694bbd7c92..320594ca74 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -779,7 +779,7 @@ tcIfaceVectInfo mod typeEnv (IfaceVectInfo { vectInfoVar = mkVarEnv vVars `extendVarEnvList` concat vScSels , vectInfoTyCon = mkNameEnv vTyCons , vectInfoDataCon = mkNameEnv (concat vDataCons) - , vectInfoParallelVars = mkVarSet vParallelVars + , vectInfoParallelVars = mkDVarSet vParallelVars , vectInfoParallelTyCons = parallelTyConsSet } } diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index 79e5f694cf..a5eee7c5d8 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -2642,7 +2642,7 @@ data VectInfo { vectInfoVar :: VarEnv (Var , Var ) -- ^ @(f, f_v)@ keyed on @f@ , vectInfoTyCon :: NameEnv (TyCon , TyCon) -- ^ @(T, T_v)@ keyed on @T@ , vectInfoDataCon :: NameEnv (DataCon, DataCon) -- ^ @(C, C_v)@ keyed on @C@ - , vectInfoParallelVars :: VarSet -- ^ set of parallel variables + , vectInfoParallelVars :: DVarSet -- ^ set of parallel variables , vectInfoParallelTyCons :: NameSet -- ^ set of parallel type constructors } @@ -2673,14 +2673,14 @@ data IfaceVectInfo noVectInfo :: VectInfo noVectInfo - = VectInfo emptyVarEnv emptyNameEnv emptyNameEnv emptyVarSet emptyNameSet + = VectInfo emptyVarEnv emptyNameEnv emptyNameEnv emptyDVarSet emptyNameSet plusVectInfo :: VectInfo -> VectInfo -> VectInfo plusVectInfo vi1 vi2 = VectInfo (vectInfoVar vi1 `plusVarEnv` vectInfoVar vi2) (vectInfoTyCon vi1 `plusNameEnv` vectInfoTyCon vi2) (vectInfoDataCon vi1 `plusNameEnv` vectInfoDataCon vi2) - (vectInfoParallelVars vi1 `unionVarSet` vectInfoParallelVars vi2) + (vectInfoParallelVars vi1 `unionDVarSet` vectInfoParallelVars vi2) (vectInfoParallelTyCons vi1 `unionNameSet` vectInfoParallelTyCons vi2) concatVectInfo :: [VectInfo] -> VectInfo diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs index 401f939d44..daf3d00584 100644 --- a/compiler/main/TidyPgm.hs +++ b/compiler/main/TidyPgm.hs @@ -493,11 +493,12 @@ tidyVectInfo (_, var_env) info@(VectInfo { vectInfoVar = vars , isDataConWorkId var || not (isImplicitId var) ] - tidy_parallelVars = mkVarSet [ tidy_var - | var <- varSetElems parallelVars - , let tidy_var = lookup_var var - , isExternalId tidy_var && isExportedId tidy_var - ] + tidy_parallelVars = mkDVarSet + [ tidy_var + | var <- dVarSetElems parallelVars + , let tidy_var = lookup_var var + , isExternalId tidy_var && isExportedId tidy_var + ] lookup_var var = lookupWithDefaultVarEnv var_env var var diff --git a/compiler/vectorise/Vectorise/Env.hs b/compiler/vectorise/Vectorise/Env.hs index c3b0ee1b02..e4ab79eed7 100644 --- a/compiler/vectorise/Vectorise/Env.hs +++ b/compiler/vectorise/Vectorise/Env.hs @@ -30,6 +30,7 @@ import NameSet import Name import NameEnv import FastString +import UniqDFM import Data.Maybe @@ -86,7 +87,7 @@ data GlobalEnv -- ^Mapping from global variables to their vectorised versions — aka the /vectorisation -- map/. - , global_parallel_vars :: VarSet + , global_parallel_vars :: DVarSet -- ^The domain of 'global_vars'. -- -- This information is not redundant as it is impossible to extract the domain from a @@ -208,8 +209,8 @@ modVectInfo env mg_ids mg_tyCons vectDecls info { vectInfoVar = mk_env ids (global_vars env) , vectInfoTyCon = mk_env tyCons (global_tycons env) , vectInfoDataCon = mk_env dataCons (global_datacons env) - , vectInfoParallelVars = (global_parallel_vars env `minusVarSet` vectInfoParallelVars info) - `intersectVarSet` (mkVarSet ids) + , vectInfoParallelVars = (global_parallel_vars env `minusDVarSet` vectInfoParallelVars info) + `udfmIntersectUFM` (mkVarSet ids) , vectInfoParallelTyCons = global_parallel_tycons env `minusNameSet` vectInfoParallelTyCons info } where diff --git a/compiler/vectorise/Vectorise/Exp.hs b/compiler/vectorise/Vectorise/Exp.hs index 368d99a1e3..770adb77de 100644 --- a/compiler/vectorise/Vectorise/Exp.hs +++ b/compiler/vectorise/Vectorise/Exp.hs @@ -1039,13 +1039,13 @@ vectAvoidInfo :: VarSet -> CoreExprWithFVs -> VM CoreExprWithVectInfo vectAvoidInfo pvs ce@(_, AnnVar v) = do { gpvs <- globalParallelVars - ; vi <- if v `elemVarSet` pvs || v `elemVarSet` gpvs + ; vi <- if v `elemVarSet` pvs || v `elemDVarSet` gpvs then return VIParr else vectAvoidInfoTypeOf ce ; viTrace ce vi [] ; when (vi == VIParr) $ traceVt " reason:" $ if v `elemVarSet` pvs then text "local" else - if v `elemVarSet` gpvs then text "global" else text "parallel type" + if v `elemDVarSet` gpvs then text "global" else text "parallel type" ; return ((fvs, vi), AnnVar v) } diff --git a/compiler/vectorise/Vectorise/Monad.hs b/compiler/vectorise/Vectorise/Monad.hs index 4e7ee168b7..7c04dfe0b1 100644 --- a/compiler/vectorise/Vectorise/Monad.hs +++ b/compiler/vectorise/Vectorise/Monad.hs @@ -185,7 +185,7 @@ dumpVar dflags var addGlobalParallelVar :: Var -> VM () addGlobalParallelVar var = do { traceVt "addGlobalParallelVar" (ppr var) - ; updGEnv $ \env -> env{global_parallel_vars = extendVarSet (global_parallel_vars env) var} + ; updGEnv $ \env -> env{global_parallel_vars = extendDVarSet (global_parallel_vars env) var} } -- |Mark the given type constructor as parallel — i.e., its values might embed parallel arrays. diff --git a/compiler/vectorise/Vectorise/Monad/Global.hs b/compiler/vectorise/Vectorise/Monad/Global.hs index 0d3e0c0c91..cd642f37b6 100644 --- a/compiler/vectorise/Vectorise/Monad/Global.hs +++ b/compiler/vectorise/Vectorise/Monad/Global.hs @@ -135,7 +135,7 @@ lookupVectDecl var -- |Get the set of global parallel variables. -- -globalParallelVars :: VM VarSet +globalParallelVars :: VM DVarSet globalParallelVars = readGEnv global_parallel_vars -- |Get the set of all parallel type constructors (those that may embed parallelism) including both |