aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-04-05 16:48:40 +0200
committerNikita Popov <npopov@redhat.com>2022-04-05 16:48:40 +0200
commit516333d632ea7fc9f328520ac46337b7494271d4 (patch)
treefaf9e3b989c12f41d4ce8bb8758e80e7d2c295ac /llvm/lib/Analysis/ValueTracking.cpp
parent4f4bffec123cbdfea111403b68226c0e6be5ea3c (diff)
downloadllvm-516333d632ea7fc9f328520ac46337b7494271d4.zip
llvm-516333d632ea7fc9f328520ac46337b7494271d4.tar.gz
llvm-516333d632ea7fc9f328520ac46337b7494271d4.tar.bz2
[ValueTracking] Handle non-pow2 align assume bundle (PR53693)
https://reviews.llvm.org/D119414 clarified that this is legal IR, so handle it gracefully. (We could aggressively use the fact that the pointer must be a null pointer in that case, but I'm not bothering with that.) Fixes https://github.com/llvm/llvm-project/issues/53693.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 67fe15f..75381f5 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -671,7 +671,8 @@ static void computeKnownBitsFromAssume(const Value *V, KnownBits &Known,
if (V->getType()->isPointerTy()) {
if (RetainedKnowledge RK = getKnowledgeValidInContext(
V, {Attribute::Alignment}, Q.CxtI, Q.DT, Q.AC)) {
- Known.Zero.setLowBits(Log2_64(RK.ArgValue));
+ if (isPowerOf2_64(RK.ArgValue))
+ Known.Zero.setLowBits(Log2_64(RK.ArgValue));
}
}