| For two join points to be duplicates they need to not only be alpha | equivalent but to also have the same continuation.
Yes exactly. And it would not be hard to adapt the existing CSE pass to support this. Just needs doing. A ticket and a repo case would be really helpful. Simon PS: I am leaving Microsoft at the end of November 2021, at which point simo...@microsoft.com will cease to work. Use simon.peytonjo...@gmail.com instead. (For now, it just forwards to simo...@microsoft.com.) | -----Original Message----- | From: ghc-devs <ghc-devs-boun...@haskell.org> On Behalf Of Viktor | Dukhovni | Sent: 24 November 2021 21:27 | To: ghc-devs@haskell.org | Subject: Re: [EXTERNAL] Unexpected duplicate join points in "Core" | output? | | On Sun, Nov 21, 2021 at 06:53:53AM -0500, Carter Schonwald wrote: | | > On Sat, Nov 20, 2021 at 4:17 PM Simon Peyton Jones via ghc-devs < | > ghc-devs@haskell.org> wrote: | > | > > There is absolutely no reason not to common-up those to join | points. | > > But we can't common up some join points when we could if they were | let's. | > > Consider | > > | > > join j1 x = x+1 | > > in case v of | > > A -> f (join j2 x = x+1 in ...j2...) | > > B -> ....j1... | > > C -> ....j1... | > > | > > Even though j2 is identical to j1's, we can't eliminate j2 in | favour | > > of j1 because then j1 wouldn't be a join point any more. | > | > In this example: why would it stop being a join point ? | > | > Admittedly, my intuition might be skewed by my own ideas about how | > join points are sortah a semantic special case of other constructs. | | I think the point is that join points are tail calls that don't return | to the caller. But here even though `j1` and `j2` have the same body | j1's continuation is not the same as j2's continuation. | | Rather the result of `j2` is the input to `f`, but the result of j1 is | a possible output of the whole `case` block in the B and C branches. | For two join points to be duplicates they need to not only be alpha | equivalent but to also have the same continuation. Something like | | join j1 x = x + 1 in | join j2 y = y + 1 in | ... j1 ... | ... j2 ... | | where eliminating j2 in favour of j1 should be correct. | | -- | VIktor. | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h | askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=04%7C01%7Csimonpj%40microsoft.com%7Cc5bef423b62e469b382d0 | 8d9af9156f4%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C63773386151737 | 6728%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTi | I6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=nWOBjpnIGGX2RbwIT%2BofdqfGJYq | xY%2FvKKExGB%2B2Vi3k%3D&reserved=0 _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs