diff options
author | Manman Ren <mren@apple.com> | 2013-03-18 21:23:25 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2013-03-18 21:23:25 +0000 |
commit | 90842427b2f6ab5c0aab6049fd9177033101847f (patch) | |
tree | 5510ceb24e7918b1f8246563252070b11f3473cf /lib/Analysis | |
parent | 02fec34de127d23987352b90bf095ad3fac75fb9 (diff) | |
download | external_llvm-90842427b2f6ab5c0aab6049fd9177033101847f.zip external_llvm-90842427b2f6ab5c0aab6049fd9177033101847f.tar.gz external_llvm-90842427b2f6ab5c0aab6049fd9177033101847f.tar.bz2 |
Check whether a pointer is non-null (isKnownNonNull) in isKnownNonZero.
This handles the case where we have an inbounds GEP with alloca as the pointer.
This fixes the regression in PR12750 and rdar://13286434.
Note that we can also fix this by handling some GEP cases in isKnownNonNull.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/ValueTracking.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 45b75df..45dcc5e 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -953,6 +953,8 @@ bool llvm::isKnownNonZero(Value *V, const DataLayout *TD, unsigned Depth) { // Check for pointer simplifications. if (V->getType()->isPointerTy()) { + if (isKnownNonNull(V)) + return true; if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) if (isGEPKnownNonNull(GEP, TD, Depth)) return true; |