diff options
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/Loads.cpp | 7 | ||||
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp index 10a71de82e3..fda1395cf3e 100644 --- a/llvm/lib/Analysis/Loads.cpp +++ b/llvm/lib/Analysis/Loads.cpp @@ -107,11 +107,14 @@ static bool isDereferenceableAndAlignedPointer( return isDereferenceableAndAlignedPointer(ASC->getOperand(0), Align, Size, DL, CtxI, DT, Visited); - if (auto CS = ImmutableCallSite(V)) + if (auto CS = ImmutableCallSite(V)) { if (const Value *RV = CS.getReturnedArgOperand()) return isDereferenceableAndAlignedPointer(RV, Align, Size, DL, CtxI, DT, Visited); - + if (CS.getIntrinsicID() == Intrinsic::launder_invariant_group) + return isDereferenceableAndAlignedPointer(CS->getOperand(0), Align, Size, + DL, CtxI, DT, Visited); + } // If we don't know, assume the worst. return false; } diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 05246a28817..811c5016529 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1953,9 +1953,12 @@ bool isKnownNonZero(const Value *V, unsigned Depth, const Query &Q) { if (LI->getMetadata(LLVMContext::MD_nonnull)) return true; - if (auto CS = ImmutableCallSite(V)) + if (auto CS = ImmutableCallSite(V)) { if (CS.isReturnNonNull()) return true; + if (CS.getIntrinsicID() == Intrinsic::ID::launder_invariant_group) + return isKnownNonZero(CS->getOperand(0), Depth + 1, Q); + } } // The remaining tests are all recursive, so bail out if we hit the limit. |

