diff options
author | Norman Ramsey <nr@cs.tufts.edu> | 2021-11-23 14:45:52 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-07 17:34:51 -0500 |
commit | cc2bf8e9aa7237aa5d9c0bf6e839136774bd51bd (patch) | |
tree | 7844b3baea9abd8079db778d8ea88474a40cb080 /testsuite | |
parent | 483bd04d0d59b9b9cb26b81d181c4b72655e241b (diff) | |
download | haskell-cc2bf8e9aa7237aa5d9c0bf6e839136774bd51bd.tar.gz |
generalize GHC.Cmm.Dataflow to work over any node type
See #20725.
The commit includes source-code changes and a test case.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/cmm/should_compile/T20725.hs | 25 | ||||
-rw-r--r-- | testsuite/tests/cmm/should_compile/all.T | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/cmm/should_compile/T20725.hs b/testsuite/tests/cmm/should_compile/T20725.hs new file mode 100644 index 0000000000..f5f355a74e --- /dev/null +++ b/testsuite/tests/cmm/should_compile/T20725.hs @@ -0,0 +1,25 @@ +module T20725 where + +import GHC.Cmm +import GHC.Cmm.Dataflow +import GHC.Cmm.Dataflow.Block +import GHC.Cmm.Dataflow.Collections +import GHC.Cmm.Dataflow.Graph +import GHC.Cmm.Dataflow.Label + +data TrivialFact = TrivialFact + +trivialLattice :: DataflowLattice TrivialFact +trivialLattice = DataflowLattice TrivialFact (\_ _ -> NotChanged TrivialFact) + +-- | ensures that analysis is possible independent of node type +trivialMap :: forall node . + (NonLocal node) + => GenCmmGraph node + -> LabelMap TrivialFact +trivialMap g = + analyzeCmmFwd trivialLattice transfer g startFacts + where startFacts = mkFactBase trivialLattice [] + transfer block facts = + asBase [(successor, TrivialFact) | successor <- successors block] + where asBase = mkFactBase trivialLattice diff --git a/testsuite/tests/cmm/should_compile/all.T b/testsuite/tests/cmm/should_compile/all.T index 9fc5479634..40813f01ec 100644 --- a/testsuite/tests/cmm/should_compile/all.T +++ b/testsuite/tests/cmm/should_compile/all.T @@ -4,3 +4,4 @@ test('cmm_sink_sp', [ only_ways(['optasm']), grep_errmsg('(\[Sp.*\]).*(=).*(\[.* test('T16930', normal, makefile_test, ['T16930']) test('T17442', normal, compile, ['']) +test('T20725', normal, compile, ['-package ghc']) |