[PATCH] [RFC][PATCH] Minor opt to access pointers to globals via pcrel GOT entries

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Wed Feb 11 12:47:23 PST 2015


Updated the patch to reflect the previous discussion and other comments from Rafael. Somes notes:

- A 'Base Constant' was added together with the 'Offset' in emitGlobalConstantImpl in order to keep track of the base symbol for the current emission, example: the Global Variable user on the top of multiple nested constant expressions is the 'Base Constant' for any nested sub-element that is being currently emitted. In the previous patches I used to walk users to find the 'Base Constant', this is wrong since it doesn't consider fact that constant expressions are uniqued, meaning that looking into cstexpr users may lead to different GlobalVariables, yielding the wrong result.
- Add a more robust test.
- Handle general constants to be used with the GOTPCREL relocation while opening the possibility for more complex IR cstexpr to be folded into a GOTPCREL+cst. See the test for concrete examples.


http://reviews.llvm.org/D6922

Files:
  include/llvm/CodeGen/AsmPrinter.h
  include/llvm/Target/TargetLoweringObjectFile.h
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  lib/Target/X86/X86TargetObjectFile.cpp
  lib/Target/X86/X86TargetObjectFile.h
  test/MC/X86/cstexpr-gotpcrel.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6922.19775.patch
Type: text/x-patch
Size: 21524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150211/05358296/attachment.bin>


More information about the llvm-commits mailing list