[PATCH] D24436: Fix misleading comment for getOrEnforceKnownAlignment
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 9 19:20:37 PDT 2016
arsenm updated this revision to Diff 70945.
arsenm added a comment.
Try to rephrase
https://reviews.llvm.org/D24436
Files:
include/llvm/Transforms/Utils/Local.h
lib/Transforms/Utils/Local.cpp
Index: lib/Transforms/Utils/Local.cpp
===================================================================
--- lib/Transforms/Utils/Local.cpp
+++ lib/Transforms/Utils/Local.cpp
@@ -1001,10 +1001,6 @@
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,
Index: include/llvm/Transforms/Utils/Local.h
===================================================================
--- include/llvm/Transforms/Utils/Local.h
+++ include/llvm/Transforms/Utils/Local.h
@@ -161,10 +161,13 @@
/// 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. 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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24436.70945.patch
Type: text/x-patch
Size: 2141 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160910/fc806416/attachment.bin>
More information about the llvm-commits
mailing list