[PATCH] D82005: [InstCombine] Replace selects with Phis
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 20 03:08:42 PDT 2020
nikic added a comment.
Some more test cases I would suggest:
- An incoming multi-edge (same predecessor occurring multiple times) from a switch.
- A select operand coming from the terminator of a predecessor block, e.g. an invoke result.
- A select with a very obviously non-dominating input. All the existing examples look "salvageable" in some way (via phi translation or hoisting).
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2466
+ m_Br(m_Not(m_Specific(Cond)), m_BasicBlock(TrueSucc),
+ m_BasicBlock(FalseSucc)))) {
+ IfTrue = Sel.getFalseValue();
----------------
This looks like dead code, as we canonicalize branch of not by swapping successors. Might change with D81089, but for now it should be fine to just drop it.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2494
+ PN->addIncoming(Inputs[Pred], Pred);
+ }
+ PN->takeName(&Sel);
----------------
Nit: Unnecessary braces.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82005/new/
https://reviews.llvm.org/D82005
More information about the llvm-commits
mailing list