Skip to content

Commit 0f29b67

Browse files
committed
[sil] Add a non-const version of SILPhiArgument *BranchInst::getArgForOperand(Operand *)
1 parent 5ea3bb2 commit 0f29b67

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
@@ -7580,10 +7580,16 @@ class BranchInst final
75807580
unsigned getNumArgs() const { return getAllOperands().size(); }
75817581
SILValue getArg(unsigned i) const { return getAllOperands()[i].get(); }
75827582

7583+
/// Return the SILPhiArgument for the given operand.
7584+
const SILPhiArgument *getArgForOperand(const Operand *oper) const {
7585+
auto *self = const_cast<BranchInst *>(this);
7586+
return self->getArgForOperand(oper);
7587+
}
7588+
75837589
/// Return the SILPhiArgument for the given operand.
75847590
///
75857591
/// See SILArgument.cpp.
7586-
const SILPhiArgument *getArgForOperand(const Operand *oper) const;
7592+
SILPhiArgument *getArgForOperand(const Operand *oper);
75877593
};
75887594

75897595
/// 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)