Re: [EXTERNAL] can GHC generate an irreducible control-flow graph? If so, how?

2021-11-22 Thread Sebastian Graf
An alternative would be to mark both functions as NOINLINE, which the Simplifier will adhere to. You might also want to have `countA` and `countB` close over a local variable in order for them not to be floated to the top-level. If top-level bindings aren't an issue for you, you could simply use

RE: [EXTERNAL] can GHC generate an irreducible control-flow graph? If so, how?

2021-11-22 Thread Simon Peyton Jones via ghc-devs
GHC breaks strongly connected components with a so-called loop-breaker. In this case, maybe countA is the loop-breaker; then countB can inline at all its call sites, and it'll look very reducible. See "Secrets of the GHC inliner". If you make countA and countB each call themselves, as well as

LINE pragma behaviour

2021-11-22 Thread Alan & Kim Zimmerman
I am working through some ghc-exactprint test cases with GHC 9.2.1 and came across an oddity. If I parse some source with {-# LINE 93 "Foo.chs" #-} on line five, it shows up in the ParseSource as (L (Anchor { LINE:5:1-25 } (UnchangedAnchor)) (EpaComment (EpaLineComment "{-#

can GHC generate an irreducible control-flow graph? If so, how?

2021-11-22 Thread Norman Ramsey
I'm trying to figure out how to persuade GHC to generate an irreducible control-flow graph (so I can test an algorithm to convert it to structured control flow). The attached image shows (on the left) the classic simple irreducible CFG: there is a loop between nodes A and B, but neither one

asking for an extra set of eyes on Cmm.Dataflow (Hoopl) change proposal

2021-11-22 Thread Norman Ramsey
At present, Cmm dataflow analysis works only on Cmm code. I'd like to do a dataflow analysis on native code. Details at https://gitlab.haskell.org/ghc/ghc/-/issues/20725 where I'd love an extra set of eyes from the Cmm/Dataflow/Hoopl crowd. Norman

SOLVED: how to map CLabel to Label for procedure entry point?

2021-11-22 Thread Norman Ramsey
> I'm struggling to figure out how to get from a CLabel found in a > CmmProc to a Label used to key the blocks in the control-flow graph > (CmmGraph) for the CmmProc. I figured it out---this is the wrong problem. I need to take the `g_entry` BlockId straight out of the CmmGraph. Norman

how to map CLabel to Label for procedure entry point?

2021-11-22 Thread Norman Ramsey
I'm struggling to figure out how to get from a CLabel found in a CmmProc to a Label used to key the blocks in the control-flow graph (CmmGraph) for the CmmProc. The code generator needs such a function, so it must be around somewhere, but I have not yet found it. I've poked around the