Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,332
    • Issues 4,332
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 363
    • Merge Requests 363
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16333

Closed
Open
Opened Feb 17, 2019 by Andreas Klebinger@AndreasKDeveloper

Implement Loop-invariant code motion / Hoisting for Cmm

Currently we don't but we should.

An example from nofib:

This is the innermost loop of fannkuch-redux.

       ca12:
           _s9D0::I64 = %MO_UU_Conv_W8_W64(I8[_s9zN::I64]);
           if (_s9D0::I64 != 0) goto ca1f; else goto ca1i;
       ca1f:
           I64[Sp - 16] = ca1d;
           R3 = _s9zN::I64 + _s9D0::I64;
           R2 = _s9zN::I64;
           I64[Sp - 8] = _s9CV::I64;
           I64[Sp] = _s9Cd::I64;
           I64[Sp + 40] = _s9Cc::I64;
           I64[Sp + 48] = _s9Cb::I64;
           I64[Sp + 56] = _s9zN::I64;
           Sp = Sp - 16;
           call $wflopp_r9x0_info(R3,
                                  R2) returns to ca1d, args: 8, res: 8, upd: 8;
       ca1d:
           Sp = Sp + 16;
           _s9CV::I64 = I64[Sp - 8] + 1;
           _s9Cd::I64 = I64[Sp + 0]; 16
           _s9z5::I64 = I64[Sp + 8]; //24
           _s9zv::I64 = I64[Sp + 16]; 32
           _s9zx::I64 = I64[Sp + 24]; 40
           _s9zz::I64 = I64[Sp + 32]; 48
           _s9Cc::I64 = I64[Sp + 40]; 56
           _s9Cb::I64 = I64[Sp + 48]; 64
           _s9zN::I64 = I64[Sp + 56]; 72

           goto ca12;

We should try to move the loads NOT used in the loop out of the loop at least.

Trac metadata
Trac field Value
Version 8.6.3
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#16333