From 93d2fc9e3b23d69c0c97d229f9fa4ab36079f507 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 18 Sep 2017 15:03:20 +0200 Subject: Deadcode: eliminate trivial Icond instructions These are conditionals where the "ifso" and the "ifnot" successors are the same. By eliminating them here and not later, we can also eliminate the instructions that compute the arguments to the condition, if any. There is another, later point where these trivial conditional instructions are eliminated: in the Tunneling phase. The elimination done in Tunneling is more powerful in that it works not just for conditionals whose two successors are the same, but also for conditionals whose two successors lead to the same point after a series of nops. The elimination done in Deadcode is more powerful in that it eliminates the instructions that compute the arguments to the condition. Hence it is worth having both eliminations. --- backend/Deadcodeproof.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backend/Deadcodeproof.v') 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. -- cgit