[PATCH] D83284: [InstCombine] Improve select -> phi canonicalization: consider more blocks
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 11:35:45 PDT 2020
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2518
+ if (auto *PN = foldSelectToPhiImpl(Sel, I->getParent(), DT, Builder))
+ return PN;
+
----------------
It seems quite likely that some of the parents (or all of them) are going to be the same. Might it make sense to deduplicate?
```
// Collect likely candidates for placing the phi node.
SmallPtrSet<BasicBlock *, 4> CandidateBlocks;
CandidateBlocks.insert(Sel.getParent();
for (Value *V : Sel.operands())
if (auto *I = dyn_cast<Instruction>(V))
CandidateBlocks.insert(I->getParent());
for (BasicBlock *BB : CandidateBlocks)
if (auto *PN = foldSelectToPhiImpl(Sel, BB, DT, Builder))
return PN;
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83284/new/
https://reviews.llvm.org/D83284
More information about the llvm-commits
mailing list