@@ -761,17 +761,18 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
761
761
762
762
// / Print out the users of the SILValue \p V. Return true if we printed out
763
763
// / either an id or a use list. Return false otherwise.
764
- bool printUsersOfSILNode (const SILNode *node, bool printedSlashes) {
764
+ bool printUsersOfValue (SILValue value, bool printedSlashes) {
765
+ return printUserList ({value}, value, printedSlashes);
766
+ }
767
+
768
+ bool printUsersOfInstruction (const SILInstruction *inst, bool printedSlashes) {
765
769
llvm::SmallVector<SILValue, 8 > values;
766
- if (auto *value = dyn_cast<ValueBase>(node)) {
767
- values.push_back (value);
768
- } else if (auto *inst = dyn_cast<SILInstruction>(node)) {
769
- assert (!isa<SingleValueInstruction>(inst) && " SingleValueInstruction was "
770
- " handled by the previous "
771
- " value base check." );
772
- llvm::copy (inst->getResults (), std::back_inserter (values));
773
- }
770
+ llvm::copy (inst->getResults (), std::back_inserter (values));
771
+ return printUserList (values, inst, printedSlashes);
772
+ }
774
773
774
+ bool printUserList (ArrayRef<SILValue> values, const SILNode *node,
775
+ bool printedSlashes) {
775
776
// If the set of values is empty, we need to print the ID of
776
777
// the instruction. Otherwise, if none of the values has a use,
777
778
// we don't need to do anything.
@@ -1011,7 +1012,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
1011
1012
printedSlashes = printTypeDependentOperands (I);
1012
1013
1013
1014
// Print users, or id for valueless instructions.
1014
- printedSlashes = printUsersOfSILNode (I, printedSlashes);
1015
+ printedSlashes = printUsersOfInstruction (I, printedSlashes);
1015
1016
1016
1017
// Print SIL location.
1017
1018
if (Ctx.printVerbose ()) {
@@ -1056,7 +1057,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
1056
1057
<< Ctx.getID (arg->getParent ()) << " : " << arg->getType ();
1057
1058
1058
1059
// Print users.
1059
- (void ) printUsersOfSILNode (arg, false );
1060
+ (void ) printUsersOfValue (arg, false );
1060
1061
1061
1062
*this << ' \n ' ;
1062
1063
}
@@ -1093,7 +1094,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
1093
1094
visit (static_cast <SILInstruction *>(nonConstParent));
1094
1095
1095
1096
// Print users.
1096
- (void )printUsersOfSILNode (result, false );
1097
+ (void )printUsersOfValue (result, false );
1097
1098
1098
1099
*this << ' \n ' ;
1099
1100
}
0 commit comments