[commit: ghc] master: Fix LLVM TBAA metadata (90fae01)
git at git.haskell.org
git at git.haskell.org
Fri Dec 9 22:04:05 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/90fae01c326bf8b0802b4e8968f84886be4e1380/ghc
>---------------------------------------------------------------
commit 90fae01c326bf8b0802b4e8968f84886be4e1380
Author: Demi Obenour <demiobenour at gmail.com>
Date: Fri Dec 9 15:41:59 2016 -0500
Fix LLVM TBAA metadata
Accesses through a Cmm local are currently reported as having the
"other" type, which can only alias other "other" accesses. However,
this assumption is incorrect, which can result in silent bad LLVM
codegen.
Fixes #9308.
Fixes #9504.
Test Plan: GHC CI
Reviewers: rwbarton, austin, bgamari
Reviewed By: bgamari
Subscribers: michalt, thomie
Differential Revision: https://phabricator.haskell.org/D2758
GHC Trac Issues: #9125, #9308, #9504
>---------------------------------------------------------------
90fae01c326bf8b0802b4e8968f84886be4e1380
compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 6 ++----
compiler/llvmGen/LlvmCodeGen/Regs.hs | 14 ++++++--------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index 7b610c0..d88d234 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -845,8 +845,7 @@ genStore addr@(CmmMachOp (MO_Sub _) [
-- generic case
genStore addr val
- = do other <- getTBAAMeta otherN
- genStore_slow addr val other
+ = getTBAAMeta topN >>= genStore_slow addr val
-- | CmmStore operation
-- This is a special case for storing to a global register pointer
@@ -1494,8 +1493,7 @@ genLoad atomic e@(CmmMachOp (MO_Sub _) [
-- generic case
genLoad atomic e ty
- = do other <- getTBAAMeta otherN
- genLoad_slow atomic e ty other
+ = getTBAAMeta topN >>= genLoad_slow atomic e ty
-- | Handle CmmLoad expression.
-- This is a special case for loading from a global register pointer
diff --git a/compiler/llvmGen/LlvmCodeGen/Regs.hs b/compiler/llvmGen/LlvmCodeGen/Regs.hs
index 8ac4153..1ee9fc1 100644
--- a/compiler/llvmGen/LlvmCodeGen/Regs.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Regs.hs
@@ -6,7 +6,7 @@
module LlvmCodeGen.Regs (
lmGlobalRegArg, lmGlobalRegVar, alwaysLive,
- stgTBAA, baseN, stackN, heapN, rxN, otherN, tbaa, getTBAA
+ stgTBAA, baseN, stackN, heapN, rxN, topN, tbaa, getTBAA
) where
#include "HsVersions.h"
@@ -102,21 +102,19 @@ stgTBAA
, (heapN, fsLit "heap", Just topN)
, (rxN, fsLit "rx", Just heapN)
, (baseN, fsLit "base", Just topN)
- -- FIX: Not 100% sure about 'others' place. Might need to be under 'heap'.
- -- OR I think the big thing is Sp is never aliased, so might want
- -- to change the hieracy to have Sp on its own branch that is never
- -- aliased (e.g never use top as a TBAA node).
- , (otherN, fsLit "other", Just topN)
+ -- FIX: Not 100% sure if this heirarchy is complete. I think the big thing
+ -- is Sp is never aliased, so might want to change the hierarchy to have Sp
+ -- on its own branch that is never aliased (e.g never use top as a TBAA
+ -- node).
]
-- | Id values
-topN, stackN, heapN, rxN, baseN, otherN :: Unique
+topN, stackN, heapN, rxN, baseN :: Unique
topN = getUnique (fsLit "LlvmCodeGen.Regs.topN")
stackN = getUnique (fsLit "LlvmCodeGen.Regs.stackN")
heapN = getUnique (fsLit "LlvmCodeGen.Regs.heapN")
rxN = getUnique (fsLit "LlvmCodeGen.Regs.rxN")
baseN = getUnique (fsLit "LlvmCodeGen.Regs.baseN")
-otherN = getUnique (fsLit "LlvmCodeGen.Regs.otherN")
-- | The TBAA metadata identifier
tbaa :: LMString
More information about the ghc-commits
mailing list