Skip to content

Commit a9143e1

Browse files
authored
Merge pull request #22995 from eeckstein/fix-ubp-test-5.1
[5.1] Fix a unit test for 32-bit platforms.
2 parents b92a0a7 + e11e4a5 commit a9143e1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/SILOptimizer/unsafebufferpointer.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ public func testCount(_ x: UnsafeBufferPointer<UInt>) -> Int {
5656
//
5757
// CHECK: ; <label>:[[LOOP]]:
5858
// CHECK: phi float [ 0.000000e+00
59-
// CHECK: add nuw i64 %{{.*}}, 1
6059
// CHECK: load float, float*
6160
// CHECK: fadd float
62-
// CHECK: [[CMP:%[0-9]+]] = icmp eq i64 %{{.*}}, %{{.*}}
61+
// CHECK: [[CMP:%[0-9]+]] = icmp eq
6362
// CHECK: br i1 [[CMP]], label %.loopexit, label %[[LOOP]]
6463
public func testSubscript(_ ubp: UnsafeBufferPointer<Float>) -> Float {
6564
var sum: Float = 0
@@ -80,17 +79,15 @@ public func testSubscript(_ ubp: UnsafeBufferPointer<Float>) -> Float {
8079
//
8180
// CHECK: ; <label>:[[LOOP]]:
8281
// CHECK: phi i64 [ 0
83-
// CHECK: phi i64 [ 0
84-
// CHECK: add nuw i64 %{{.*}}, 1
8582
// CHECK: load i8, i8*
8683
// CHECK: zext i8 %{{.*}} to i64
8784
// CHECK: add i64
88-
// CHECK: [[CMP:%[0-9]+]] = icmp eq i64 %{{.*}}, %{{.*}}
85+
// CHECK: [[CMP:%[0-9]+]] = icmp eq
8986
// CHECK: br i1 [[CMP]], label %[[RET]], label %[[LOOP]]
90-
public func testSubscript(_ ubp: UnsafeRawBufferPointer) -> Int {
91-
var sum: Int = 0
87+
public func testSubscript(_ ubp: UnsafeRawBufferPointer) -> Int64 {
88+
var sum: Int64 = 0
9289
for i in 0 ..< ubp.count {
93-
sum &+= Int(ubp[i])
90+
sum &+= Int64(ubp[i])
9491
}
9592
return sum
9693
}

0 commit comments

Comments
 (0)