1 ; if IPSCCP determines a function returns undef,
2 ; then the "returned" attribute of input arguments
5 ; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
10 %call = call i32 @func_return_undef(i32 returned 1)
11 ; CHECK: call i32 @func_return_undef(i32 1)
17 define internal i32 @func_return_undef(i32 returned %arg) {
18 ; CHECK: {{define.*@func_return_undef}}
22 ; CHECK-NEXT: {{ret.*undef}}
27 ; The only case that users of zapped functions are non-call site
28 ; users is that they are blockaddr users. Skip them because we
29 ; want to remove the returned attribute for call sites
31 ; CHECK: {{define.*@blockaddr_user}}
33 define internal i32 @blockaddr_user(i1 %c, i32 returned %d) {
35 br i1 %c, label %bb1, label %bb2
38 br label %branch.block
41 br label %branch.block
44 %addr = phi ptr [blockaddress(@blockaddr_user, %target1), %bb1], [blockaddress(@blockaddr_user, %target2), %bb2]
45 indirectbr ptr %addr, [label %target1, label %target2]
50 ; CHECK: ret i32 undef
55 define i32 @call_blockaddr_user(i1 %c) {
56 ; CHECK-LABEL: define i32 @call_blockaddr_user(
57 ; CHECK-NEXT: %r = call i32 @blockaddr_user(i1 %c
59 ; CHECK-NEXT: ret i32 10
60 %r = call i32 @blockaddr_user(i1 %c, i32 returned 10)