[PATCH] D37343: [CGP] Merge empty case blocks if no extra moves are added.
Balaram Makam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 14:34:49 PDT 2017
bmakam added inline comments.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:953
+ BB->removeFromParent();
+ if (BB->getParent() == DestBB->getParent() && BB != DestBB)
+ DT->deleteEdge(BB, DestBB);
----------------
bmakam wrote:
> efriedma wrote:
> > "BB->getParent() == DestBB->getParent()" still here. What is that trying to check for?
> err, I was trying to avoid hitting this assert from DT->deleteEdge:
> void llvm::DominatorTreeBase<llvm::BasicBlock, false>::deleteEdge(NodeT *, NodeT *) [NodeT = llvm::BasicBlock, IsPostDom = false]: Assertion `From->getParent() == Parent' failed.
>
> But looks like this code is unreachable, so I don't need to delete the edge BB, DestBB after BB->eraseFromParent()?
I think the right way to delete the edge is
1. BB->getTerminator()->eraseFromParent()
2. DT->deleteEdge(BB, DestBB)
3. BB->eraseFromParent()
This way I don't hit the assert and I can delete the edge in DT.
https://reviews.llvm.org/D37343
More information about the llvm-commits
mailing list