diff options
author | Nikita Popov <npopov@redhat.com> | 2023-06-23 13:08:46 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-06-23 13:11:28 +0200 |
commit | a68c9687556696522e0d3ee62857714250d58a93 (patch) | |
tree | 37469e525deac9d6a0a7284eb2fab553228e1e8b /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 63342ae4b8f7573fd03fdb6eb38d55097b9a6922 (diff) | |
download | llvm-a68c9687556696522e0d3ee62857714250d58a93.zip llvm-a68c9687556696522e0d3ee62857714250d58a93.tar.gz llvm-a68c9687556696522e0d3ee62857714250d58a93.tar.bz2 |
[ValueTracking] Correctly check addrspace of alloca
The DataLayout alloca address space is the address space that should
be used when creating new allocas. However, not all allocas are
required to be in this address space. The isKnownNonZero() check
should work on the actual address space of the alloca, not the
default alloca address space.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 66e810c..278bdd0 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2588,7 +2588,7 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts, unsigned Depth, if (PointerType *PtrTy = dyn_cast<PointerType>(V->getType())) { // Alloca never returns null, malloc might. - if (isa<AllocaInst>(V) && Q.DL.getAllocaAddrSpace() == 0) + if (isa<AllocaInst>(V) && PtrTy->getAddressSpace() == 0) return true; // A byval, inalloca may not be null in a non-default addres space. A |