-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 2742 |
| Resolution | LATER |
| Resolved on | Jul 11, 2011 10:23 |
| Version | unspecified |
| OS | Linux |
| Blocks | #2770 #2050 #2783 |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
All kinds of passes, eg: IP constant propagation,
Andersen's, GlobalsModRef, the inliner, and probably
many other IP passes, are all wrong for functions
with weak linkage. The reason is that such functions
have a definition, but the definition may be wrong -
it can be replaced with something completely different
at link time. Rather than fixing up all passes, here
is a suggestion for how to solve all problems in one
fell swoop:
(0) make it illegal for a function to have weak
linkage.
(1) when creating a function F which should have
weak linkage, instead output it with a different
name ("F2"), and create a weak alias F which
links to F2. Calls to the function will be calls
to F, the alias. The optimizers won't see the
body for F, since there is none, so won't make
mistakes.
(2) at codegen time, undo this transform: output
F2 with name F and with weak linkage.