aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-10-02 14:20:41 +0200
committerMagnus Lång <[email protected]>2016-11-16 17:22:04 +0100
commit6b7c73196936d94f2a03a465c0954fc9dbf35974 (patch)
tree932e4b31aacda9c4ce243eea73378f7685adc589
parentfda8d7909594d434c01fdc9610127d09d1499a43 (diff)
downloadotp-6b7c73196936d94f2a03a465c0954fc9dbf35974.tar.gz
otp-6b7c73196936d94f2a03a465c0954fc9dbf35974.tar.bz2
otp-6b7c73196936d94f2a03a465c0954fc9dbf35974.zip
hipe_x86_postpass: Negate conditions in goto elim
-rw-r--r--lib/hipe/x86/hipe_x86.erl4
-rw-r--r--lib/hipe/x86/hipe_x86_postpass.erl5
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/hipe/x86/hipe_x86.erl b/lib/hipe/x86/hipe_x86.erl
index 95af3f9c67..45bf1ad736 100644
--- a/lib/hipe/x86/hipe_x86.erl
+++ b/lib/hipe/x86/hipe_x86.erl
@@ -218,6 +218,10 @@
%% highest_temp/1
]).
+%% Other utilities
+-export([neg_cc/1
+ ]).
+
%%%
%%% Low-level accessors.
%%%
diff --git a/lib/hipe/x86/hipe_x86_postpass.erl b/lib/hipe/x86/hipe_x86_postpass.erl
index 390f5bf5e7..f88a841cca 100644
--- a/lib/hipe/x86/hipe_x86_postpass.erl
+++ b/lib/hipe/x86/hipe_x86_postpass.erl
@@ -217,6 +217,11 @@ trivial_goto_elimination(Insns) -> goto_elim(Insns, []).
goto_elim([#jmp_label{label=Label}, I = #label{label=Label}|Insns], Res) ->
goto_elim([I|Insns], Res);
+goto_elim([#jcc{cc=CC, label=Label} = IJCC,
+ #jmp_label{label=BranchTgt},
+ #label{label=Label} = ILBL|Insns], Res) ->
+ goto_elim([IJCC#jcc{cc=hipe_x86:neg_cc(CC), label=BranchTgt},
+ ILBL|Insns], Res);
goto_elim([I | Insns], Res) ->
goto_elim(Insns, [I|Res]);
goto_elim([], Res) ->