On 2021/4/7 14:57, Richard Biener wrote:
On Wed, Apr 7, 2021 at 7:42 AM Xionghu Luo <luo...@linux.ibm.com> wrote:

print_rtl will dump the rtx_insn from current until LAST.  But it is only
useful to see the particular insn that called by print_rtx_insn_vec,
Let's call print_rtl_single to display that insn in the gcse and store-motion
pass dump.

Can you cite a before/after dump snippet to clarify?

Before the patch, pr24257.c.258r.store_motion dumps:

  Pattern (  1): (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
        (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
ANTIC stores : {(insn 18 17 19 3 (set (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
                (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
        (reg:SI 131)) 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 131)
        (nil)))

(code_label 19 18 20 4 2 (nil) [1 uses])

(note 20 19 21 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 21 20 22 4 (set (reg:SI 132)
        (const_int 0 [0])) "pr24257.c":16:9 516 {*movsi_internal1}
     (nil))

(insn 22 21 0 4 (set (mem:SI (reg/v/f:DI 124 [ s ]) [1 s_2(D)->buf+0 S4 A32])
        (reg:SI 132)) "pr24257.c":16:9 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 132)
        (expr_list:REG_DEAD (reg/v/f:DI 124 [ s ])
            (nil))))
}
AVAIL stores : {(insn 7 4 10 2 (set (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
                (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
(subreg/s/u:SI (reg/v:DI 125 [ n ]) 0)) "pr24257.c":23:11 516 {*movsi_internal1}
     (nil))

(insn 10 7 11 2 (set (reg:CC 126)
        (compare:CC (subreg/s/u:SI (reg/v:DI 125 [ n ]) 0)
            (const_int 31 [0x1f]))) "pr24257.c":10:18 751 {*cmpsi_signed}
     (nil))

(jump_insn 11 10 12 2 (set (pc)
        (if_then_else (gt (reg:CC 126)
                (const_int 0 [0]))
            (label_ref 19)
            (pc))) "pr24257.c":10:18 834 {*cbranch}
     (expr_list:REG_DEAD (reg:CC 126)
        (int_list:REG_BR_PROB 118111604 (nil)))
 -> 19)

(note 12 11 13 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(insn 13 12 14 3 (parallel [
            (set (reg:SI 127)
                (minus:SI (const_int 31 [0x1f])
                    (subreg/u:SI (reg/v:DI 125 [ n ]) 0)))
            (clobber (reg:SI 98 ca))
        ]) "pr24257.c":12:15 100 {subfsi3_imm}
     (expr_list:REG_UNUSED (reg:SI 98 ca)
        (nil)))
(insn 14 13 15 3 (set (reg:SI 128)
        (lshiftrt:SI (reg:SI 127)
            (const_int 3 [0x3]))) "pr24257.c":12:15 273 {lshrsi3}
     (expr_list:REG_DEAD (reg:SI 127)
        (nil)))

(insn 15 14 16 3 (set (reg:SI 129)
        (ashift:SI (reg:SI 128)
            (const_int 3 [0x3]))) "pr24257.c":12:15 263 {ashlsi3}
     (expr_list:REG_DEAD (reg:SI 128)
        (nil)))

(insn 16 15 17 3 (set (reg:SI 130)
        (plus:SI (subreg/s/u:SI (reg/v:DI 125 [ n ]) 0)
            (const_int 8 [0x8]))) "pr24257.c":12:15 65 {*addsi3}
     (expr_list:REG_DEAD (reg/v:DI 125 [ n ])
        (nil)))

(insn 17 16 18 3 (set (reg:SI 131)
        (plus:SI (reg:SI 129)
            (reg:SI 130))) "pr24257.c":12:15 65 {*addsi3}
     (expr_list:REG_DEAD (reg:SI 130)
        (expr_list:REG_DEAD (reg:SI 129)
            (nil))))

(insn 18 17 19 3 (set (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
                (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
        (reg:SI 131)) 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 131)
        (nil)))

(code_label 19 18 20 4 2 (nil) [1 uses])

(note 20 19 21 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 21 20 22 4 (set (reg:SI 132)
        (const_int 0 [0])) "pr24257.c":16:9 516 {*movsi_internal1}
     (nil))

(insn 22 21 0 4 (set (mem:SI (reg/v/f:DI 124 [ s ]) [1 s_2(D)->buf+0 S4 A32])
        (reg:SI 132)) "pr24257.c":16:9 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 132)
        (expr_list:REG_DEAD (reg/v/f:DI 124 [ s ])
            (nil))))
, (insn 18 17 19 3 (set (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
                (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
        (reg:SI 131)) 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 131)
        (nil)))

(code_label 19 18 20 4 2 (nil) [1 uses])

(note 20 19 21 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 21 20 22 4 (set (reg:SI 132)
        (const_int 0 [0])) "pr24257.c":16:9 516 {*movsi_internal1}
     (nil))

(insn 22 21 0 4 (set (mem:SI (reg/v/f:DI 124 [ s ]) [1 s_2(D)->buf+0 S4 A32])
        (reg:SI 132)) "pr24257.c":16:9 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 132)
        (expr_list:REG_DEAD (reg/v/f:DI 124 [ s ])
            (nil))))
}



With this patch, it only dumps instructions we care about for
ANTIC stores and AVAIL stores:



  Pattern (  1): (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
        (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
ANTIC stores : {(insn 18 17 19 3 (set (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
                (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
        (reg:SI 131)) 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 131)
        (nil)))
}
AVAIL stores : {(insn 7 4 10 2 (set (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
                (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
(subreg/s/u:SI (reg/v:DI 125 [ n ]) 0)) "pr24257.c":23:11 516 {*movsi_internal1}
     (nil))
, (insn 18 17 19 3 (set (mem:SI (plus:DI (reg/v/f:DI 124 [ s ])
                (const_int 4 [0x4])) [1 s_2(D)->left+0 S4 A32])
        (reg:SI 131)) 516 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:SI 131)
        (nil)))
}




2021-04-07  Xionghu Luo  <luo...@linux.ibm.com>

gcc/ChangeLog:

         * fold-const.c (fold_single_bit_test): Fix typo.
         * print-rtl.c (print_rtx_insn_vec): Call print_rtl_single
         instead.
---
  gcc/fold-const.c | 2 +-
  gcc/print-rtl.c  | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index d4c5a9c299f..2834278fd76 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7390,7 +7390,7 @@ fold_single_bit_test (location_t loc, enum tree_code code,
    return NULL_TREE;
  }

-/* Test whether it is preferable two swap two operands, ARG0 and
+/* Test whether it is preferable to swap two operands, ARG0 and
     ARG1, for example because ARG0 is an integer constant and ARG1
     isn't.  */

diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 2a56823d3c1..c7982bce507 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -1237,7 +1237,7 @@ print_rtx_insn_vec (FILE *file, const vec<rtx_insn *> 
&vec)
    unsigned int len = vec.length ();
    for (unsigned int i = 0; i < len; i++)
      {
-      print_rtl (file, vec[i]);
+      print_rtl_single (file, vec[i]);
        if (i < len - 1)
         fputs (", ", file);
      }
--
2.25.1


--
Thanks,
Xionghu

Reply via email to