Skip to content

Commit e91b08b

Browse files
committed
[MemAccessUtils] Bailed when visitor bailed.
Previously, in GatherUniqueStorageUses::visiteUse, the results of calls to visit#### on the visitor were not used. Here, they are returned from the function.
1 parent 05da933 commit e91b08b

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

lib/SIL/Utils/MemAccessUtils.cpp

+12-25
Original file line numberDiff line numberDiff line change
@@ -1959,42 +1959,34 @@ bool GatherUniqueStorageUses::visitUse(Operand *use, AccessUseType useTy) {
19591959
case SILArgumentConvention::Indirect_Inout:
19601960
case SILArgumentConvention::Indirect_InoutAliasable:
19611961
case SILArgumentConvention::Indirect_Out:
1962-
visitor.visitStore(use);
1963-
break;
1962+
return visitor.visitStore(use);
19641963
case SILArgumentConvention::Indirect_In_Guaranteed:
19651964
case SILArgumentConvention::Indirect_In:
19661965
case SILArgumentConvention::Indirect_In_Constant:
1967-
visitor.visitLoad(use);
1968-
break;
1966+
return visitor.visitLoad(use);
19691967
case SILArgumentConvention::Direct_Unowned:
19701968
case SILArgumentConvention::Direct_Owned:
19711969
case SILArgumentConvention::Direct_Guaranteed:
19721970
// most likely an escape of a box
1973-
visitor.visitUnknownUse(use);
1974-
break;
1971+
return visitor.visitUnknownUse(use);
19751972
}
1976-
return true;
19771973
}
19781974
switch (user->getKind()) {
19791975
case SILInstructionKind::DestroyAddrInst:
19801976
case SILInstructionKind::DestroyValueInst:
19811977
if (useTy == AccessUseType::Exact) {
1982-
visitor.visitDestroy(use);
1983-
return true;
1978+
return visitor.visitDestroy(use);
19841979
}
1985-
visitor.visitUnknownUse(use);
1986-
return true;
1980+
return visitor.visitUnknownUse(use);
19871981

19881982
case SILInstructionKind::DebugValueInst:
1989-
visitor.visitDebugUse(use);
1990-
return true;
1983+
return visitor.visitDebugUse(use);
19911984

19921985
case SILInstructionKind::LoadInst:
19931986
case SILInstructionKind::LoadWeakInst:
19941987
case SILInstructionKind::LoadUnownedInst:
19951988
case SILInstructionKind::ExistentialMetatypeInst:
1996-
visitor.visitLoad(use);
1997-
return true;
1989+
return visitor.visitLoad(use);
19981990

19991991
case SILInstructionKind::StoreInst:
20001992
case SILInstructionKind::StoreWeakInst:
@@ -2006,27 +1998,22 @@ bool GatherUniqueStorageUses::visitUse(Operand *use, AccessUseType useTy) {
20061998
break;
20071999

20082000
case SILInstructionKind::InjectEnumAddrInst:
2009-
visitor.visitStore(use);
2010-
return true;
2001+
return visitor.visitStore(use);
20112002

20122003
case SILInstructionKind::CopyAddrInst:
20132004
if (operIdx == CopyLikeInstruction::Dest) {
2014-
visitor.visitStore(use);
2015-
return true;
2005+
return visitor.visitStore(use);
20162006
}
20172007
assert(operIdx == CopyLikeInstruction::Src);
2018-
visitor.visitLoad(use);
2019-
return true;
2008+
return visitor.visitLoad(use);
20202009

20212010
case SILInstructionKind::DeallocStackInst:
2022-
visitor.visitDealloc(use);
2023-
return true;
2011+
return visitor.visitDealloc(use);
20242012

20252013
default:
20262014
break;
20272015
}
2028-
visitor.visitUnknownUse(use);
2029-
return true;
2016+
return visitor.visitUnknownUse(use);
20302017
}
20312018

20322019
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)