[commit: ghc] master: LLVM generate llvm.expect for conditional branches (20fb781)
git at git.haskell.org
git at git.haskell.org
Thu Nov 17 16:04:22 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/20fb781ed1825578c5428ff4ae408be034c6a1d8/ghc
>---------------------------------------------------------------
commit 20fb781ed1825578c5428ff4ae408be034c6a1d8
Author: Alex Biehl <alexbiehl at gmail.com>
Date: Wed Nov 16 18:16:39 2016 -0500
LLVM generate llvm.expect for conditional branches
This patch adds likeliness annotations to heap and and stack checks and
modifies the llvm codegen to recognize those to help it generate better
code.
So with this patch
```
...
if ((Sp + 8) - 24 < SpLim) (likely: False) goto c23c; else goto c23d;
...
```
roughly generates:
```
%ln23k = icmp ult i64 %ln23j, %SpLim_Arg
%ln23m = call ccc i1 (i1, i1) @llvm.expect.i1( i1 %ln23k, i1 0 )
br i1 %ln23m, label %c23c, label %c23d
```
Note the call to `llvm.expect` which denotes the expected result for
the comparison.
Test Plan: Look at assembler code with and without this patch. If the
heap-checks moved out of the way we are happy.
Reviewers: austin, simonmar, bgamari
Reviewed By: bgamari
Subscribers: michalt, thomie
Differential Revision: https://phabricator.haskell.org/D2688
GHC Trac Issues: #8321
>---------------------------------------------------------------
20fb781ed1825578c5428ff4ae408be034c6a1d8
compiler/cmm/CmmContFlowOpt.hs | 15 ++++++++-----
compiler/codeGen/StgCmmHeap.hs | 7 +++---
compiler/codeGen/StgCmmMonad.hs | 40 +++++++++++++++++++++++++--------
compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 35 +++++++++++++++++++++++------
4 files changed, 73 insertions(+), 24 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 20fb781ed1825578c5428ff4ae408be034c6a1d8
More information about the ghc-commits
mailing list