[PATCH] D98082: [gvn] Precisely propagate equalities to phi operands
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 6 00:56:38 PST 2021
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:2709
+ UseBB = UserInst->getParent();
+ return DT.properlyDominates(BB, UseBB);
};
----------------
I'd suggest to write it like this:
```
Instruction *UserInst = cast<Instruction>(U.getUser());
if (auto *PN = dyn_cast<PHINode>(UserInst))
return DT.dominates(BB, PN->getIncomingBlock());
else
return DT.properlyDominates(BB, UserInst->getParent());
```
Though ideally this should be an API on DominatorTree. We currently have `dominates(BasicBlockEdge, Use)`, but we're missing the `dominates(BasicBlock, Use)` variant.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98082/new/
https://reviews.llvm.org/D98082
More information about the llvm-commits
mailing list