diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-09-13 16:39:43 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-09-13 16:39:43 +0000 |
| commit | 30bccade0b2d249a1ab0faa3f4767b263513135c (patch) | |
| tree | a72711f7dae3b11fd852e9ee8379300116cccd8f | |
| parent | 812072c244540e1243b9313f222a37df903483be (diff) | |
| download | bcm5719-llvm-30bccade0b2d249a1ab0faa3f4767b263513135c.tar.gz bcm5719-llvm-30bccade0b2d249a1ab0faa3f4767b263513135c.zip | |
Fix misleading comment for getOrEnforceKnownAlignment
It does not return 0 to indicate failure, and returns the known
alignment.
llvm-svn: 281350
| -rw-r--r-- | llvm/include/llvm/Transforms/Utils/Local.h | 13 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h index b6f9e7f5735..9267b10c0ab 100644 --- a/llvm/include/llvm/Transforms/Utils/Local.h +++ b/llvm/include/llvm/Transforms/Utils/Local.h @@ -161,10 +161,15 @@ AllocaInst *DemoteRegToStack(Instruction &X, /// deleted and it returns the pointer to the alloca inserted. AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = nullptr); -/// If the specified pointer has an alignment that we can determine, return it, -/// otherwise return 0. If PrefAlign is specified, and it is more than the -/// alignment of the ultimate object, see if we can increase the alignment of -/// the ultimate object, making this check succeed. +/// Try to ensure that the alignment of \p V is at least \p PrefAlign bytes. If +/// the owning object can be modified and has an alignment less than \p +/// PrefAlign, it will be increased and \p PrefAlign returned. If the alignment +/// cannot be increased, the known alignment of the value is returned. +/// +/// It is not always possible to modify the alignment of the underlying object, +/// so if alignment is important, a more reliable approach is to simply align +/// all global variables and allocation instructions to their preferred +/// alignment from the beginning. unsigned getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign, const DataLayout &DL, const Instruction *CxtI = nullptr, diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 87524e660f0..c1ef655be4b 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1001,10 +1001,6 @@ static unsigned enforceKnownAlignment(Value *V, unsigned Align, return Align; } -/// getOrEnforceKnownAlignment - If the specified pointer has an alignment that -/// we can determine, return it, otherwise return 0. If PrefAlign is specified, -/// and it is more than the alignment of the ultimate object, see if we can -/// increase the alignment of the ultimate object, making this check succeed. unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign, const DataLayout &DL, const Instruction *CxtI, |

