[PATCH] D52232: [IPSCCP] Fix a problem with removing labels in a switch with undef condition

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 04:07:36 PDT 2018


bjope marked 4 inline comments as done.
bjope added inline comments.


================
Comment at: lib/Transforms/Scalar/SCCP.cpp:2020
 
-        bool Folded = ConstantFoldTerminator(I->getParent());
+        bool Folded = ConstantFoldTerminator(I->getParent(),
+                                             false, nullptr, nullptr,
----------------
efriedma wrote:
> Maybe it would be more straightforward here to figure out the valid successor using isEdgeFeasible(), and explicitly emit the unconditional branch we want, instead of calling ConstantFoldTerminator.
> 
> I mean, the patch works as-is, but adding more flags to commonly used APIs like ConstantFoldTerminator makes them more difficult to understand.
I got rid of the changes to ConstantFoldTerminator by always forcing the edge for the indeteminate case before calling ConstantFoldTerminator. Maybe not exactly what you meant by using isEdgeFeasible(), but it makes it possible to still reuse ConstantFoldTerminator for rewriting the terminator into an unconditional branch.


Repository:
  rL LLVM

https://reviews.llvm.org/D52232





More information about the llvm-commits mailing list