[PATCH] D82072: [InstCombine] Combine select & Phi by same condition

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 20:05:55 PDT 2020


mkazantsev marked an inline comment as done.
mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2486
     if (auto *Insn = dyn_cast<Instruction>(Inputs[Pred]))
       if (!DT.dominates(Insn, Pred->getTerminator()))
         return nullptr;
----------------
nikic wrote:
> nikic wrote:
> > We should add `&& Insn != Pred->getTerminator()` here to make the `@test_invoke_2_neg` test case work. What we really want to express is that `DT.dominates(Insn, Incoming)`, but as there is no `dominates(Instruction *, BasicBlockEdge)` API, this would be the closest replacement. (We could also add that API of course).
> Actually, let's leave this to a separate patch. We should really do this via a DominatorTree API that can distinguish normal&unwind edges properly.
This can be just `properlyDominates`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82072/new/

https://reviews.llvm.org/D82072





More information about the llvm-commits mailing list