aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorShimin Cui <scui@ca.ibm.com>2020-10-27 09:49:41 +0000
committerAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>2020-10-27 12:16:45 +0000
commit22e4346e054a4474a68fd293324db295fffed34c (patch)
tree45e7c1cd2726e2e813f5697d922eafc8249c3b3e /llvm/lib/Analysis/ValueTracking.cpp
parent673f2f702b03be8c003889cbb5923e111c3e24d0 (diff)
downloadllvm-22e4346e054a4474a68fd293324db295fffed34c.zip
llvm-22e4346e054a4474a68fd293324db295fffed34c.tar.gz
llvm-22e4346e054a4474a68fd293324db295fffed34c.tar.bz2
[ValueTracking] Add tracking of the alignment assume bundle
This patch is to add the support of the value tracking of the alignment assume bundle. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D88669
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 2364208..dc252a2 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -670,6 +670,14 @@ static void computeKnownBitsFromAssume(const Value *V, KnownBits &Known,
unsigned BitWidth = Known.getBitWidth();
+ // Refine Known set if the pointer alignment is set by assume bundles.
+ if (V->getType()->isPointerTy()) {
+ if (RetainedKnowledge RK = getKnowledgeValidInContext(
+ V, {Attribute::Alignment}, Q.CxtI, Q.DT, Q.AC)) {
+ Known.Zero.setLowBits(Log2_32(RK.ArgValue));
+ }
+ }
+
// Note that the patterns below need to be kept in sync with the code
// in AssumptionCache::updateAffectedValues.