diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2729,6 +2729,9 @@ return true; if (const auto *RP = getArgumentAliasingToReturnedPointer(Call, true)) return isKnownNonZero(RP, Depth, Q); + } else if (const Value *RV = cast(I)->getReturnedArgOperand()) { + if (isKnownNonZero(RV, Depth, Q)) + return true; } if (auto *II = dyn_cast(I)) { @@ -2791,8 +2794,10 @@ default: break; } + break; } - break; + + return false; } KnownBits Known(BitWidth);