nocchijiang wrote:

> I suppose breakpoints still work with `--icf=all` because both folded symbols 
> point to the same address. With `--icf=safe_thunks`, the address significant 
> symbol points to the thunk, and the other symbol points to the function body. 
> So bypassing the thunk would break debuggers. I could guard this behind a 
> flag, but I'm wondering if the benefit is worth it.

I think this matters more than it might seem. Under `safe_thunks`, the 
address-significant symbol's entry is the thunk, so bypassing it changes what 
external observers see. For us, behaving identically to an external observer is 
crucial, because that's how we triage hard-to-reproduce bugs in release 
packages. If a breakpoint silently misses some calls to a function, we can draw 
the wrong conclusion about whether it ran at all. So I see this as a breaking 
change to `safe_thunks`, not an optimization within it. If it goes in, it 
should be a dedicated flag or a separate ICF mode such as `unsafe_thunks`.

> We have logic in BP to order ICF thunks with their bodies, but of course that 
> requires an orderfile.

We don't enable BP in production. We can't get an order of good enough quality 
to be sure startup performance doesn't regress, so we can't rely on BP to 
recover the locality. I'd really like to know how you manage this.

> Yeah we do this too, but we only look at relocations in the `__text` section. 
> This will miss function addresses stored in data sections, but apparently 
> this isn't a problem for us. Do you do something similar? This reminds me of 
> the discussion in #192636.

Yes, the patch implements the approach discussed in #192636. The heuristic is 
stricter than scanning `__text` relocations and is RE-ed from Apple ld, so I'm 
not sure it's suitable for upstreaming.

https://github.com/llvm/llvm-project/pull/239472
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to