[GHC] #9136: Constant folding in Core could be better

#9136: Constant folding in Core could be better ------------------------------+-------------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Runtime performance bug Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | ------------------------------+-------------------------------------------- Constant folding in Core is still a bit feeble. For example, when staring at the code for `nofib/shootout/k-nucleotide` I saw this expression: {{{ (x +# 8) -# 1 }}} which would be relatively easy to optimise. The difficulty is knowing where to stop. What about `(8 +# x) -# 1`? Anyway, this ticket is to record the issue. Currently constant folding is done by the built-in RULES in `compiler/prelude/PrelRules`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata): That reminded me of something, so I filed #9137. If we had that we could specify create RULES like {{{ forall x y z. (isLiteral y, isLiteral z) => (x +# y) -# z = x +# (y -# z) forall x y z. (isLiteral y, isLiteral z) => (x -# y) -# z = x -# (y +# z) ... }}} that would rewrite the terms to have the literals next to each other. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by simonpj): You could do that in `PrelRules` too. Yes, being able to do it in source code would be cool, but it all requires more syntax, a story about what predicates are allowed, etc etc, and it is far from obvious where to stop. The advantage of `PrelRules` is that you can do anything! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by schyler): I'd be against the thought of this kind of optimization being a rewrite rule. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata): Care to explain? `(x +# y) -# z = x +# (y -# z)` looks very much like rewriting to me, and rewrite rules are a powerful mechanism for that. And if we were able to specify that declaratively in source code, instead of letting the compiler grow and grow, even better, I’d say. Also note that constant folding is also done with (built-in, more powerful) RULES already. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata):
The difficulty is knowing where to stop. What about `(8 +# x) -# 1`?
Surely there must be standard solutions in (non-functional) compilers. I asked the compiler guys next door and they pointed me to Muchnick’s Advanced Compiler Design & Implementation, where Fig 12.6 lists 20 transformation rules which should move constants in an expression involving `+`, `-` and `*` together and combine the constants. [http://stackoverflow.com/questions/23827531/reassociation-according-to- muchnick I don’t understand them yet], but something along these lines would work well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Changes (by nomeata): * owner: => nomeata Comment: I couldn’t resist to get started on this, so branch `wip/T9136` contains a test case ([changeset:d4081919/ghc]) and a first implementation for `+` ([changeset:115fd8b043/ghc]). Not polished and complete yet, and not yet validated, but it goes in the right direction I think. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata): Ok, implemented also for `Word`. The code does a transformation from `x -# (Lit n)` to `x +# (Lit -n)` and then only works on tress of additions. I didn’t do that for `Word` yet, because `foo +# 4294967295` is not very readable in Core. Should I? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by carter): One concern if have off hand: couldn't this sort of optimization change how a program under/overflows? I can't think of an example off hand, but could that happen? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata): As long as you do it on types that wrap around (like `Int#` and `Word#`) or are unbounded (`Integer`): No, I don’t think so. Also, if there are any issues, I assume they would already be present in the existing constant folding code. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata): Refactored the code; no more transformation `x -# (Lit n)` to `x +# (Lit -n)` unless it is required to combine some literals. This yields prettier Core and this way it validates without having to update test result core output. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Changes (by nomeata): * status: new => patch Comment: Nofib shows that this optimization yields no measurable gain – most likely because later stages (maybe gcc) perform them anyways. So do we still want it, for the sake of pleasing Core, and maybe for the benefit of other backends like GHCJS? If yes, this can go in, so marking this as ready for review. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by carter): @nomeata .... so I thought a bit about your reply... and part of my concern stems from the fact that the wrapping behavior of Int in GHC is actually a choice of "undefined" behavior by the various Haskell language standards. Point being, while wrap around is "folklore behavior", its actually deemed undefined by the standard. And it constitutes moving that undefined "folklore" into being a strong assumption in ghc. how would GCC come into play? theres no peephole optimization by the system assembler level in -fasm to my knowledge. most of the examples i've seen where arithmetic optimization makes a HUGE win are in the context of heavy bit fiddling sequences (I have some example that are 40 instructions long in -fasm, but optimized to NOOP on -fllvm), and various sophisticated array indexing computations. If nofib doesn't show a measurable difference and theres no motivating example program that shows a strong win.. I'd argue its not worth adding the rules. I'm happy to share some more interesting examples, but I'm not sure if they actually can be handled by a rewrite rules discipline. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata): If you have examples where such constant folding can be a win I’d of course be interested. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by nomeata): @SPJ: Since you opened the ticket I guess it’s your call whether you think this is worth it, even if nofib shows no measurable improvement. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by skeuchel): I would like to further work on this, i.e. add multiplication. Is there still interest in having this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better --------------------------------------------+------------------------------ Reporter: simonpj | Owner: nomeata Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime performance bug | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by simonpj): I had a look and the patch seemed broadly OK, through rather under- commented. Notably the parameters to the key function, whose name I now forget, and a user-readable version of the rewrite that each block of code performs. Care is needed to be sure that the rewrites really are semantics preserving, given that overflow may happen. It's probably ok because the types involved do wrap-around, but that very point needs a careful `Note` in the code. By all means extend it further, but please do document it well. One thing to bear in mind is that these rewrite rules are tried for every single expression `(op a b)`, where `op` is (say) `Int#` addition, and every single iteration of the simplifier. So it needs to fail fast if it ends up doing nothing. An alternative would be an entirely separate pass, which can then be as expensive as you like. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: nomeata Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: patch => infoneeded Comment: @Joachim: is this patchset still in limbo? If there's no measurable performance impact, but it improves code and doesn't hurt performance, I don't see why you cannot merge it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

@Joachim: is this patchset still in limbo? If there's no measurable
#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: nomeata Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by nomeata): performance impact, but it improves code and doesn't hurt performance, I don't see why you cannot merge it. Compiler code complexity would be one reason to not merge it. Other than that I mostly forgot about this... and so I’m not sure about the completeness of my work (and it needs more comments, as always). I’ll eventually return to it, but without high priority. Just leave it assigned to me. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: nomeata Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): I too am concerned about code complexity that does not buy performance; and also on the effect on compile time. That's not "no", just caution. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by nomeata): * owner: nomeata => Comment: Given the general doubt about these changes, I’ll unassign this ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by akio): * cc: akio (added) Comment: I just came across the core output `((1 +# ((x -# 1) +# 1)) +# 1) +# 1` from some array indexing code, and thought that this kind of constant folding would be nice. However I don't have a standalone benchmark (yet) and consequently I don't know how much speed improvement could be achieved by the optimization. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by maoe): * cc: maoe (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2858 Wiki Page: | -------------------------------------+------------------------------------- Changes (by hsyl20): * differential: => Phab:D2858 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: infoneeded
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2858
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2858 Wiki Page: | -------------------------------------+------------------------------------- Comment (by klapaucius): reverted in https://github.com/ghc/ghc/commit/0e37361392a910ccbbb2719168f4e8d8272b2ae2 but still remains in the 8.6 release notes https://github.com/ghc/ghc/commit/09128f3a3d754abcef63480bc7e2e901d30b155a -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2858 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: infoneeded => patch * milestone: => 8.6.1 Comment: Oh dear, yes, excellent point; I dropped the ball on this. I'll re-merge for 8.6. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2858
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2858 Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Merged for 8.6. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2858 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:29 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2858 Wiki Page: | -------------------------------------+------------------------------------- Comment (by spacekitteh): Do these rules fire for floating point operations? Because they are neither associative nor distributive. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:30 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9136: Constant folding in Core could be better -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2858 Wiki Page: | -------------------------------------+------------------------------------- Comment (by hsyl20): Replying to [comment:30 spacekitteh]:
Do these rules fire for floating point operations? Because they are neither associative nor distributive.
No, only for Int# and Word#. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9136#comment:31 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC