mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-24 13:15:36 +00:00
DeadArgElim: Don't mark swifterror arguments as unused
Replacing swifterror arguments with undef creates invalid IR. rdar://28300490 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282075 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cbe1f9e0e2
commit
e9993d5a21
@ -270,7 +270,7 @@ bool DeadArgumentEliminationPass::RemoveDeadArgumentsFromCallers(Function &Fn) {
|
||||
|
||||
SmallVector<unsigned, 8> UnusedArgs;
|
||||
for (Argument &Arg : Fn.args()) {
|
||||
if (Arg.use_empty() && !Arg.hasByValOrInAllocaAttr())
|
||||
if (!Arg.hasSwiftErrorAttr() && Arg.use_empty() && !Arg.hasByValOrInAllocaAttr())
|
||||
UnusedArgs.push_back(Arg.getArgNo());
|
||||
}
|
||||
|
||||
|
@ -50,3 +50,18 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
%swift_error = type opaque
|
||||
|
||||
define void @unused_swifterror_arg(%swift_error** swifterror %dead_arg) {
|
||||
tail call void @sideeffect() nounwind
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @dont_replace_by_undef
|
||||
; CHECK-NOT: call void @unused_swifterror_arg({{.*}}undef)
|
||||
define void @dont_replace_by_undef() {
|
||||
%error_ptr_ref = alloca swifterror %swift_error*
|
||||
store %swift_error* null, %swift_error** %error_ptr_ref
|
||||
call void @unused_swifterror_arg(%swift_error** %error_ptr_ref)
|
||||
ret void
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user