[PATCH] D34823: [PredicateInfo] Invalidate an OrderedBasicBlock when instruction in it is deleted.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 13:18:09 PDT 2017


Why?  We don't use stale data and don't use either as an analysis so they
are destroyed no matter what.



On Thu, Jun 29, 2017, 11:18 AM Xin Tong via Phabricator <
reviews at reviews.llvm.org> wrote:

> trentxintong created this revision.
> Herald added a subscriber: Prazek.
>
> PredicateInfo uses OrderedBasicBlock and NewGVN which uses PredicateInfo
> should keep
> it updated and correct.
>
>
> https://reviews.llvm.org/D34823
>
> Files:
>   include/llvm/Transforms/Utils/PredicateInfo.h
>   lib/Transforms/Scalar/NewGVN.cpp
>
>
> Index: lib/Transforms/Scalar/NewGVN.cpp
> ===================================================================
> --- lib/Transforms/Scalar/NewGVN.cpp
> +++ lib/Transforms/Scalar/NewGVN.cpp
> @@ -3174,8 +3174,10 @@
>      if (!ToErase->use_empty())
>        ToErase->replaceAllUsesWith(UndefValue::get(ToErase->getType()));
>
> -    if (ToErase->getParent())
> +    if (ToErase->getParent()) {
> +      PredInfo->updateErasedInst(ToErase);
>        ToErase->eraseFromParent();
> +    }
>    }
>
>    // Delete all unreachable blocks.
> Index: include/llvm/Transforms/Utils/PredicateInfo.h
> ===================================================================
> --- include/llvm/Transforms/Utils/PredicateInfo.h
> +++ include/llvm/Transforms/Utils/PredicateInfo.h
> @@ -221,6 +221,13 @@
>      return PredicateMap.lookup(V);
>    }
>
> +  // Inform the PredicateInfo analysis when an instruction is deleted
> +  // in the function.
> +  void updateErasedInst(const Instruction *Inst) {
> +    // Need to invalidate the ordered basicblock for the instruction.
> +    OI.invalidateBlock(Inst->getParent());
> +  }
> +
>  protected:
>    // Used by PredicateInfo annotater, dumpers, and wrapper pass.
>    friend class PredicateInfoAnnotatedWriter;
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/6816601a/attachment.html>


More information about the llvm-commits mailing list