Skip to content

Commit bdbfd7d

Browse files
authored
Merge pull request swiftlang#26834 from gottesmm/pr-6d2479f6816edc66f343c8a949dec2da0892b5d9
2 parents 34b7afe + e9e678a commit bdbfd7d

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

lib/SIL/OperandOwnership.cpp

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -106,40 +106,38 @@ class OperandOwnershipKindClassifier
106106

107107
} // end anonymous namespace
108108

109-
/// Implementation for instructions without operands. These should never be
110-
/// visited.
111-
#define NO_OPERAND_INST(INST) \
109+
/// Implementation for instructions that we should never visit since they are
110+
/// not valid in ossa or do not have operands. Since we should never visit
111+
/// these, we just assert.
112+
#define SHOULD_NEVER_VISIT_INST(INST) \
112113
OperandOwnershipKindMap OperandOwnershipKindClassifier::visit##INST##Inst( \
113114
INST##Inst *i) { \
114-
assert(i->getNumOperands() == 0 && \
115-
"Expected instruction without operands?!"); \
116-
llvm_unreachable("Instruction without operand can not be compatible with " \
117-
"any def's OwnershipValueKind"); \
115+
llvm_unreachable("Visited instruction that should never be visited?!"); \
118116
}
119-
NO_OPERAND_INST(AllocBox)
120-
NO_OPERAND_INST(AllocExistentialBox)
121-
NO_OPERAND_INST(AllocGlobal)
122-
NO_OPERAND_INST(AllocStack)
123-
NO_OPERAND_INST(FloatLiteral)
124-
NO_OPERAND_INST(FunctionRef)
125-
NO_OPERAND_INST(DynamicFunctionRef)
126-
NO_OPERAND_INST(PreviousDynamicFunctionRef)
127-
NO_OPERAND_INST(GlobalAddr)
128-
NO_OPERAND_INST(GlobalValue)
129-
NO_OPERAND_INST(IntegerLiteral)
130-
NO_OPERAND_INST(Metatype)
131-
NO_OPERAND_INST(ObjCProtocol)
132-
NO_OPERAND_INST(RetainValue)
133-
NO_OPERAND_INST(RetainValueAddr)
134-
NO_OPERAND_INST(StringLiteral)
135-
NO_OPERAND_INST(StrongRetain)
136-
NO_OPERAND_INST(Unreachable)
137-
NO_OPERAND_INST(Unwind)
117+
SHOULD_NEVER_VISIT_INST(AllocBox)
118+
SHOULD_NEVER_VISIT_INST(AllocExistentialBox)
119+
SHOULD_NEVER_VISIT_INST(AllocGlobal)
120+
SHOULD_NEVER_VISIT_INST(AllocStack)
121+
SHOULD_NEVER_VISIT_INST(FloatLiteral)
122+
SHOULD_NEVER_VISIT_INST(FunctionRef)
123+
SHOULD_NEVER_VISIT_INST(DynamicFunctionRef)
124+
SHOULD_NEVER_VISIT_INST(PreviousDynamicFunctionRef)
125+
SHOULD_NEVER_VISIT_INST(GlobalAddr)
126+
SHOULD_NEVER_VISIT_INST(GlobalValue)
127+
SHOULD_NEVER_VISIT_INST(IntegerLiteral)
128+
SHOULD_NEVER_VISIT_INST(Metatype)
129+
SHOULD_NEVER_VISIT_INST(ObjCProtocol)
130+
SHOULD_NEVER_VISIT_INST(RetainValue)
131+
SHOULD_NEVER_VISIT_INST(RetainValueAddr)
132+
SHOULD_NEVER_VISIT_INST(StringLiteral)
133+
SHOULD_NEVER_VISIT_INST(StrongRetain)
134+
SHOULD_NEVER_VISIT_INST(Unreachable)
135+
SHOULD_NEVER_VISIT_INST(Unwind)
138136
#define ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
139-
NO_OPERAND_INST(StrongRetain##Name) \
140-
NO_OPERAND_INST(Name##Retain)
137+
SHOULD_NEVER_VISIT_INST(StrongRetain##Name) \
138+
SHOULD_NEVER_VISIT_INST(Name##Retain)
141139
#include "swift/AST/ReferenceStorage.def"
142-
#undef NO_OPERAND_INST
140+
#undef SHOULD_NEVER_VISIT_INST
143141

144142
/// Instructions whose arguments are always compatible with one convention.
145143
#define CONSTANT_OWNERSHIP_INST(OWNERSHIP, USE_LIFETIME_CONSTRAINT, INST) \

0 commit comments

Comments
 (0)