Skip to content

Commit 4495f6b

Browse files
committed
Fix tests for 32-bit platforms.
- Remove unnecessary imports from test/AutoDiff/stdlib/simd.swift. - Use platform-correct `Builtin` integer type in `PullbackEmitter::getArrayAdjointElementBuffer`.
1 parent 01db90d commit 4495f6b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/SILOptimizer/Utils/Differentiation/PullbackEmitter.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,15 @@ PullbackEmitter::getArrayAdjointElementBuffer(SILValue arrayAdjoint,
11321132
// Apply `Array.TangentVector.subscript.getter` to get array element adjoint
11331133
// buffer.
11341134
auto &ctx = builder.getASTContext();
1135-
// %index_literal = integer_literal $Builtin.Int64, <index>
1136-
auto *eltIndexLiteral = builder.createIntegerLiteral(
1137-
loc, SILType::getBuiltinIntegerType(64, ctx), eltIndex);
1135+
// %index_literal = integer_literal $Builtin.IntXX, <index>
1136+
auto builtinIntType =
1137+
SILType::getPrimitiveObjectType(ctx.getIntDecl()
1138+
->getStoredProperties()
1139+
.front()
1140+
->getInterfaceType()
1141+
->getCanonicalType());
1142+
auto *eltIndexLiteral =
1143+
builder.createIntegerLiteral(loc, builtinIntType, eltIndex);
11381144
auto intType = SILType::getPrimitiveObjectType(
11391145
ctx.getIntDecl()->getDeclaredType()->getCanonicalType());
11401146
// %index_int = struct $Int (%index_literal)

test/AutoDiff/stdlib/simd.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33

44
import _Differentiation
55
import StdlibUnittest
6-
#if os(macOS)
7-
import Darwin.C
8-
#else
9-
import Glibc
10-
#endif
116

127
var SIMDTests = TestSuite("SIMD")
138

0 commit comments

Comments
 (0)