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 {
426
426
// / the debug scope for newly created instructions.
427
427
const SILDebugScope *getScopeOfFirstNonMetaInstruction ();
428
428
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
+
429
435
// ===--------------------------------------------------------------------===//
430
436
// Debugging
431
437
// ===--------------------------------------------------------------------===//
Original file line number Diff line number Diff line change @@ -395,6 +395,15 @@ bool SILBasicBlock::isLegalToHoistInto() const {
395
395
return true ;
396
396
}
397
397
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
+
398
407
const SILDebugScope *SILBasicBlock::getScopeOfFirstNonMetaInstruction () {
399
408
for (auto &Inst : *this )
400
409
if (Inst.isMetaInstruction ())
You can’t perform that action at this time.
0 commit comments