[llvm] r281715 - [ARM] Promote small global constants to constant pools

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 09:58:24 PDT 2016


On 9/16/2016 3:17 AM, James Molloy via llvm-commits wrote:
> Author: jamesm
> Date: Fri Sep 16 05:17:04 2016
> New Revision: 281715
>
> +  // Ensure that we don't try and inline any type that contains pointers. If
> +  // we inline a value that contains relocations, we move the relocations from
> +  // .data to .text which is not ideal.
> +  auto *Init = GVar->getInitializer();
> +  if (!isSimpleType(Init->getType()))
> +    return SDValue();

Shouldn't you be checking whether the initializer contains any pointers, 
as opposed to checking whether the type of the initializer contains any 
pointer types?  Consider "static const long a = (long)&b", or "static 
long* const a = 0;".

I think you can just check "isa<ConstantData>(Init)".

-Eli


-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list