[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
Mon Jul 24 03:01:14 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGde7a7aa1106d: [NFC][ValueTracking]: Remove redundant computeKnownBits call for LoadInst in… (authored by 0xdc03).
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
@@ -2679,6 +2679,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 in isKnownNonZero.
+ return false;
case Instruction::Call:
if (auto *II = dyn_cast<IntrinsicInst>(I)) {
switch (II->getIntrinsicID()) {
@@ -2843,11 +2851,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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155958.543443.patch
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230724/45a4ddc0/attachment.bin>
More information about the llvm-commits
mailing list