[PATCH] D141381: [codegen] Store address of indirect arguments on the stack

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 10 09:16:05 PST 2023


dblaikie added a comment.

Ah, so the intent is that this causes these indirect args to be handled the same way as other arguments at -O0 - placed in an alloca, eg:

  struct t1 {
    t1(const t1&);
  };
  void f1(int, int);
  void f2(t1 v, int x) {
    f1(3, 4);
  }

  0x00000033:     DW_TAG_formal_parameter
                    DW_AT_location        (indexed (0x0) loclist = 0x00000010: 
                       [0x0000000000000000, 0x0000000000000010): DW_OP_breg5 RDI+0
                       [0x0000000000000010, 0x0000000000000020): DW_OP_entry_value(DW_OP_reg5 RDI))
                    DW_AT_name    ("v")
  ...
  
  0x0000003c:     DW_TAG_formal_parameter
                    DW_AT_location        (DW_OP_fbreg -4)
                    DW_AT_name    ("x")
  ...

Though I guess it doesn't change the codegen so that the alloca is used to load the value like with other values. Maybe it'd be worth changing the codegen to be more similar in that way? But maybe not. Don't know.

It seems plausible - though the impact on -O0 will be a question - if this hurts code size/perf too much (there's /some/ line there, but I don't know what it is), it couldn't go in -O0 and I'm not sure where it'd go. Logically `-Og` would make sense, but that's `-O1` which runs mem2reg anyway, so would lose the alloca, which doesn't help...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141381/new/

https://reviews.llvm.org/D141381



More information about the cfe-commits mailing list