[PATCH] D155958: [NFC][ValueTracking]: Remove redundant computeKnownBits call for LoadInst in isKnownNonZero
Dhruv Chawla via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 08:10:53 PDT 2023
0xdc03 updated this revision to Diff 542924.
0xdc03 added a comment.
- Address reviewer comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155958/new/
https://reviews.llvm.org/D155958
Files:
llvm/lib/Analysis/ValueTracking.cpp
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -2543,11 +2543,6 @@
return true;
}
- // A Load tagged with nonnull metadata is never null.
- if (const LoadInst *LI = dyn_cast<LoadInst>(V))
- if (Q.IIQ.getMetadata(LI, LLVMContext::MD_nonnull))
- return true;
-
if (const auto *Call = dyn_cast<CallBase>(V)) {
if (Call->isReturnNonNull())
return true;
@@ -2791,6 +2786,14 @@
return isKnownNonZero(I->getOperand(0), Depth, Q) &&
isGuaranteedNotToBePoison(I->getOperand(0), Q.AC, Q.CxtI, Q.DT,
Depth);
+ case Instruction::Load:
+ // A Load tagged with nonnull metadata is never null.
+ if (Q.IIQ.getMetadata(cast<LoadInst>(I), LLVMContext::MD_nonnull))
+ return true;
+
+ // No need to fall through to computeKnownBits as range metadata is already
+ // handled above.
+ return false;
case Instruction::Call:
if (auto *II = dyn_cast<IntrinsicInst>(I)) {
switch (II->getIntrinsicID()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155958.542924.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230721/f27b3b18/attachment.bin>
More information about the llvm-commits
mailing list