> On Aug 17, 2021, at 9:50 AM, Qing Zhao via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>
>
>
>> On Aug 17, 2021, at 3:29 AM, Richard Biener <rguent...@suse.de> wrote:
>>
>> On Mon, 16 Aug 2021, Qing Zhao wrote:
>>
>>> My current code for expand_DEFERRED_INIT is like the following, could you
>>> check and see whether there is any issue for it:
>>>
>>> #define INIT_PATTERN_VALUE 0xFE
>>> static void
>>> expand_DEFERRED_INIT (internal_fn, gcall *stmt)
>>> {
>>> tree lhs = gimple_call_lhs (stmt);
>>> tree var_size = gimple_call_arg (stmt, 0);
>>> enum auto_init_type init_type
>>> = (enum auto_init_type) TREE_INT_CST_LOW (gimple_call_arg (stmt, 1));
>>> bool is_vla = (bool) TREE_INT_CST_LOW (gimple_call_arg (stmt, 2));
>>>
>>> tree var_type = TREE_TYPE (lhs);
>>> gcc_assert (init_type > AUTO_INIT_UNINITIALIZED);
>>>
>>> if (is_vla || (!use_register_for_decl (lhs)))
>>> {
>>> if (TREE_CODE (lhs) == SSA_NAME)
>>> lhs = SSA_NAME_VAR (lhs);
>>
>> this should not be necessary (in fact you shouldn't see a SSA_NAME
>> here, if you do then using SSA_NAME_VAR is wrong)
> You mean during RTL expansion phase, all SSA_NAMEs are gone already?
Actually, the lhs could be SSA_NAME here,
Breakpoint 1, expand_DEFERRED_INIT (stmt=0x7fffe96ae348) at
../../latest-gcc/gcc/internal-fn.c:3021
3021 mark_addressable (lhs);
(gdb) call debug_tree(lhs)
<ssa_name 0x7fffe9584e58
type <real_type 0x7fffe959b2a0 float sizes-gimplified SF
size <integer_cst 0x7fffe9579f48 constant 32>
unit-size <integer_cst 0x7fffe9579f60 constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type
0x7fffe959b2a0 precision:32
pointer_to_this <pointer_type 0x7fffe959b7e0>>
visited var <var_decl 0x7ffff7ff7bd0 temp1>
def_stmt temp1_5 = .DEFERRED_INIT (4, 2, 0, &"temp1"[0]);
version:5>
when I deleted:
if (TREE_CODE (lhs) == SSA_NAME
lhs = SSA_NAME_VAR (lhs);
Many testing cases failed with internal compiler error:
/home/opc/Work/GCC/latest-gcc/gcc/testsuite/c-c++-common/auto-init-3.c:9:9:
internal compiler error: in expand_expr_addr_expr_1, at expr.c:8437
0xe237aa expand_expr_addr_expr_1
../../latest-gcc/gcc/expr.c:8437
0xe24059 expand_expr_addr_expr
../../latest-gcc/gcc/expr.c:8525
0xe32b56 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../latest-gcc/gcc/expr.c:11741
0xe2da52 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../latest-gcc/gcc/expr.c:10777
0xe24706 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
../../latest-gcc/gcc/expr.c:8713
0xc13f15 expand_expr
../../latest-gcc/gcc/expr.h:301
0xc17acb get_memory_rtx
../../latest-gcc/gcc/builtins.c:1370
0xc2223d expand_builtin_memset_args
../../latest-gcc/gcc/builtins.c:4102
0xc21a20 expand_builtin_memset(tree_node*, rtx_def*, machine_mode)
../../latest-gcc/gcc/builtins.c:3886
0xfb5c85 expand_DEFERRED_INIT
../../latest-gcc/gcc/internal-fn.c:3031
So, did I do anything wrong?
Qing