Skip to content

Commit

Permalink
Fix #2176.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Sep 9, 2024
1 parent fbe0be4 commit dd52518
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Constant folding for loops that produce floating point results could
result in different numerical behaviour.

* Compiler crash in memory short circuiting (#2176).

## [0.25.21]

### Added
Expand Down
13 changes: 9 additions & 4 deletions src/Futhark/Optimise/ArrayShortCircuiting/ArrayCoalescing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,28 @@ mkCoalsTabProg ::
ComputeScalarTableOnOp rep ->
Prog (Aliases rep) ->
m (M.Map Name CoalsTab)
mkCoalsTabProg (_, lutab_prog) r computeScalarOnOp =
fmap M.fromList . mapM onFun . progFuns
mkCoalsTabProg (_, lutab_prog) r computeScalarOnOp prog =
fmap M.fromList . mapM onFun . progFuns $ prog
where
consts_scope = scopeOf (progConsts prog)
onFun fun@(FunDef _ _ fname _ fpars body) = do
-- First compute last-use information
let unique_mems = getUniqueMemFParam fpars
lutab = lutab_prog M.! fname
scalar_table =
runReader
( concatMapM
(computeScalarTable $ scopeOf fun <> scopeOf (bodyStms body))
( computeScalarTable $
consts_scope
<> scopeOf fun
<> scopeOf (bodyStms body)
)
(stmsToList $ bodyStms body)
)
computeScalarOnOp
topenv =
emptyTopdownEnv
{ scope = scopeOfFParams fpars,
{ scope = consts_scope <> scopeOfFParams fpars,
alloc = unique_mems,
scalarTable = scalar_table,
nonNegatives = foldMap paramSizes fpars
Expand Down

0 comments on commit dd52518

Please sign in to comment.