Skip to content

Commit 9b10362

Browse files
committed
Revert "Merge pull request swiftlang#74840 from drexin/wip-130781414"
This reverts commit 7feb592, reversing changes made to 4edda08.
1 parent 25bc387 commit 9b10362

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,10 @@ CombinedResultAndErrorType irgen::combineResultAndTypedErrorType(
416416
assert(error->isIntOrPtrTy() &&
417417
"Direct errors must only consist of int or ptr values");
418418
result.errorValueMapping.push_back(combined.size());
419-
420-
if (res == error) {
419+
if (res->getPrimitiveSizeInBits() >= error->getPrimitiveSizeInBits()) {
421420
combined.push_back(res);
422421
} else {
423-
auto maxSize = std::max(IGM.DataLayout.getTypeSizeInBits(res),
424-
IGM.DataLayout.getTypeSizeInBits(error));
425-
combined.push_back(llvm::IntegerType::get(IGM.getLLVMContext(), maxSize));
422+
combined.push_back(error);
426423
}
427424

428425
++resIt;
@@ -2868,12 +2865,10 @@ class SyncCallEmission final : public CallEmission {
28682865
if (auto *structTy = dyn_cast<llvm::StructType>(
28692866
nativeSchema.getExpandedType(IGF.IGM))) {
28702867
for (unsigned i = 0, e = structTy->getNumElements(); i < e; ++i) {
2871-
auto *nativeTy = structTy->getElementType(i);
2872-
resultExplosion.add(convertIfNecessary(nativeTy, values[i]));
2868+
resultExplosion.add(values[i]);
28732869
}
28742870
} else {
2875-
resultExplosion.add(
2876-
convertIfNecessary(combined.combinedTy, values[0]));
2871+
resultExplosion.add(values[0]);
28772872
}
28782873
out = nativeSchema.mapFromNative(IGF.IGM, IGF, resultExplosion,
28792874
resultType);
@@ -5744,9 +5739,6 @@ void IRGenFunction::emitScalarReturn(SILType returnResultType,
57445739
eltTy->getPrimitiveSizeInBits()) {
57455740
assert(nativeTy->getPrimitiveSizeInBits() >
57465741
eltTy->getPrimitiveSizeInBits());
5747-
if (eltTy->isPointerTy()) {
5748-
return Builder.CreatePtrToInt(elt, nativeTy);
5749-
}
57505742
return Builder.CreateZExt(elt, nativeTy);
57515743
}
57525744
return elt;

lib/IRGen/IRGenSIL.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,11 +4474,6 @@ void IRGenSILFunction::visitThrowInst(swift::ThrowInst *i) {
44744474
eltTy->getPrimitiveSizeInBits()) {
44754475
assert(nativeTy->getPrimitiveSizeInBits() >
44764476
eltTy->getPrimitiveSizeInBits());
4477-
4478-
if (eltTy->isPointerTy()) {
4479-
return elt = Builder.CreatePtrToInt(elt, nativeTy);
4480-
}
4481-
44824477
return Builder.CreateZExt(elt, nativeTy);
44834478
}
44844479
return elt;

test/IRGen/typed_throws.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,3 @@ func catchesSmallError() -> Int {
115115
return error.x
116116
}
117117
}
118-
119-
struct MyError: Error {
120-
let x: AnyObject
121-
}
122-
123-
// CHECK: define hidden swiftcc { float, i64, float } @"$s12typed_throws8mayThrow1x1ySf_s5Int32VSftSb_yXltAA7MyErrorVYKF"
124-
// CHECK: [[CONVERTED:%.*]] = ptrtoint ptr {{%.*}} to i64
125-
// CHECK: insertvalue { float, i64, float } undef, i64 [[CONVERTED]], 1
126-
// CHECK: }
127-
@inline(never)
128-
func mayThrow(x: Bool, y: AnyObject) throws(MyError) -> (Float, Int32, Float) {
129-
guard x else {
130-
throw MyError(x: y)
131-
}
132-
return (3.0, 4, 5.0)
133-
}

0 commit comments

Comments
 (0)