Skip to content

Commit b427629

Browse files
authored
fixes arm predication (#1426)
1 parent 3682860 commit b427629

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/arm/arm_utils.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ let exec
5454
| Some f, Some (`Reg `CPSR) -> stmts @ f
5555
| _ -> stmts in
5656
(* generates an expression for the given McCond *)
57-
let set_cond mccond =
57+
let set_cond cond =
5858
let z = Bil.var Env.zf in
5959
let c = Bil.var Env.cf in
6060
let v = Bil.var Env.vf in
@@ -81,8 +81,9 @@ let exec
8181
match cond with
8282
| `AL -> stmts
8383
| _ when List.for_all stmts ~f:is_move ->
84-
let cond = set_cond cond in
85-
List.map stmts ~f:(function
84+
let cval = set_cond cond and cvar = tmp bool_t in
85+
let cond = Bil.var cvar in
86+
Bil.(cvar := cval) :: List.map stmts ~f:(function
8687
| Bil.Move (v,_) as s when Var.is_virtual v -> s
8788
| Bil.Move (v,x) ->
8889
Bil.(v := ite ~if_:cond ~then_:x ~else_:(var v))

0 commit comments

Comments
 (0)