[PATCH] D75500: StructurizeCFG: simplify phi nodes when possible

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 09:00:27 PST 2020


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:660
     Q.DT = DT;
-    for (size_t i = 0; i < InsertedPhis.size(); ++i) {
-      PHINode *Phi = InsertedPhis[i];
+    for (auto I : AffectedPhis) {
+      auto Phi = dyn_cast_or_null<PHINode>(I);
----------------
sameerds wrote:
> arsenm wrote:
> > I think auto hurts readability here
> Why is that? The next line immediately makes it clear that we are only instead if the "whatever I" is a PHINode. Also in general, how is this any different from say "for (auto BB : *F) { ... }" or "for (auto II : *BB) { ... }"?
It's not, since it needs to be casted, and it's not even a normal Value, it's a WeakVH


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75500/new/

https://reviews.llvm.org/D75500





More information about the llvm-commits mailing list