File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -158,15 +158,13 @@ class Invariants {
158
158
// / Recursively walks the use-def chain starting at \p value and returns
159
159
// / true if all visited values are invariant.
160
160
bool isInvariantValue (SILValue value,
161
- SmallPtrSetImpl<SILNode *> &visited) const {
162
- SILNode *node = value->getRepresentativeSILNodeInObject ();
161
+ SmallPtrSetImpl<SILInstruction *> &visited) const {
162
+ if (SILInstruction *inst = value->getDefiningInstruction ()) {
163
+ // Avoid exponential complexity in case a value is used by multiple
164
+ // operands.
165
+ if (!visited.insert (inst).second )
166
+ return true ;
163
167
164
- // Avoid exponential complexity in case a value is used by multiple
165
- // operands.
166
- if (!visited.insert (node).second )
167
- return true ;
168
-
169
- if (auto *inst = dyn_cast<SILInstruction>(node)) {
170
168
if (!isMemoryInvariant () && inst->mayReadFromMemory ())
171
169
return false ;
172
170
@@ -228,7 +226,7 @@ class Invariants {
228
226
case TermKind::SwitchEnumInst:
229
227
case TermKind::CheckedCastBranchInst:
230
228
case TermKind::CheckedCastValueBranchInst: {
231
- SmallPtrSet<SILNode *, 16 > visited;
229
+ SmallPtrSet<SILInstruction *, 16 > visited;
232
230
return isInvariantValue (term->getOperand (0 ), visited);
233
231
}
234
232
default :
You can’t perform that action at this time.
0 commit comments