[PATCH] D77560: [SCEV] don't try to query getSCEV() for incomplete PHIs
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 31 23:35:48 PDT 2020
shchenz added inline comments.
================
Comment at: llvm/include/llvm/IR/Instructions.h:2748
+ /// have incoming value in this PHI, return true, otherwise return false.
+ bool isComplete() const;
+
----------------
lebedev.ri wrote:
> Can any code be cleaned up to use this?
Had a look at the code for `getBasicBlockIndex`, did not find a suitable user.
================
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.
----------------
lebedev.ri wrote:
>
Like this refactor
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