This is an archive of the discontinued LLVM Phabricator instance.

Go back to sometimes assuming intristics are local
ClosedPublic

Authored by espindola on Mar 9 2018, 3:59 PM.

Details

Reviewers
rnk
chandlerc
Summary

This fixes pr36674.

While it is valid for shouldAssumeDSOLocal to return false anytime, always returning false for intrinsics is not optimal on i386 and also hits a bug in the backend.

To use a plt, the caller must first setup ebx to handle the case of that file being linked into a PIE executable or shared library. In those cases the generated PLT uses ebx.

Currently we can produce "calll expf@plt" without setting ebx. We could fix that by correctly setting ebx, but this would produce worse code for the case where the runtime library is statically linked. It would also required other tools to handle R_386_PLT32.

Diff Detail

Event Timeline

espindola created this revision.Mar 9 2018, 3:59 PM
chandlerc accepted this revision.Mar 9 2018, 5:22 PM
chandlerc added a subscriber: chandlerc.

LGTM, thanks for tracking this down Rafael! (nit pick below, not critical)

lib/Target/TargetMachine.cpp
121

Maybe just !GV here for consistency with the rest of the code?

This revision is now accepted and ready to land.Mar 9 2018, 5:22 PM