Skip to content

Commit 198a802

Browse files
authored
Merge pull request #80767 from meg-gupta/reverttransparent
Revert #79707
2 parents 8eb43af + f462bc5 commit 198a802

File tree

6 files changed

+18
-44
lines changed

6 files changed

+18
-44
lines changed

lib/SILOptimizer/Mandatory/OSLogOptimization.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -938,16 +938,6 @@ static void substituteConstants(FoldState &foldState) {
938938
for (SILValue constantSILValue : foldState.getConstantSILValues()) {
939939
SymbolicValue constantSymbolicVal =
940940
evaluator.lookupConstValue(constantSILValue).value();
941-
CanType instType = constantSILValue->getType().getASTType();
942-
943-
// If the SymbolicValue is a string but the instruction that is folded is
944-
// not String typed, we are tracking a StaticString which is represented as
945-
// a raw pointer. Skip folding StaticString as they are already efficiently
946-
// represented.
947-
if (constantSymbolicVal.getKind() == SymbolicValue::String &&
948-
!instType->isString())
949-
continue;
950-
951941
// Make sure that the symbolic value tracked in the foldState is a constant.
952942
// In the case of ArraySymbolicValue, the array storage could be a non-constant
953943
// if some instruction in the array initialization sequence was not evaluated
@@ -986,6 +976,7 @@ static void substituteConstants(FoldState &foldState) {
986976

987977
SILBuilderWithScope builder(insertionPoint);
988978
SILLocation loc = insertionPoint->getLoc();
979+
CanType instType = constantSILValue->getType().getASTType();
989980
SILValue foldedSILVal = emitCodeForSymbolicValue(
990981
constantSymbolicVal, instType, builder, loc, foldState.stringInfo);
991982

stdlib/public/core/Integers.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,7 +3041,8 @@ extension UnsignedInteger where Self: FixedWidthInteger {
30413041
/// - Parameter source: A value to convert to this type of integer. The value
30423042
/// passed as `source` must be representable in this type.
30433043
@_semantics("optimize.sil.specialize.generic.partial.never")
3044-
@_transparent
3044+
@inlinable // FIXME(inline-always)
3045+
@inline(__always)
30453046
public init<T: BinaryInteger>(_ source: T) {
30463047
// This check is potentially removable by the optimizer
30473048
if T.isSigned {
@@ -3056,7 +3057,8 @@ extension UnsignedInteger where Self: FixedWidthInteger {
30563057
}
30573058

30583059
@_semantics("optimize.sil.specialize.generic.partial.never")
3059-
@_transparent
3060+
@inlinable // FIXME(inline-always)
3061+
@inline(__always)
30603062
public init?<T: BinaryInteger>(exactly source: T) {
30613063
// This check is potentially removable by the optimizer
30623064
if T.isSigned && source < (0 as T) {
@@ -3254,7 +3256,8 @@ extension SignedInteger where Self: FixedWidthInteger {
32543256
/// - Parameter source: A value to convert to this type of integer. The value
32553257
/// passed as `source` must be representable in this type.
32563258
@_semantics("optimize.sil.specialize.generic.partial.never")
3257-
@_transparent
3259+
@inlinable // FIXME(inline-always)
3260+
@inline(__always)
32583261
public init<T: BinaryInteger>(_ source: T) {
32593262
// This check is potentially removable by the optimizer
32603263
if T.isSigned && source.bitWidth > Self.bitWidth {
@@ -3271,7 +3274,8 @@ extension SignedInteger where Self: FixedWidthInteger {
32713274
}
32723275

32733276
@_semantics("optimize.sil.specialize.generic.partial.never")
3274-
@_transparent
3277+
@inlinable // FIXME(inline-always)
3278+
@inline(__always)
32753279
public init?<T: BinaryInteger>(exactly source: T) {
32763280
// This check is potentially removable by the optimizer
32773281
if T.isSigned && source.bitWidth > Self.bitWidth && source < Self.min {

test/IRGen/integer_conversion.swift

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/Interop/Cxx/templates/function-template-silgen.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ import FunctionTemplates
1616
// CHECK: [[ADD_TWO_FN:%.*]] = function_ref @{{_Z18addMixedTypeParamsIiiET_S0_T0_|\?\?\$addMixedTypeParams@HH@@YAHHH@Z}} : $@convention(c) (Int32, Int32) -> Int32
1717
// CHECK: [[C:%.*]] = apply [[ADD_TWO_FN]]([[A]], [[B]]) : $@convention(c) (Int32, Int32) -> Int32
1818

19+
// CHECK: [[C_32_ADDR:%.*]] = alloc_stack $Int32
20+
// CHECK: [[C_32:%.*]] = load [[C_32_ADDR]] : $*Int32
1921
// CHECK: [[ADD_FN:%.*]] = function_ref @{{_Z17addSameTypeParamsIiET_S0_S0_|\?\?\$addSameTypeParams@H@@YAHHH@Z}} : $@convention(c) (Int32, Int32) -> Int32
20-
// CHECK: [[OUT:%.*]] = apply [[ADD_FN]]([[B]], [[C_32:%.*]]) : $@convention(c) (Int32, Int32) -> Int32
22+
// CHECK: [[OUT:%.*]] = apply [[ADD_FN]]([[B]], [[C_32]]) : $@convention(c) (Int32, Int32) -> Int32
2123
// CHECK: return [[OUT]] : $Int32
2224

2325
// CHECK-LABEL: end sil function '$s4main4test1xs5Int32VAE_tF'

test/SILOptimizer/Inputs/constant_evaluable.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ internal func interpretIntTruncations() -> Int8 {
174174
internal func testInvalidIntTruncations(a: Int32) -> Int8 {
175175
return Int8(a)
176176
// CHECK: note: {{.*}}: Not enough bits to represent the passed value
177-
// CHECK: note: operation traps
177+
// CHECK: note: operation performed during this call traps
178+
// CHECK: function_ref @$sSZss17FixedWidthIntegerRzrlEyxqd__cSzRd__lufC
178179
}
179180

180181
@_semantics("test_driver")
@@ -219,7 +220,8 @@ internal func interpretSingedUnsignedConversions() -> UInt32 {
219220
internal func testInvalidSingedUnsignedConversions(a: Int64) -> UInt64 {
220221
return UInt64(a)
221222
// CHECK: note: {{.*}}: Negative value is not representable
222-
// CHECK: note: operation traps
223+
// CHECK: note: operation performed during this call traps
224+
// CHECK: function_ref @$sSUss17FixedWidthIntegerRzrlEyxqd__cSzRd__lufC
223225
}
224226

225227
@_semantics("test_driver")

test/SILOptimizer/constant_evaluable_subset_test_arch64.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ internal func interpretIntTruncations() -> Int16 {
7171
internal func testInvalidIntTruncations(a: Int64) -> Int8 {
7272
return Int8(a)
7373
// CHECK: note: {{.*}} Not enough bits to represent the passed value
74-
// CHECK: note: operation traps
74+
// CHECK: note: operation performed during this call traps
75+
// CHECK: function_ref @$sSZss17FixedWidthIntegerRzrlEyxqd__cSzRd__lufC
7576
}
7677

7778
@_semantics("test_driver")

0 commit comments

Comments
 (0)