[PATCH] D44781: [IR] Add function pointer alignment to DataLayout

Mikhail Maltsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 22 08:13:38 PDT 2018


miyuki created this revision.
miyuki added a reviewer: hfinkel.
Herald added subscribers: kristof.beyls, javed.absar.

The value tracking analysis uses function alignment to infer that the
least significant bits of function pointers are known to be zero.
Unfortunately, this is not correct for ARM targets: the least
significant bit of a function pointer stores the ARM/Thumb state
information (i.e., the LSB is set for Thumb functions and cleared for
ARM functions).

It is still desirable to be able to control the alignment of
functions' code (for example, aligning functions to cache line size
improves I-cache utilization), independently of function pointer
alignment.

This patch adds a new field to the DataLayout structure that stores
the ABI alignment of function pointers and uses it when querying the
alignment.


https://reviews.llvm.org/D44781

Files:
  docs/LangRef.rst
  include/llvm/IR/DataLayout.h
  lib/IR/DataLayout.cpp
  lib/IR/Value.cpp
  lib/Target/ARM/ARMTargetMachine.cpp
  test/Analysis/ValueTracking/func-ptr-lsb.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44781.139445.patch
Type: text/x-patch
Size: 4064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180322/742c3cb8/attachment.bin>


More information about the llvm-commits mailing list