[PATCH] D75396: [ValueTracking] A value is never undef or poison if it must raise UB
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 20:12:22 PST 2020
aqjune created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
This patch helps isGuaranteedNotToBeUndefOrPoison return true if the value
makes the program always undefined.
According to value tracking functions' comments, it is not still in consensus
whether a poison value can be bitwise or not, so conservatively only the case with
i1 is considered.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75396
Files:
llvm/lib/Analysis/ValueTracking.cpp
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -4551,6 +4551,13 @@
return true;
}
+ if (auto I = dyn_cast<Instruction>(V)) {
+ if (programUndefinedIfFullPoison(I) && I->getType()->isIntegerTy(1))
+ // Note: once we have an agreement that poison is a value-wise concept,
+ // we can remove the isIntegerTy(1) constraint.
+ return true;
+ }
+
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75396.247403.patch
Type: text/x-patch
Size: 542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200229/2cf5d03f/attachment.bin>
More information about the llvm-commits
mailing list