Skip to content
Snippets Groups Projects
Commit c5deaa27 authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

Reg.Liveness: Don't repeatedly construct UniqSets

parent 34d08a20
No related branches found
No related tags found
No related merge requests found
......@@ -1024,15 +1024,15 @@ liveness1 platform liveregs blockmap (LiveInstr instr _)
= (liveregs1, LiveInstr instr
(Just $ Liveness
{ liveBorn = emptyUniqSet
, liveDieRead = mkUniqSet r_dying
, liveDieWrite = mkUniqSet w_dying }))
, liveDieRead = r_dying
, liveDieWrite = w_dying }))
| otherwise
= (liveregs_br, LiveInstr instr
(Just $ Liveness
{ liveBorn = emptyUniqSet
, liveDieRead = mkUniqSet r_dying_br
, liveDieWrite = mkUniqSet w_dying }))
, liveDieWrite = w_dying }))
where
!(RU read written) = regUsageOfInstr platform instr
......@@ -1044,10 +1044,12 @@ liveness1 platform liveregs blockmap (LiveInstr instr _)
-- registers that are not live beyond this point, are recorded
-- as dying here.
r_dying = [ reg | reg <- read, reg `notElem` written,
r_dying = mkUniqSet
[ reg | reg <- read, reg `notElem` written,
not (elementOfUniqSet reg liveregs) ]
w_dying = [ reg | reg <- written,
w_dying = mkUniqSet
[ reg | reg <- written,
not (elementOfUniqSet reg liveregs) ]
-- union in the live regs from all the jump destinations of this
......@@ -1067,6 +1069,6 @@ liveness1 platform liveregs blockmap (LiveInstr instr _)
-- registers that are live only in the branch targets should
-- be listed as dying here.
live_branch_only = live_from_branch `minusUniqSet` liveregs
r_dying_br = nonDetEltsUniqSet (mkUniqSet r_dying `unionUniqSets`
r_dying_br = nonDetEltsUniqSet (r_dying `unionUniqSets`
live_branch_only)
-- See Note [Unique Determinism and code generation]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment