Skip to content

Commit

Permalink
[analyzer] avoid some work for PHI nodes if values differ
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Dec 10, 2014
1 parent 5b29d26 commit c3c1947
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions analyzer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -956,16 +956,16 @@ module ConstPropagation = struct
e
else
value ssa e'
| TCall ({eexpr = TLocal {v_name = "__ssa_phi__"}},el) ->
let el = List.map (value ssa) el in
begin match el with
| [] -> assert false
| TCall ({eexpr = TLocal {v_name = "__ssa_phi__"}},e1 :: el) ->
let e1v = value ssa e1 in
let rec loop el = match el with
| e1 :: el ->
if List.for_all (fun e2 -> expr_eq e1 e2) el then
value ssa e1
else
e
end
let e1 = value ssa e1 in
if not (expr_eq e1 e1v) then e else loop el
| [] ->
e1v
in
loop el
| TParenthesis e1 | TMeta(_,e1) ->
value ssa e1
| TLocal v ->
Expand Down

0 comments on commit c3c1947

Please sign in to comment.