This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH tree-inline] do not say "called from here" with UNKNOWN_LOCATION


On Tue, Sep 22, 2015 at 2:22 AM, Manuel LÃpez-IbÃÃez
<lopezibanez@gmail.com> wrote:
> On 21 September 2015 at 12:29, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Mon, Sep 21, 2015 at 11:59 AM, Manuel LÃpez-IbÃÃez
>> <lopezibanez@gmail.com> wrote:
>>> On 21 September 2015 at 10:18, Richard Biener
>>> <richard.guenther@gmail.com> wrote:
>>>> input_location is set from the call stmt:
>>>>
>>>>   /* FIXME: instantiate_decl isn't called by inlinable_function_p.  */
>>>>   saved_location = input_location;
>>>>   input_location = gimple_location (stmt);
>>>>
>>>> it would be nice to get rid of that.
>>>
>>> I could replace all uses of input_location in this function by
>>> gimple_location(stmt) as I noted in the comments. Would that be ok if
>>> it works? I'm not sure I can prove that input_location is not used
>>> behind the scenes for some other purpose (all the more reason to kill
>>> input_location once and for all). Friends, don't let friends use
>>> input_location in new code!
>>
>> Yeah...  not sure how to check but to look for any changes in
>> generated cc1/cc1plus
>> debug info.  You could also try making it invalid (-1?) and hope
>> libcpp would eventually
>> blow up if that is used.
>>
>
> It does blow up with:
>
> /home/manuel/test2/227965M/build/gcc/gnat1 -gnatwa -quiet -nostdinc
> -dumpbase s-mudido.adb -auxbase-strip s-mudido.o -O2 -Wextra -Wall
> -fpic -g -gnatpg -mtune=generic -march=x86-64 -gnatO s-mudido.o
> s-mudido.adb -o /tmp/ccNQpzNF.s
>
> at:
>
> B =>SET_EXPR_LOCATION (mod, EXPR_LOC_OR_LOC (val, input_location));
>
> #0  internal_get_tmp_var (val=0x7ffff5dfdc40, pre_p=0x7fffffffdaf0,
> post_p=<optimized out>, is_formal=<optimized out>) at
> /home/manuel/test2/src/gcc/gimplify.c:540
> #1  0x0000000000c00efd in gimplify_expr
> (expr_p=expr_p@entry=0x7fffffffdaf8, pre_p=pre_p@entry=0x7fffffffdaf0,
> post_p=0x7fffffffd9a0, post_p@entry=0x0, gimple_test_f=<optimized
> out>, fallback=fallback@entry=1) at
> /home/manuel/test2/src/gcc/gimplify.c:9040
> #2  0x0000000000c19b67 in gimple_regimplify_operands
> (stmt=0x7ffff6074be0, gsi_p=gsi_p@entry=0x7fffffffdbb0) at
> /home/manuel/test2/src/gcc/gimplify-me.c:252
> #3  0x0000000000e8cbe3 in copy_bb (id=id@entry=0x7fffffffde40,
> bb=bb@entry=0x7ffff60eb548,
> frequency_scale=frequency_scale@entry=10000,
> count_scale=count_scale@entry=10000) at
> /home/manuel/test2/src/gcc/tree-inline.c:1798
> #4  0x0000000000e8e039 in copy_cfg_body (new_entry=0x0,
> exit_block_map=0x7ffff5dff340, entry_block_map=0x7ffff60d4c30,
> frequency_scale=10000, count=<optimized out>, id=0x7fffffffde40) at
> /home/manuel/test2/src/gcc/tree-inline.c:2716
> #5  copy_body (id=0x7fffffffde40, count=<optimized out>,
> frequency_scale=10000, entry_block_map=0x7ffff60d4c30,
> exit_block_map=0x7ffff5dff340, new_entry=0x0) at
> /home/manuel/test2/src/gcc/tree-inline.c:2955
> #6  0x0000000000e94f71 in expand_call_inline (id=0x7fffffffde40,
> stmt=<optimized out>, bb=<optimized out>) at
> /home/manuel/test2/src/gcc/tree-inline.c:4693
> #7  gimple_expand_calls_inline (id=0x7fffffffde40, bb=<optimized out>)
> at /home/manuel/test2/src/gcc/tree-inline.c:4833
> #8  optimize_inline_calls (fn=<optimized out>) at
> /home/manuel/test2/src/gcc/tree-inline.c:4973
> #9  0x00000000014c503c in inline_transform (node=0x7ffff644ccf0) at
> /home/manuel/test2/src/gcc/ipa-inline-transform.c:545
> #10 0x0000000000d54bac in execute_one_ipa_transform_pass
> (ipa_pass=0x2656340, node=0x7ffff644ccf0) at
> /home/manuel/test2/src/gcc/passes.c:2197
> #11 execute_all_ipa_transforms () at /home/manuel/test2/src/gcc/passes.c:2238
> #12 0x0000000000a99bc8 in cgraph_node::expand
> (this=this@entry=0x7ffff644ccf0) at
> /home/manuel/test2/src/gcc/cgraphunit.c:1976
> #13 0x0000000000a9b44e in expand_all_functions () at
> /home/manuel/test2/src/gcc/cgraphunit.c:2119
> #14 symbol_table::compile (this=this@entry=0x7ffff642b0a8) at
> /home/manuel/test2/src/gcc/cgraphunit.c:2472
> #15 0x0000000000a9da63 in symbol_table::compile (this=0x7ffff642b0a8)
> at /home/manuel/test2/src/gcc/cgraphunit.c:2536
> #16 symbol_table::finalize_compilation_unit (this=0x7ffff642b0a8) at
> /home/manuel/test2/src/gcc/cgraphunit.c:2562
> #17 0x0000000000e17d90 in compile_file () at
> /home/manuel/test2/src/gcc/toplev.c:508
> #18 0x000000000069e8a4 in do_compile () at
> /home/manuel/test2/src/gcc/toplev.c:1973
> #19 toplev::main (this=this@entry=0x7fffffffe0a0, argc=argc@entry=21,
> argv=argv@entry=0x7fffffffe198) at
> /home/manuel/test2/src/gcc/toplev.c:2080
> #20 0x00000000006a0bd7 in main (argc=21, argv=0x7fffffffe198) at
> /home/manuel/test2/src/gcc/main.c:39
>
> For some extra reason val does not have a location:
>
> (gdb) p debug_tree(val)
>  <addr_expr 0x7ffff5dfdc40
>     type <pointer_type 0x7ffff5fca540
>         type <array_type 0x7ffff5fca2a0
> system__multiprocessors__dispatching_domains__create__Tst_ddS__2 type
> <boolean_type 0x7ffff6445dc8 boolean>
>             sizes-gimplified asm_written nonaliased-component BLK size
> <var_decl 0x7ffff606b5a0 iftmp.56> unit size <var_decl 0x7ffff606b870
> iftmp.57>
>             align 8 symtab -166627696 alias set 32 canonical type
> 0x7ffff5fca2a0 domain <integer_type 0x7ffff5fca1f8> context
> <function_decl 0x7ffff5fbc460 system__multiprocessors__\
> dispatching_domains__create__2>
>             pointer_to_this <pointer_type 0x7ffff5fca540>
> reference_to_this <reference_type 0x7ffff5fdc1f8> chain <type_decl
> 0x7ffff5fbfc78 system__multiprocessors__dispatching_doma\
> ins__create__Tst_ddS__2>>
>         asm_written public unsigned DI
>         size <integer_cst 0x7ffff6427bb8 constant 64>
>         unit size <integer_cst 0x7ffff6427bd0 constant 8>
>         align 64 symtab -166626736 alias set 41 canonical type 0x7ffff5fca540>
>
>     arg 0 <mem_ref 0x7ffff5dfecd0 type <array_type 0x7ffff5fca2a0
> system__multiprocessors__dispatching_domains__create__Tst_ddS__2>
>         nothrow
>         arg 0 <ssa_name 0x7ffff5d52dc8 type <pointer_type 0x7ffff5fca540>
>             visited var <var_decl 0x7ffff607ca20 R.94>def_stmt
> R.94_159 = .builtin_alloca_with_align (iftmp.93_10, 8);
>
>             version 159
>             ptr-info 0x7ffff5d7d5a0>
>         arg 1 <integer_cst 0x7ffff6084030 constant 0>
>         s-mudido.adb:156:24>>
>
> Arguably, gimple_location (stmt) is probably better than anything that
> may be initially at input_location.
>
> Then, we cannot remove the saved_location hack, right?

Not without fixing that function, no.  I don't see why that should need to play
with locations at all though (or why using input_location -- IIRC gimplification
also sets that, so that's probably where it "leaks" from)

Richard.

> Cheers,
>
> Manuel.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]