[llvm] f247d2a - Revert "[NFCI][ValueTracking] getUnderlyingObject(): assert that no cycles are encountered"

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 02:06:40 PDT 2021


On Mon, Mar 15, 2021 at 10:01 AM Roman Lebedev via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

>
> Author: Roman Lebedev
> Date: 2021-03-15T12:00:59+03:00
> New Revision: f247d2ab9a427434c39b2be0aeac6b84b367b7bf
>
> URL:
> https://github.com/llvm/llvm-project/commit/f247d2ab9a427434c39b2be0aeac6b84b367b7bf
> DIFF:
> https://github.com/llvm/llvm-project/commit/f247d2ab9a427434c39b2be0aeac6b84b367b7bf.diff
>
> LOG: Revert "[NFCI][ValueTracking] getUnderlyingObject(): assert that no
> cycles are encountered"
>
> This reverts commit 36f1c3db66f7268ea3183bcf0bbf05b3e1c570b4.
> Seems to make bots unhappy.
>

getUnderlyingObject() relies on a limited maximum depth to avoid cycles. To
guarantee no infinite loops, drop the MaxLookup == 0 special case (not sure
if it's used anywhere).

Nikita


> Added:
>
>
> Modified:
>     llvm/lib/Analysis/ValueTracking.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/Analysis/ValueTracking.cpp
> b/llvm/lib/Analysis/ValueTracking.cpp
> index 8c44d73d4e33..79399cf058bd 100644
> --- a/llvm/lib/Analysis/ValueTracking.cpp
> +++ b/llvm/lib/Analysis/ValueTracking.cpp
> @@ -4165,11 +4165,7 @@ static bool isSameUnderlyingObjectInLoop(const
> PHINode *PN,
>  const Value *llvm::getUnderlyingObject(const Value *V, unsigned
> MaxLookup) {
>    if (!V->getType()->isPointerTy())
>      return V;
> -#ifndef NDEBUG
> -  SmallPtrSet<const Value *, 8> Visited;
> -#endif
>    for (unsigned Count = 0; MaxLookup == 0 || Count < MaxLookup; ++Count) {
> -    assert(Visited.insert(V).second && "Cycle detected. Unreachable
> code?");
>      if (auto *GEP = dyn_cast<GEPOperator>(V)) {
>        V = GEP->getPointerOperand();
>      } else if (Operator::getOpcode(V) == Instruction::BitCast ||
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210315/43fdf1a2/attachment.html>


More information about the llvm-commits mailing list