[PATCH] D42216: Use New Module Metadata String "AvoidPLT" to avoid calls via PLT

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 14:35:55 PST 2018


Sriraman Tallam via Phabricator <reviews at reviews.llvm.org> writes:

This LGTM with a llvm-link patch added.

> --- lib/Target/X86/X86Subtarget.cpp
> +++ lib/Target/X86/X86Subtarget.cpp
> @@ -157,8 +157,11 @@
>        // In Regcall calling convention those registers are used for passing
>        // parameters. Thus we need to prevent lazy binding in Regcall.
>        return X86II::MO_GOTPCREL;
> -    if (F && F->hasFnAttribute(Attribute::NonLazyBind) && is64Bit())
> -      return X86II::MO_GOTPCREL;
> +    // If PLT must be avoided then the call should be via GOTPCREL.
> +    if (((F && F->hasFnAttribute(Attribute::NonLazyBind)) ||
> +         (!F && M.getRtLibUseGOT())) &&
> +        is64Bit())
> +       return X86II::MO_GOTPCREL;
>      return X86II::MO_PLT;
>    }

Should we deprecate the non lazy bind attribute and always use the
module flag?

Cheers,
Rafael


More information about the llvm-commits mailing list