Skip to content

Commit 19742ba

Browse files
authored
Merge pull request #62434 from eeckstein/fix-mandatory-inliner
Fix a crash in the mandatory inliner related to optimization remarks
2 parents 3ca4a6e + 97d17a5 commit 19742ba

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/SIL/Utils/OptimizationRemark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static bool hasForceEmitSemanticAttr(SILFunction &fn, StringRef passName) {
136136
}
137137

138138
static bool isMethodWithForceEmitSemanticAttrNominalType(SILFunction &fn) {
139-
if (!fn.hasSelfParam())
139+
if (!fn.hasSelfParam() || fn.getArguments().empty())
140140
return false;
141141

142142
auto selfType = fn.getSelfArgument()->getType();

test/SILOptimizer/performance-annotations.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,8 @@ func closueWhichModifiesLocalVar() -> Int {
223223
return x
224224
}
225225

226+
@_noAllocation
227+
func createEmptyArray() {
228+
_ = [Int]() // expected-error {{ending the lifetime of a value of type}}
229+
}
230+

0 commit comments

Comments
 (0)