[PATCH] D37343: [CGP] Merge empty case blocks if no extra moves are added.

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 17:29:31 PDT 2017


kuhar added inline comments.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:954
   BB->eraseFromParent();
+  if (BB->getParent() == DestBB->getParent() && BB != DestBB)
+    DT->deleteEdge(BB, DestBB);
----------------
efriedma wrote:
> "BB->getParent() == DestBB->getParent()"?
> 
> Also, you can't use the pointer "BB" after you free it (so this needs to be before the eraseFromParent() call.)
@efriedma `deleteEdge` requires the edge to be actually deleted, so the right thing to do is:
```
1.  BB->removeFromParent()
2.  DT->deleteEdge(BB, DestBB)
3.  delete BB
```


https://reviews.llvm.org/D37343





More information about the llvm-commits mailing list