Skip to content

Commit 5d9802f

Browse files
committed
[ODL] Handle builtins.
No update is needed for the values they produce. This pass should really be refactored not to crash on instructions that aren't explicitly listed or at least not to compile if not every instruction is listed. rdar://133779160
1 parent 07b697e commit 5d9802f

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyWrappedTypeEliminator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ struct SILMoveOnlyWrappedTypeEliminatorVisitor
208208
NO_UPDATE_NEEDED(FixLifetime)
209209
NO_UPDATE_NEEDED(AddressToPointer)
210210
NO_UPDATE_NEEDED(ExistentialMetatype)
211+
NO_UPDATE_NEEDED(Builtin)
211212
#undef NO_UPDATE_NEEDED
212213

213214
bool eliminateIdentityCast(SingleValueInstruction *svi) {

test/SILOptimizer/moveonly_type_eliminator.sil

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class Klass {
2929
func foo()
3030
}
3131

32+
class C {}
33+
3234
struct KlassPair {
3335
var lhs: Klass
3436
var rhs: Klass
@@ -613,3 +615,15 @@ bb0(%x : @guaranteed $any Error):
613615
debug_value %em : $@thick any Error.Type, var, name "s", argno 1, expr op_deref
614616
return %em : $@thick any Error.Type
615617
}
618+
619+
// CHECK-LABEL: sil [ossa] @builtin_tsanInoutAccess : {{.*}} {
620+
// CHECK: builtin "tsanInoutAccess"
621+
// CHECK-LABEL: } // end sil function 'builtin_tsanInoutAccess'
622+
sil [ossa] @builtin_tsanInoutAccess : $@convention(thin) () -> () {
623+
bb0:
624+
%1 = alloc_stack $@moveOnly C, var, name "b", type $@moveOnly C
625+
%6 = builtin "tsanInoutAccess"(%1 : $*@moveOnly C) : $()
626+
dealloc_stack %1 : $*@moveOnly C
627+
%13 = tuple ()
628+
return %13 : $()
629+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-build-swift %s -sanitize=thread
2+
3+
// REQUIRES: tsan_runtime
4+
5+
class C {}
6+
func passC(_ b: consuming C) {
7+
mutateC(&b)
8+
}
9+
func mutateC(_ b: inout C) {}

0 commit comments

Comments
 (0)