summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToLlvm/CodeGen.hs
diff options
context:
space:
mode:
authorSven Tennie <sven.tennie@gmail.com>2021-01-24 18:26:27 +0100
committerSven Tennie <sven.tennie@gmail.com>2021-01-24 18:26:27 +0100
commit6db2dd78a8488654ea7785621708496e24a6e92e (patch)
treea1d7108334ec1aa6eae8ca88776bdb5a534f7053 /compiler/GHC/CmmToLlvm/CodeGen.hs
parent773e2828fde4d8f640082b6bded9945e7b9584e3 (diff)
downloadhaskell-wip/llvm_musttail_experiment.tar.gz
LLVM: Use musttail instead of tailwip/llvm_musttail_experiment
This forces LLVM to handle tail calls as tail calls. Otherwise LLVM is free to ignore the tail and do an ordinary call. https://llvm.org/docs/LangRef.html#call-instruction
Diffstat (limited to 'compiler/GHC/CmmToLlvm/CodeGen.hs')
-rw-r--r--compiler/GHC/CmmToLlvm/CodeGen.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/GHC/CmmToLlvm/CodeGen.hs b/compiler/GHC/CmmToLlvm/CodeGen.hs
index 3ad52b6f79..13e46ae9d5 100644
--- a/compiler/GHC/CmmToLlvm/CodeGen.hs
+++ b/compiler/GHC/CmmToLlvm/CodeGen.hs
@@ -915,8 +915,7 @@ genJump (CmmLit (CmmLabel lbl)) live = do
(vf, stmts, top) <- getHsFunc live lbl
(stgRegs, stgStmts) <- funEpilogue live
let s1 = Expr $ Call TailCall vf stgRegs llvmStdFunAttrs
- let s2 = Return Nothing
- return (stmts `appOL` stgStmts `snocOL` s1 `snocOL` s2, top)
+ return (stmts `appOL` stgStmts `snocOL` s1, top)
-- Call to unknown function / address
@@ -935,9 +934,7 @@ genJump expr live = do
(v1, s1) <- doExpr (pLift fty) $ Cast cast vf (pLift fty)
(stgRegs, stgStmts) <- funEpilogue live
let s2 = Expr $ Call TailCall v1 stgRegs llvmStdFunAttrs
- let s3 = Return Nothing
- return (stmts `snocOL` s1 `appOL` stgStmts `snocOL` s2 `snocOL` s3,
- top)
+ return (stmts `snocOL` s1 `appOL` stgStmts `snocOL` s2, top)
-- | CmmAssign operation