Skip to content

Commit

Permalink
Adress comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chambart committed Jan 9, 2018
1 parent 60dd630 commit 86a0606
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 5 additions & 1 deletion asmcomp/CSEgen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ method private cse n i =
next = self#cse empty_numbering i.next}

method fundecl f =
{f with fun_body = self#cse empty_numbering f.fun_body}
(* CSE can trigger bad register allocation behaviors, see MPR#7630 *)
if List.mem Cmm.No_CSE f.fun_codegen_options then
f
else
{f with fun_body = self#cse empty_numbering f.fun_body }

end
9 changes: 1 addition & 8 deletions asmcomp/asmgen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ let rec regalloc ppf round fd =
Reg.reinit(); Liveness.fundecl ppf newfd; regalloc ppf (round + 1) newfd
end else newfd

let cse fd =
(* CSE can trigger bad register allocation behaviors, see MPR#7630 *)
if List.mem Cmm.No_CSE fd.Mach.fun_codegen_options then
fd
else
CSE.fundecl fd

let (++) x f = f x

let compile_fundecl (ppf : formatter) fd_cmm =
Expand All @@ -116,7 +109,7 @@ let compile_fundecl (ppf : formatter) fd_cmm =
++ pass_dump_if ppf dump_selection "After instruction selection"
++ Profile.record ~accumulate:true "comballoc" Comballoc.fundecl
++ pass_dump_if ppf dump_combine "After allocation combining"
++ Profile.record ~accumulate:true "cse" cse
++ Profile.record ~accumulate:true "cse" CSE.fundecl
++ pass_dump_if ppf dump_cse "After CSE"
++ Profile.record ~accumulate:true "liveness" (liveness ppf)
++ Profile.record ~accumulate:true "deadcode" Deadcode.fundecl
Expand Down
9 changes: 7 additions & 2 deletions testsuite/tests/asmgen/parsecmm.mly
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,13 @@ phrase:
fundecl:
LPAREN FUNCTION fun_name LPAREN params RPAREN sequence RPAREN
{ List.iter (fun (id, ty) -> unbind_ident id) $5;
{fun_name = $3; fun_args = $5; fun_body = $7; fun_fast = true;
fun_fast_compile = true;
{fun_name = $3; fun_args = $5; fun_body = $7;
fun_codegen_options =
if Config.flambda then [
Reduce_code_size;
No_CSE;
]
else [ Reduce_code_size ];
fun_dbg = debuginfo ()} }
;
fun_name:
Expand Down

0 comments on commit 86a0606

Please sign in to comment.