llvm.org GIT mirror llvm / e9993d5
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 Arnold Schwaighofer 3 years ago
2 changed file(s) with 16 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
269269
270270 SmallVector UnusedArgs;
271271 for (Argument &Arg : Fn.args()) {
272 if (Arg.use_empty() && !Arg.hasByValOrInAllocaAttr())
272 if (!Arg.hasSwiftErrorAttr() && Arg.use_empty() && !Arg.hasByValOrInAllocaAttr())
273273 UnusedArgs.push_back(Arg.getArgNo());
274274 }
275275
4949 ret void
5050 }
5151
52 %swift_error = type opaque
53
54 define void @unused_swifterror_arg(%swift_error** swifterror %dead_arg) {
55 tail call void @sideeffect() nounwind
56 ret void
57 }
58
59 ; CHECK-LABEL: @dont_replace_by_undef
60 ; CHECK-NOT: call void @unused_swifterror_arg({{.*}}undef)
61 define void @dont_replace_by_undef() {
62 %error_ptr_ref = alloca swifterror %swift_error*
63 store %swift_error* null, %swift_error** %error_ptr_ref
64 call void @unused_swifterror_arg(%swift_error** %error_ptr_ref)
65 ret void
66 }