Skip to content

Commit 8a6f22a

Browse files
committed
Revert "[InstCombine] Don't use getFirstNonPHI in FoldIntegerTypedPHI"
This reverts commit 5214dbb. This does not fix the compile-time issue that we initially saw. Reverting this commit in order to revert the initial commit. rdar://58878122
1 parent 8762dfa commit 8a6f22a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,13 @@ Instruction *InstCombiner::FoldIntegerTypedPHI(PHINode &PN) {
180180
"Not enough available ptr typed incoming values");
181181
PHINode *MatchingPtrPHI = nullptr;
182182
unsigned NumPhis = 0;
183-
for (auto II = BB->begin(); II != BB->end(); II++, NumPhis++) {
183+
for (auto II = BB->begin(), EI = BasicBlock::iterator(BB->getFirstNonPHI());
184+
II != EI; II++, NumPhis++) {
184185
// FIXME: consider handling this in AggressiveInstCombine
185-
PHINode *PtrPHI = dyn_cast<PHINode>(II);
186-
if (!PtrPHI)
187-
break;
188186
if (NumPhis > MaxNumPhis)
189187
return nullptr;
190-
if (PtrPHI == &PN || PtrPHI->getType() != IntToPtr->getType())
188+
PHINode *PtrPHI = dyn_cast<PHINode>(II);
189+
if (!PtrPHI || PtrPHI == &PN || PtrPHI->getType() != IntToPtr->getType())
191190
continue;
192191
MatchingPtrPHI = PtrPHI;
193192
for (unsigned i = 0; i != PtrPHI->getNumIncomingValues(); ++i) {

0 commit comments

Comments
 (0)