[PATCH] D132542: [InstCombine] Use dyn_cast instead of cast in visitPHINode
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 24 14:49:51 PDT 2022
craig.topper added a comment.
In D132542#3747321 <https://reviews.llvm.org/D132542#3747321>, @hiraditya wrote:
> My understanding is that a basic block with a PHI node should have first instruction as PHI
That understanding matches the IR verifier
void Verifier::visitPHINode(PHINode &PN) {
// Ensure that the PHI nodes are all grouped together at the top of the block.
// This can be tested by checking whether the instruction before this is
// either nonexistent (because this is begin()) or is a PHI node. If not,
// then there is some other instruction before a PHI.
Check(&PN == &PN.getParent()->front() ||
isa<PHINode>(--BasicBlock::iterator(&PN)),
"PHI nodes not grouped at top of basic block!", &PN, PN.getParent());
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132542/new/
https://reviews.llvm.org/D132542
More information about the llvm-commits
mailing list