diff options
-rw-r--r-- | backend/Deadcode.v | 5 | ||||
-rw-r--r-- | backend/Deadcodeproof.v | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/backend/Deadcode.v b/backend/Deadcode.v index f491d678..9cbe5054 100644 --- a/backend/Deadcode.v +++ b/backend/Deadcode.v @@ -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. diff --git a/backend/Deadcodeproof.v b/backend/Deadcodeproof.v index 07c3f84a..e23fdfd3 100644 --- a/backend/Deadcodeproof.v +++ b/backend/Deadcodeproof.v @@ -1046,8 +1046,12 @@ Ltac UseTransfer := eapply mextends_agree; eauto. - (* conditional *) - TransfInstr; UseTransfer. + TransfInstr; UseTransfer. destruct (peq ifso ifnot). ++ replace (if b then ifso else ifnot) with ifso by (destruct b; congruence). econstructor; split. + eapply exec_Inop; eauto. + eapply match_succ_states; eauto. simpl; auto. ++ econstructor; split. eapply exec_Icond; eauto. eapply needs_of_condition_sound. eapply ma_perm; eauto. eauto. eauto with na. eapply match_succ_states; eauto 2 with na. |