summaryrefslogtreecommitdiff
path: root/compiler/simplStg
diff options
context:
space:
mode:
authorAlex Biehl <alexbiehl@gmail.com>2016-11-16 18:16:39 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-17 11:04:02 -0500
commit20fb781ed1825578c5428ff4ae408be034c6a1d8 (patch)
tree998a0d24f5ea9c1d196e0c431f37d879f9db1f2a /compiler/simplStg
parent9a4983dab9893f616db1c9be551ff9112084f887 (diff)
downloadhaskell-20fb781ed1825578c5428ff4ae408be034c6a1d8.tar.gz
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
Diffstat (limited to 'compiler/simplStg')
0 files changed, 0 insertions, 0 deletions