aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Deadcode.v
diff options
context:
space:
mode:
Diffstat (limited to 'backend/Deadcode.v')
-rw-r--r--backend/Deadcode.v7
1 files changed, 5 insertions, 2 deletions
diff --git a/backend/Deadcode.v b/backend/Deadcode.v
index f491d678..2286876e 100644
--- a/backend/Deadcode.v
+++ b/backend/Deadcode.v
@@ -102,7 +102,7 @@ Function transfer_builtin (app: VA.t) (ef: external_function)
nmem_add (nmem_remove nm (aaddr_arg app dst) sz) (aaddr_arg app src) sz)
args
else (ne, nm)
- | (EF_annot _ _ | EF_annot_val _ _), _ =>
+ | (EF_annot _ _ _ | EF_annot_val _ _ _), _ =>
transfer_builtin_args (kill_builtin_res res ne, nm) args
| EF_debug _ _ _, _ =>
(kill_builtin_res res ne, nm)
@@ -143,7 +143,8 @@ Definition transfer (f: function) (approx: PMap.t VA.t)
| Some(Ibuiltin ef args res s) =>
transfer_builtin approx!!pc ef args res ne nm
| Some(Icond cond args s1 s2) =>
- (add_needs args (needs_of_condition cond) ne, nm)
+ if peq s1 s2 then after else
+ (add_needs args (needs_of_condition cond) ne, nm)
| Some(Ijumptable arg tbl) =>
(add_need_all arg ne, nm)
| Some(Ireturn optarg) =>
@@ -191,6 +192,8 @@ Definition transf_instr (approx: PMap.t VA.t) (an: PMap.t NA.t)
if nmem_contains (snd an!!pc) (aaddr_arg approx!!pc dst) sz
then instr
else Inop s
+ | Icond cond args s1 s2 =>
+ if peq s1 s2 then Inop s1 else instr
| _ =>
instr
end.