Skip to content

Commit 84360d9

Browse files
authored
Merge pull request #34811 from gottesmm/pr-81ab56860285486f13f9c56ac738e128e170a9c7
[sil] Add a non-const version of SILPhiArgument *BranchInst::getArgForOperand(Operand *)
2 parents d8e7308 + 0f29b67 commit 84360d9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/swift/SIL/SILInstruction.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7686,10 +7686,16 @@ class BranchInst final
76867686
unsigned getNumArgs() const { return getAllOperands().size(); }
76877687
SILValue getArg(unsigned i) const { return getAllOperands()[i].get(); }
76887688

7689+
/// Return the SILPhiArgument for the given operand.
7690+
const SILPhiArgument *getArgForOperand(const Operand *oper) const {
7691+
auto *self = const_cast<BranchInst *>(this);
7692+
return self->getArgForOperand(oper);
7693+
}
7694+
76897695
/// Return the SILPhiArgument for the given operand.
76907696
///
76917697
/// See SILArgument.cpp.
7692-
const SILPhiArgument *getArgForOperand(const Operand *oper) const;
7698+
SILPhiArgument *getArgForOperand(const Operand *oper);
76937699
};
76947700

76957701
/// A conditional branch.

lib/SIL/IR/SILArgument.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ TermInst *SILPhiArgument::getSingleTerminator() const {
300300
return const_cast<SILBasicBlock *>(predBlock)->getTerminator();
301301
}
302302

303-
const SILPhiArgument *BranchInst::getArgForOperand(const Operand *oper) const {
303+
SILPhiArgument *BranchInst::getArgForOperand(const Operand *oper) {
304304
assert(oper->getUser() == this);
305305
return cast<SILPhiArgument>(
306306
getDestBB()->getArgument(oper->getOperandNumber()));

0 commit comments

Comments
 (0)