File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,12 @@ public SwiftObjectHeader {
426426 // / the debug scope for newly created instructions.
427427 const SILDebugScope *getScopeOfFirstNonMetaInstruction ();
428428
429+ // / Whether the block has any phi arguments.
430+ // /
431+ // / Note that a block could have an argument and still return false. The
432+ // / argument must also satisfy SILPhiArgument::isPhiArgument.
433+ bool hasPhi () const ;
434+
429435 // ===--------------------------------------------------------------------===//
430436 // Debugging
431437 // ===--------------------------------------------------------------------===//
Original file line number Diff line number Diff line change @@ -395,6 +395,15 @@ bool SILBasicBlock::isLegalToHoistInto() const {
395395 return true ;
396396}
397397
398+ bool SILBasicBlock::hasPhi () const {
399+ if (getArguments ().size () == 0 )
400+ return false ;
401+ // It is sufficient to check whether the first argument is a phi. A block
402+ // can't have both phis and terminator results.
403+ auto *argument = getArguments ()[0 ];
404+ return argument->isPhiArgument ();
405+ }
406+
398407const SILDebugScope *SILBasicBlock::getScopeOfFirstNonMetaInstruction () {
399408 for (auto &Inst : *this )
400409 if (Inst.isMetaInstruction ())
You can’t perform that action at this time.
0 commit comments