aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Transforms/Utils/Local.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-25 20:37:57 +0000
committerChris Lattner <sabre@nondot.org>2010-12-25 20:37:57 +0000
commit687140c818ba4b896329a83324714140b6580ef8 (patch)
tree2ee1d92e57ae2cc947d35922b95fcebe638e4cf7 /include/llvm/Transforms/Utils/Local.h
parent43ee29d418c4df3dee00e77bec7030bc10cb837c (diff)
downloadexternal_llvm-687140c818ba4b896329a83324714140b6580ef8.zip
external_llvm-687140c818ba4b896329a83324714140b6580ef8.tar.gz
external_llvm-687140c818ba4b896329a83324714140b6580ef8.tar.bz2
Move getOrEnforceKnownAlignment out of instcombine into Transforms/Utils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/Local.h')
-rw-r--r--include/llvm/Transforms/Utils/Local.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index dc18f3c..26b5dd8 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -145,6 +145,18 @@ AllocaInst *DemoteRegToStack(Instruction &X,
/// The phi node is deleted and it returns the pointer to the alloca inserted.
AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = 0);
+/// 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 getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
+ const TargetData *TD = 0);
+
+/// getKnownAlignment - Try to infer an alignment for the specified pointer.
+static inline unsigned getKnownAlignment(Value *V, const TargetData *TD = 0) {
+ return getOrEnforceKnownAlignment(V, 0, TD);
+}
+
} // End llvm namespace
#endif