Skip to content

Commit 620f874

Browse files
committed
Fix int literals which can clash with line numbers
test/SILOptimizer/pointer_conversion.swift’s arrayLiteralPromotion() subtest uses integer literals for 41, 42, 43, and 44. If swift-evolve shuffles a particular _internalInvariant() call in stdlib/public/core/BridgeStorage.swift to lines 41-44, the compiler will generate code which reuses the integer_literal instruction for the line number later in the test, causing this test to fail. This happens about once per 45 runs of swift-evolve. This change negates the integer literals so they will never match a line number.
1 parent 81c5a67 commit 620f874

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/SILOptimizer/pointer_conversion.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ public func testMutableArrayToOptional() {
8484
8585
// CHECK-LABEL: sil @$s18pointer_conversion21arrayLiteralPromotionyyF
8686
public func arrayLiteralPromotion() {
87-
takesConstRawPointer([41,42,43,44])
87+
takesConstRawPointer([-41,-42,-43,-44])
8888
8989
// Stack allocate the array.
9090
// TODO: When stdlib checks are enabled, this becomes heap allocated... :-(
9191
// CHECK: alloc_ref {{.*}}[tail_elems $Int * {{.*}} : $Builtin.Word] $_ContiguousArrayStorage<Int>
9292
9393
// Store the elements.
94-
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 41
95-
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 42
96-
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 43
97-
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, 44
94+
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -41
95+
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -42
96+
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -43
97+
// CHECK: [[ELT:%.+]] = integer_literal $Builtin.Int{{.*}}, -44
9898
9999
// Call the function.
100100
// CHECK: [[PTR:%.+]] = mark_dependence

0 commit comments

Comments
 (0)