68 lines · plain
1; RUN: opt -passes=deadargelim -S < %s | FileCheck %s2 3define void @test(i32) {4 ret void5}6 7define void @foo() {8 call void @test(i32 0)9 ret void10; CHECK-LABEL: @foo(11; CHECK: i32 poison12}13 14define void @f(i32 %X) {15entry:16 tail call void @sideeffect() nounwind17 ret void18}19 20declare void @sideeffect()21 22define void @g(i32 %n) {23entry:24 %add = add nsw i32 %n, 125; CHECK: tail call void @f(i32 poison)26 tail call void @f(i32 %add)27 ret void28}29 30define void @h() {31entry:32 %i = alloca i32, align 433 store volatile i32 10, ptr %i, align 434; CHECK: %tmp = load volatile i32, ptr %i, align 435; CHECK-NEXT: call void @f(i32 poison)36 %tmp = load volatile i32, ptr %i, align 437 call void @f(i32 %tmp)38 ret void39}40 41; Check that callers are not transformed for weak definitions.42define weak i32 @weak_f(i32 %x) nounwind {43entry:44 ret i32 045}46define void @weak_f_caller() nounwind {47entry:48; CHECK: call i32 @weak_f(i32 10)49 %call = tail call i32 @weak_f(i32 10)50 ret void51}52 53%swift_error = type opaque54 55define void @unused_swifterror_arg(ptr swifterror %dead_arg) {56 tail call void @sideeffect() nounwind57 ret void58}59 60; CHECK-LABEL: @dont_replace_by_poison61; CHECK-NOT: call void @unused_swifterror_arg({{.*}}poison)62define void @dont_replace_by_poison() {63 %error_ptr_ref = alloca swifterror ptr64 store ptr null, ptr %error_ptr_ref65 call void @unused_swifterror_arg(ptr %error_ptr_ref)66 ret void67}68