-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
GVN has special treatment for function/vtable pointers. I haven't fully understood why.
Function pointers have unstable comparison. We set the unnamed_addr
flag in LLVM. I am not entirely sure how far that attribute goes, but I think it means that ==
involving such functions is basically non-deterministic? @nikic @bjorn3 maybe you can help here -- can the result of comparing function pointers depend on whether or not optimizations are applied? Or how exactly unnamed_addr
affect the generated code?
@cjgillot could you give an example for the code you are concerned about, where GVN would go wrong if it did not special-case function pointers? I think you gave an example a while ago but I can't find it right now.
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.