[PATCH] D45180: libcalls must check for "RtLibUseGOT" metadata during simplification

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 19:08:33 PDT 2018


espindola added a comment.

In https://reviews.llvm.org/D45180#1055157, @efriedma wrote:

> I don't think we want to try to copy attributes from fprintf() to fputs()... I mean, I can't see when it would make sense to copy anything.  fprintf() and fputs() aren't really related except for the fact that we expect them both to be defined in libc, and they can both be used to perform certain equivalent operations.  And any attribute which needs to be applied to all calls into libc needs to be computed differently anyway: the compiler can generate calls to libc in a translation unit which doesn't contain any explicit calls to libc functions. (llvm.sin() gets lowered to sin(), byval struct copies get lowered to memcpy(), etc.)  Making this work consistently is precisely the reason we have RtLibUseGOT in the first place.


But the one relation that matters in here is the "except for the fact that we expect them both to be defined in libc". The bug is that we are converting a got based access to something in libc to a plt based access to something else.

I actually think my preference is to never use nonlazybind.If we go that way we don't even need this patch as the module already has RtLibUseGOT anyway.


https://reviews.llvm.org/D45180





More information about the llvm-commits mailing list