Skip to content

Commit 64962dc

Browse files
authored
Merge pull request #74419 from eeckstein/release-asserts
SIL: enable some SIL linkage related asserts in release builds
2 parents 17eef27 + 532535f commit 64962dc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/SIL/IR/Linker.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include "llvm/Support/Debug.h"
6060
#include "swift/AST/ProtocolConformance.h"
6161
#include "swift/AST/SubstitutionMap.h"
62+
#include "swift/Basic/Require.h"
6263
#include "swift/ClangImporter/ClangModule.h"
6364
#include "swift/SIL/FormalLinkage.h"
6465
#include "swift/Serialization/SerializedSILLoader.h"
@@ -101,9 +102,9 @@ void SILLinkerVisitor::deserializeAndPushToWorklist(SILFunction *F) {
101102
void SILLinkerVisitor::maybeAddFunctionToWorklist(
102103
SILFunction *F, SerializedKind_t callerSerializedKind) {
103104
SILLinkage linkage = F->getLinkage();
104-
assert((callerSerializedKind == IsNotSerialized ||
105-
F->hasValidLinkageForFragileRef(callerSerializedKind) ||
106-
hasSharedVisibility(linkage) || F->isExternForwardDeclaration()) &&
105+
require(callerSerializedKind == IsNotSerialized ||
106+
F->hasValidLinkageForFragileRef(callerSerializedKind) ||
107+
hasSharedVisibility(linkage) || F->isExternForwardDeclaration(),
107108
"called function has wrong linkage for serialized function");
108109
if (!F->isExternalDeclaration()) {
109110
// The function is already in the module, so no need to de-serialized it.

lib/SILOptimizer/Utils/PerformanceInlinerUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "swift/SILOptimizer/Analysis/BasicCalleeAnalysis.h"
1515
#include "swift/SILOptimizer/Utils/PerformanceInlinerUtils.h"
1616
#include "swift/AST/Module.h"
17+
#include "swift/Basic/Require.h"
1718
#include "swift/SILOptimizer/Utils/InstOptUtils.h"
1819
#include "llvm/Support/CommandLine.h"
1920

@@ -851,8 +852,8 @@ SILFunction *swift::getEligibleFunction(FullApplySite AI,
851852
!Callee->hasValidLinkageForFragileRef(Caller->getSerializedKind())) {
852853
llvm::errs() << "caller: " << Caller->getName() << "\n";
853854
llvm::errs() << "callee: " << Callee->getName() << "\n";
854-
llvm_unreachable("Should never be inlining a resilient function into "
855-
"a fragile function");
855+
require(false, "Should never be inlining a resilient function into "
856+
"a fragile function");
856857
}
857858
return nullptr;
858859
}

0 commit comments

Comments
 (0)