[PATCH] D34135: [LVI] Add initial result to avoid infinite getValueFromCondition recursion

Brian Rzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 08:06:00 PST 2018


brzycki added a comment.

In https://reviews.llvm.org/D34135#976805, @uabelho wrote:

>




> Can we replace the "trivially dead" checks
>  pred_empty(BB)
>  in JumpThreadingPass::ProcessBlock and JumpThreadingPass::runImpl with
>  !DT->isReachableFromEntry(BB)

Hi @uabelho, in order to actually use the DT you have to perform a flush on DDT like so:

  DominatorTree *DT = DDT->flush();
  !DT->isReachableFromEntry(BB);
  ...

This flush() call should only happen when you're absolutely sure you need the DT because it's potentially expensive. But the whole point of the deferred nature is to flush when you need it, and in this case you need it.

> and problem is solved?
>  Do we need something more to preserve DT while JumpThreading is running so we can use it? Hopefully something that isn't very costly?
>  If someone explains how it can be used I'll try to find the time to update the patch.

I haven't tested flushing() in arbitrary locations in the code. It should just work but it might cause an assert inside DT. If you see one let me know, I'd be interested to understand why.


https://reviews.llvm.org/D34135





More information about the llvm-commits mailing list