Skip to content

Commit da9630a

Browse files
committed
[test] Fix TBI test for SE-0055 (optional pointers).
(TBI = "top byte ignore")
1 parent 066f285 commit da9630a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/Misc/tbi.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
// RUN: %target-build-swift -target arm64-apple-ios8.0 -target-cpu cyclone \
2-
// RUN: -O -S %s -parse-as-library | \
2+
// RUN: -O -S %s -parse-as-library -parse-stdlib | \
33
// RUN: FileCheck --check-prefix=TBI %s
44

55
// RUN: %target-build-swift -target arm64-apple-ios7.0 -target-cpu cyclone \
6-
// RUN: -O -S %s -parse-as-library | \
6+
// RUN: -O -S %s -parse-as-library -parse-stdlib | \
77
// RUN: FileCheck --check-prefix=NO_TBI %s
88

99
// REQUIRES: CPU=arm64, OS=ios
1010

1111
// Verify that TBI is on by default in Swift on targets that support it. For our
1212
// purposes this means iOS8.0 or later.
1313

14+
import Swift
15+
1416
func f(i: Int) -> Int8 {
1517
let j = i & 0xff_ffff_ffff_ffff
1618
// TBI-NOT: and
1719
// NO_TBI: and
18-
let p = UnsafeMutablePointer<Int8>(bitPattern: j)
20+
guard let p = UnsafeMutablePointer<Int8>(bitPattern: j) else {
21+
// Make sure we optimize away this branch.
22+
Builtin.unreachable()
23+
}
1924
return p[0]
2025
}

0 commit comments

Comments
 (0)