Opened 9 months ago

Last modified 9 months ago

#16064 new task

Improving Placement of Heap Checks - Avoiding Slowdowns in Hot Code

Reported by: _recursion Owned by: _recursion
Priority: normal Milestone: 8.9
Component: Compiler Version:
Keywords: CodeGen, Performance Cc: simonpj, sgraf
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: #16040, #14791, #8326, #12231, #1498 Differential Rev(s):
Wiki Page:


When generating both heap and stack checks in Cmm, GHC can sometimes be fairly obtuse about their placement. As a result, they can be generated for paths in hot code that actually do not perform any allocation. Examples can be found in the related tickets, particularly #14791 and #16040.

This ticket exists to track the work proposed by Simon to detect such code patterns. They are described as follows:

  1. A primitive case with no allocation upstream from it.
  2. One alternative that performs no allocation.

Under such circumstances the stack/heap checks can be moved from being performed on every iteration to being performed just prior to the allocation itself.

Change History (2)

comment:1 Changed 9 months ago by _recursion

Owner: set to _recursion

comment:2 Changed 9 months ago by sgraf

Cc: sgraf added
Note: See TracTickets for help on using tickets.