File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 16
16
// /
17
17
// / We perform the following canonicalizations:
18
18
// /
19
- // / 1. We remove calls to Builtin.staticReport(), which are not needed post SIL.
19
+ // / 1. We remove calls to Builtin.poundAssert() and Builtin.staticReport(),
20
+ // / which are not needed post SIL.
20
21
// /
21
22
// ===----------------------------------------------------------------------===//
22
23
@@ -41,14 +42,15 @@ static bool cleanFunction(SILFunction &fn) {
41
42
SILInstruction *inst = &*i;
42
43
++i;
43
44
44
- // Remove calls to Builtin.staticReport().
45
+ // Remove calls to Builtin.staticReport() and Builtin.staticReport() .
45
46
auto *bi = dyn_cast<BuiltinInst>(inst);
46
47
if (!bi) {
47
48
continue ;
48
49
}
49
50
50
51
const BuiltinInfo &bInfo = bi->getBuiltinInfo ();
51
- if (bInfo.ID != BuiltinValueKind::StaticReport) {
52
+ if (bInfo.ID != BuiltinValueKind::PoundAssert &&
53
+ bInfo.ID != BuiltinValueKind::StaticReport) {
52
54
continue ;
53
55
}
54
56
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -enable-experimental-static-assert -emit-silgen %s | %target-sil-opt -irgen-prepare | %FileCheck %s
2
+
3
+ // Tests that mandatory SIL passes remove the builtin poundAssert instruction.
4
+ // CHECK-LABEL: pound_assert_removed14builtinRemoved
5
+ public func builtinRemoved( ) {
6
+ #assert( true )
7
+ // CHECK-NOT: builtin "poundAssert"
8
+ }
You can’t perform that action at this time.
0 commit comments