[PATCH] D156141: [NFC][ValueTracking]: Move some code from isKnownNonZero to isKnownNonZeroFromOperator
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 25 01:13:04 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2459-2461
+ if (PointerType *PtrTy = dyn_cast<PointerType>(I->getType());
+ PtrTy && PtrTy->getAddressSpace() == 0)
+ return true;
----------------
Alloca always returns a pointer.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2696
return false;
case Instruction::Call:
+ if (const auto *Call = dyn_cast<CallBase>(I)) {
----------------
Should add `case Instruction::Invoke:` here as well.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2697
case Instruction::Call:
+ if (const auto *Call = dyn_cast<CallBase>(I)) {
+ if (Call->isReturnNonNull())
----------------
Can be `cast<>`. We should probably also guard this against `I->getType()->isPointerTy()`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156141/new/
https://reviews.llvm.org/D156141
More information about the llvm-commits
mailing list