[PATCH] D46568: [SimplifyCFG] Fix a crash when folding PHIs

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 8 11:49:24 PDT 2018


vsk added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:155
     for (PHINode &PN : BB->phis())
-      if (PN.getIncomingValue(0) != &PN)
+      if (!isa<PHINode>(PN.getIncomingValue(0)))
         IncomingValues.push_back(PN.getIncomingValue(0));
----------------
Would it be safe/worthwhile to allow incoming values which are phi nodes from a block other than `BB`? These should not be invalidated by FoldSingleEntryPHINodes(). If the goal is to eliminate duplicate dbg.values for incoming values, then it might make sense.

Apologies if this is off-base, I'm not familiar with this code.


https://reviews.llvm.org/D46568





More information about the llvm-commits mailing list