On Tue, Apr 27, 2021 at 3:51 PM Gary Oblock via Gcc <gcc@gcc.gnu.org> wrote:
>
> I'm chasing a bug and I used Creduce to produce a
> reduced test case. However, that's really beside to
> point.
>
> I this file:
> --------------------------------
> typedef struct basket {
> } a;
> long b;
> a *basket;
> int d, c, e;
> a *flake[2];
> void primal_bea_mpp();
> void primal_net_simplex() {
>   flake[1] = &basket[1];
>   primal_bea_mpp(d, d, d, b, flake, 0, e, c, c, d);
> }
> --------------------------------
> Produces this GIMPLE:
> ---------------------------------
> ;; Function primal_net_simplex (primal_net_simplex, funcdef_no=3, 
> decl_uid=4447, cgraph_uid=16, symbol_order=41) (executed once)
>
> primal_net_simplex ()
> {
>   <bb 2> [local count: 1073741824]:
>   _1 = basket;
>   static struct a * flake[2];
> struct a *[2]
>   flake[1] = _1;
>   _2 = d;
>   _3 = c;
>   _4 = e;
>   _5 = b;
>   primal_bea_mpp (_2, _2, _2, _5, &flake, 0, _4, _3, _3, _2);
>   return;
>
> }
> --------------------------------------
> These standard calls were used to dump this:
>
>   FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node)
>   {
>     struct function *func = DECL_STRUCT_FUNCTION ( node->decl);
>     dump_function_header ( file, func->decl, (dump_flags_t)0);
>     dump_function_to_file ( func->decl, file, (dump_flags_t)0);
>   }
>
> The GIMPLE above looks malformed to me. Is that the case
> or am I not grasping what's going on here?

The above gimple looks correct.
_1 should be of type a*. _2, _3, _4, and _5 are of type int.
Reading from globals (non-local) requires an assignment which is why
you get _1, _2, _3, _4, and _5.
There have already been optimizations going on before your pass so the
loads from d and c have been only done once.
&flake is considered a constant during the execution of the function
is it is propagated into the function call.

What is the exact thing you think is incorrect about the gimple here?

Thanks,
Andrew


>
> Note, I wouldn't be asking this question if this wasn't at the start of
> my pass and looking at stuff I hadn't modified.
>
> Thanks,
>
> Gary
>
>
> CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
> for the sole use of the intended recipient(s) and contains information that 
> is confidential and proprietary to Ampere Computing or its subsidiaries. It 
> is to be used solely for the purpose of furthering the parties' business 
> relationship. Any unauthorized review, copying, or distribution of this email 
> (or any attachments thereto) is strictly prohibited. If you are not the 
> intended recipient, please contact the sender immediately and permanently 
> delete the original and any copies of this email and any attachments thereto.

Reply via email to