Skip to content

Commit 7a13a34

Browse files
author
git apple-llvm automerger
committed
Merge commit '6e5b23504e18' from apple/stable/20200714 into swift/main
2 parents 6ab4cd9 + 6e5b235 commit 7a13a34

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4907,6 +4907,9 @@ bool InstCombiner::transformConstExprCastCall(CallBase &Call) {
49074907
if (Call.isInAllocaArgument(i))
49084908
return false; // Cannot transform to and from inalloca.
49094909

4910+
if (CallerPAL.hasParamAttribute(i, Attribute::SwiftError))
4911+
return false;
4912+
49104913
// If the parameter is passed as a byval argument, then we have to have a
49114914
// sized type and the sized type has to have the same size as the old type.
49124915
if (ParamTy != ActTy && CallerPAL.hasParamAttribute(i, Attribute::ByVal)) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -instcombine -S %s | FileCheck %s
3+
4+
; The swifterror value can only be loaded, stored or used as swifterror
5+
; argument. Make sure we do not try to turn the function bitcast into an
6+
; argument bitcast.
7+
define swiftcc void @spam(i32** swifterror %arg) {
8+
; CHECK-LABEL: @spam(
9+
; CHECK-NEXT: bb:
10+
; CHECK-NEXT: call swiftcc void bitcast (void (i64**)* @widget to void (i32**)*)(i32** swifterror [[ARG:%.*]])
11+
; CHECK-NEXT: ret void
12+
;
13+
bb:
14+
call swiftcc void bitcast (void (i64**)* @widget to void (i32**)*)(i32** swifterror %arg)
15+
ret void
16+
}
17+
18+
declare swiftcc void @widget(i64**)

0 commit comments

Comments
 (0)