[PATCH] D94433: [ValueTracking] Check that alignment is non-zero in computeKnownBitsFromAssume (PR48713).
Ryan Mansfield via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 11 10:36:58 PST 2021
rmansfield created this revision.
rmansfield added a reviewer: spatel.
Herald added a subscriber: hiraditya.
rmansfield requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94433
Files:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Analysis/ValueTracking/pr48713.ll
Index: llvm/test/Analysis/ValueTracking/pr48713.ll
===================================================================
--- /dev/null
+++ llvm/test/Analysis/ValueTracking/pr48713.ll
@@ -0,0 +1,11 @@
+; RUN: opt -instsimplify < %s
+
+define i8* @PR48713() {
+ %call = call i8* @PR48713()
+ call void @llvm.assume(i1 true) [ "align"(i8* %call, i64 0) ]
+ %cmp = icmp eq i8* %call, null
+ %conv = zext i1 %cmp to i32
+ ret i8* null
+}
+
+declare void @llvm.assume(i1 noundef)
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -666,7 +666,8 @@
if (V->getType()->isPointerTy()) {
if (RetainedKnowledge RK = getKnowledgeValidInContext(
V, {Attribute::Alignment}, Q.CxtI, Q.DT, Q.AC)) {
- Known.Zero.setLowBits(Log2_32(RK.ArgValue));
+ if (RK.ArgValue)
+ Known.Zero.setLowBits(Log2_32(RK.ArgValue));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94433.315858.patch
Type: text/x-patch
Size: 993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210111/51dce8a6/attachment.bin>
More information about the llvm-commits
mailing list