LTO and probe-stack functions

Hi,

I've been trying to fix an issue[1] where LTO is optimizing out
probe-stack functions when calls to the function are emitted by
the backend, but aren't present in the IR.

So for example if we have a function @main that has the
"probe-stack"="probestack" attribute, this tells the backend
to emit a call to probestack() when it needs to insert a stack
probe. This call is only emitted after LTO is complete, so the
LTO optimizer has no idea this function will be used in the final
binary.

What is the correct way to fix this? Do we need to change the
attributes/visibility of the probestack function, which is currently
defined as `define dso_local void @probestack() ` or should the
optimizer be checking the value of the "probe-stack' attribute and
consider any function referenced by that attribute to be used?

Thanks,
Tom

[1] https://github.com/llvm/llvm-project/issues/47216