https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102008

--- Comment #2 from luoxhu at gcc dot gnu.org ---
Confirmed if move the sink2 pass before phiopt4 could restore the previous
instructons for this case:

test:
.LFB0:
        .cfi_startproc
        cmp     w0, 1
        ldp     w0, w1, [x1]
        csel    w0, w1, w0, ne
        ret
        .cfi_endproc



diff --git a/gcc/passes.def b/gcc/passes.def
index 945d2bc797c..83b8310f1ee 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -345,10 +345,10 @@ along with GCC; see the file COPYING3.  If not see
       /* After late CD DCE we rewrite no longer addressed locals into SSA
         form if possible.  */
       NEXT_PASS (pass_forwprop);
+      NEXT_PASS (pass_sink_code);
       NEXT_PASS (pass_phiopt, false /* early_p */);
       NEXT_PASS (pass_fold_builtins);
       NEXT_PASS (pass_optimize_widening_mul);
-      NEXT_PASS (pass_sink_code);
       NEXT_PASS (pass_store_merging);
       NEXT_PASS (pass_tail_calls);


ls *sink*
pr102008.c.139t.sink1  pr102008.c.199t.sink2
ls *phiopt*
pr102008.c.042t.phiopt1  pr102008.c.119t.phiopt2  pr102008.c.131t.phiopt3 
pr102008.c.200t.phiopt4

Reply via email to