| // RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil %s -emit-ir | %FileCheck %s |
| |
| sil_stage canonical |
| |
| import Builtin |
| import Swift |
| |
| var g: Int |
| |
| public func inoutAccess() |
| |
| sil_global hidden @_T020tsan_instrumentation1gSiv : $Int |
| |
| // CHECK: @_T020tsan_instrumentation1gSiv = hidden global [[GLOBAL:%.*]] zeroinitializer, align {{.*}} |
| |
| // The inout access builtin is currently turned into a call to the __tsan_write1 |
| // compiler-rt instrumentation. Eventually we will add a specific |
| // instrumentation callback for tsan inout accesses to compiler-rt. |
| |
| // CHECK-LABEL: define{{( protected)?}} swiftcc void @_T020tsan_instrumentation11inoutAccessyyF() |
| // foo() -> () |
| sil @_T020tsan_instrumentation11inoutAccessyyF : $@convention(thin) () -> () { |
| bb0: |
| %0 = global_addr @_T020tsan_instrumentation1gSiv : $*Int |
| %1 = builtin "tsanInoutAccess"(%0 : $*Int) : $() |
| // CHECK: call void @__tsan_write1(i8* bitcast ([[GLOBAL]]* @_T020tsan_instrumentation1gSiv to i8*)) |
| |
| %2 = tuple () |
| return %2 : $() |
| // CHECK: ret void |
| } |