@@ -181,6 +181,10 @@ class SILArgument : public ValueBase {
181181 // / terminator has a single operand, return that terminator.
182182 TermInst *getSingleTerminator () const ;
183183
184+ // / Return the terminator instruction for which this argument is a result,
185+ // / otherwise return nullptr.
186+ TermInst *getTerminatorForResultArg () const ;
187+
184188 // / Return the SILArgumentKind of this argument.
185189 SILArgumentKind getKind () const {
186190 return SILArgumentKind (ValueBase::getKind ());
@@ -289,9 +293,9 @@ class SILPhiArgument : public SILArgument {
289293 // / terminator has a single operand, return that terminator.
290294 TermInst *getSingleTerminator () const ;
291295
292- // / Return the terminator instruction of which this argument is a result or
293- // / nullptr.
294- TermInst *getTransformingTerminator () const ;
296+ // / Return the terminator instruction for which this argument is a result,
297+ // / otherwise return nullptr.
298+ TermInst *getTerminatorForResultArg () const ;
295299
296300 static bool classof (const SILInstruction *) = delete;
297301 static bool classof (const SILUndef *) = delete;
@@ -437,6 +441,16 @@ inline TermInst *SILArgument::getSingleTerminator() const {
437441 llvm_unreachable (" Covered switch is not covered?!" );
438442}
439443
444+ inline TermInst *SILArgument::getTerminatorForResultArg () const {
445+ switch (getKind ()) {
446+ case SILArgumentKind::SILPhiArgument:
447+ return cast<SILPhiArgument>(this )->getTerminatorForResultArg ();
448+ case SILArgumentKind::SILFunctionArgument:
449+ return nullptr ;
450+ }
451+ llvm_unreachable (" Covered switch is not covered?!" );
452+ }
453+
440454inline bool SILArgument::getIncomingPhiOperands (
441455 SmallVectorImpl<Operand *> &returnedPhiOperands) const {
442456 switch (getKind ()) {
0 commit comments