[PATCH] D77560: [SCEV] don't try to query getSCEV() for incomplete PHIs

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 04:06:08 PDT 2020


lebedev.ri accepted this revision.
lebedev.ri added a comment.

I still think this should be solved on a different level, but LG i guess.



================
Comment at: llvm/include/llvm/IR/Instructions.h:2748
+  /// have incoming value in this PHI, return true, otherwise return false.
+  bool isComplete() const;
+
----------------
Can any code be cleaned up to use this?


================
Comment at: llvm/lib/IR/Instructions.cpp:163-174
+bool PHINode::isComplete() const {
+  const BasicBlock *BB = getParent();
+  assert(BB && "PHI node is not inside a basic block");
+  const_pred_iterator HPB = pred_begin(BB), HPE = pred_end(BB);
+  for (const_pred_iterator HPI = HPB; HPI != HPE; ++HPI) {
+    const BasicBlock *Pred = *HPI;
+    // If one predecessor has no incoming value, this phi is incomplete.
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77560



More information about the llvm-commits mailing list