This causes issues if we start allowing functions with their addresses taken to be specialized.
I intend to submit a patch that does this soon, so this is a blocker at the moment.
Details
- Reviewers
SjoerdMeijer
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
665 | Hmmm, interesting. Can this lead to a miscompute, or other problems? I think we need to add a test to trigger that (which this patch fixes)? |
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
665 | Yes, this can lead to miscompiles and crashes if not handled properly. The problem is that I *believe* this issue only arises in very specific scenarios and only when we start allowing specialization of functions that can get their address taken. Otherwise this is never triggered on problematic functions. Since allowing that is outside of the scope of this PR, I thought it would be best to add the test for that in a separate patch I'm planning on submitting later. |
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
665 | I don't think we can or should submit code that isn't covered by tests, so I think that leaves us 2 options here:
These options are not mutually exclusive, we could add an assert now, change that later? |
Thanks for contributing to function specialisation by the way, I have also noticed your other patch that I will look at soon. I am happy to commit things on your behalf like the previous one, but you have a few patches in the pipeline and if you plan to do more llvm work, you could consider requesting an account so that you can commit it yourself. I believe the process to get commit rights isn't that difficult and should be quick. But up to you, like I said, am happy to commit things on your behalf.
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
665 | SGTM. |
Thanks, LGTM.
(and let me know if I need to commit this on your behalf, but sounds like you'll be looking into getting an account)
Oh wait, sorry, regressions test fail, they trigger this assert. We should assert that CS.getCalledFunction() == F? Also, in asserts it is custom to add a message/diagnostic, so that will be:
assert(CS.getCalledFunction() == F && "function and callee should be same");
or something along those lines.
Hmmm, interesting. Can this lead to a miscompute, or other problems? I think we need to add a test to trigger that (which this patch fixes)?