diff options
author | Daniel Neilson <dneilson@azul.com> | 2018-02-12 22:39:47 +0000 |
---|---|---|
committer | Daniel Neilson <dneilson@azul.com> | 2018-02-12 22:39:47 +0000 |
commit | 095d72989d88467b674ec9282a28405a2aa4c729 (patch) | |
tree | 846a8bfb9f9d89f48e60dbaa4ad1ec7cbc6ee55e /llvm/lib/CodeGen/SafeStackLayout.h | |
parent | ebb0838f74f694a62957646463b6a650903adb97 (diff) | |
download | bcm5719-llvm-095d72989d88467b674ec9282a28405a2aa4c729.tar.gz bcm5719-llvm-095d72989d88467b674ec9282a28405a2aa4c729.zip |
[SafeStack] Use updated CreateMemCpy API to set more accurate source and destination alignments.
Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
creation of memcpys in the SafeStack pass to set the alignment of the destination object to
its stack alignment while separately setting the source byval arguments alignment to its
alignment.
Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. (rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626, rL324642, rL324653, rL324654, rL324773, rL324774,
rL324781, rL324784 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.
Reference
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html
Reviewers: eugenis, bollu
Reviewed By: eugenis
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42710
llvm-svn: 324955
Diffstat (limited to 'llvm/lib/CodeGen/SafeStackLayout.h')
-rw-r--r-- | llvm/lib/CodeGen/SafeStackLayout.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SafeStackLayout.h b/llvm/lib/CodeGen/SafeStackLayout.h index 7c1292f251f..ac531d800f6 100644 --- a/llvm/lib/CodeGen/SafeStackLayout.h +++ b/llvm/lib/CodeGen/SafeStackLayout.h @@ -47,6 +47,7 @@ class StackLayout { SmallVector<StackObject, 8> StackObjects; DenseMap<const Value *, unsigned> ObjectOffsets; + DenseMap<const Value *, unsigned> ObjectAlignments; void layoutObject(StackObject &Obj); @@ -64,6 +65,9 @@ public: /// Returns the offset to the object start in the stack frame. unsigned getObjectOffset(const Value *V) { return ObjectOffsets[V]; } + /// Returns the alignment of the object + unsigned getObjectAlignment(const Value *V) { return ObjectAlignments[V]; } + /// Returns the size of the entire frame. unsigned getFrameSize() { return Regions.empty() ? 0 : Regions.back().End; } |