#849: Offer control over branch prediction
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:  7.6.1           
   Component:  Compiler          |     Version:  6.4.2           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:  N/A             
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by nicolast):

 * cc: ikke+ghc@… (added)


Comment:

 When using the LLVM backend, this might be feasible using the
 "branch_weights" [1] metadata annotations. This way there's no need to do
 any reordering in the intermediate IR: the optimization steps do this
 based on these annotations (I checked using Clang with `__builtin_expect`,
 comparing the generated IR and the final assembly).

 This allows more granular weights than just "LIKELY" or "UNLIKELY".

 Would there be any interest if I'd look into adding such "BRANCH_WEIGHT
 (uint)" pragma? (Not sure I can pull it off though, not familiar with GHC
 internals (yet)).

 [1] http://llvm.org/docs/BranchWeightMetadata.html

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/849#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to