Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll
Show All 24 Lines | |||||
; 16 - Number of arguments marked nocapture | ; 16 - Number of arguments marked nocapture | ||||
; 4 - Number of arguments marked readnone | ; 4 - Number of arguments marked readnone | ||||
; 6 - Number of arguments marked writeonly | ; 6 - Number of arguments marked writeonly | ||||
; 6 - Number of arguments marked readonly | ; 6 - Number of arguments marked readonly | ||||
; 6 - Number of arguments marked returned | ; 6 - Number of arguments marked returned | ||||
; | ; | ||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | ||||
; CHECK: Function Attrs: nounwind | ; CHECK: Function Attrs: nofree nounwind | ||||
; CHECK-NEXT: define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | ; CHECK-NEXT: define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | ||||
define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { | define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { | ||||
entry: | entry: | ||||
%call = call i32* @internal_ret0_nw(i32* %n0, i32* %w0) | %call = call i32* @internal_ret0_nw(i32* %n0, i32* %w0) | ||||
%call1 = call i32* @internal_ret1_rrw(i32* %r0, i32* %r0, i32* %w0) | %call1 = call i32* @internal_ret1_rrw(i32* %r0, i32* %r0, i32* %w0) | ||||
%call2 = call i32* @external_sink_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | %call2 = call i32* @external_sink_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | ||||
%call3 = call i32* @internal_ret1_rw(i32* %r0, i32* %w0) | %call3 = call i32* @internal_ret1_rw(i32* %r0, i32* %w0) | ||||
ret i32* %call3 | ret i32* %call3 | ||||
} | } | ||||
; CHECK: Function Attrs: nounwind | ; CHECK: Function Attrs: nofree nounwind | ||||
; CHECK-NEXT: define internal i32* @internal_ret0_nw(i32* %n0, i32* %w0) | ; CHECK-NEXT: define internal i32* @internal_ret0_nw(i32* %n0, i32* %w0) | ||||
define internal i32* @internal_ret0_nw(i32* %n0, i32* %w0) { | define internal i32* @internal_ret0_nw(i32* %n0, i32* %w0) { | ||||
entry: | entry: | ||||
%r0 = alloca i32, align 4 | %r0 = alloca i32, align 4 | ||||
%r1 = alloca i32, align 4 | %r1 = alloca i32, align 4 | ||||
%tobool = icmp ne i32* %n0, null | %tobool = icmp ne i32* %n0, null | ||||
br i1 %tobool, label %if.end, label %if.then | br i1 %tobool, label %if.end, label %if.then | ||||
Show All 12 Lines | if.end: ; preds = %entry | ||||
%call5 = call i32* @internal_ret0_nw(i32* %n0, i32* %w0) | %call5 = call i32* @internal_ret0_nw(i32* %n0, i32* %w0) | ||||
br label %return | br label %return | ||||
return: ; preds = %if.end, %if.then | return: ; preds = %if.end, %if.then | ||||
%retval.0 = phi i32* [ %call5, %if.end ], [ %n0, %if.then ] | %retval.0 = phi i32* [ %call5, %if.end ], [ %n0, %if.then ] | ||||
ret i32* %retval.0 | ret i32* %retval.0 | ||||
} | } | ||||
; CHECK: Function Attrs: nounwind | ; CHECK: Function Attrs: nofree nounwind | ||||
; CHECK-NEXT: define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) | ; CHECK-NEXT: define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) | ||||
define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) { | define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) { | ||||
entry: | entry: | ||||
%0 = load i32, i32* %r0, align 4 | %0 = load i32, i32* %r0, align 4 | ||||
%tobool = icmp ne i32 %0, 0 | %tobool = icmp ne i32 %0, 0 | ||||
br i1 %tobool, label %if.end, label %if.then | br i1 %tobool, label %if.end, label %if.then | ||||
if.then: ; preds = %entry | if.then: ; preds = %entry | ||||
Show All 15 Lines | if.end: ; preds = %entry | ||||
%call8 = call i32* @internal_ret0_nw(i32* %r1, i32* %w0) | %call8 = call i32* @internal_ret0_nw(i32* %r1, i32* %w0) | ||||
br label %return | br label %return | ||||
return: ; preds = %if.end, %if.then | return: ; preds = %if.end, %if.then | ||||
%retval.0 = phi i32* [ %call8, %if.end ], [ %r1, %if.then ] | %retval.0 = phi i32* [ %call8, %if.end ], [ %r1, %if.then ] | ||||
ret i32* %retval.0 | ret i32* %retval.0 | ||||
} | } | ||||
; CHECK: Function Attrs: norecurse nounwind | ; CHECK: Function Attrs: nofree norecurse nounwind | ||||
; CHECK-NEXT: define i32* @external_sink_ret2_nrw(i32* readnone %n0, i32* nocapture readonly %r0, i32* returned %w0) | ; CHECK-NEXT: define i32* @external_sink_ret2_nrw(i32* readnone %n0, i32* nocapture readonly %r0, i32* returned %w0) | ||||
define i32* @external_sink_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { | define i32* @external_sink_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { | ||||
entry: | entry: | ||||
%tobool = icmp ne i32* %n0, null | %tobool = icmp ne i32* %n0, null | ||||
br i1 %tobool, label %if.end, label %if.then | br i1 %tobool, label %if.end, label %if.then | ||||
if.then: ; preds = %entry | if.then: ; preds = %entry | ||||
br label %return | br label %return | ||||
if.end: ; preds = %entry | if.end: ; preds = %entry | ||||
%0 = load i32, i32* %r0, align 4 | %0 = load i32, i32* %r0, align 4 | ||||
store i32 %0, i32* %w0, align 4 | store i32 %0, i32* %w0, align 4 | ||||
br label %return | br label %return | ||||
return: ; preds = %if.end, %if.then | return: ; preds = %if.end, %if.then | ||||
ret i32* %w0 | ret i32* %w0 | ||||
} | } | ||||
; CHECK: Function Attrs: nounwind | ; CHECK: Function Attrs: nofree nounwind | ||||
; CHECK-NEXT: define internal i32* @internal_ret1_rw(i32* %r0, i32* %w0) | ; CHECK-NEXT: define internal i32* @internal_ret1_rw(i32* %r0, i32* %w0) | ||||
define internal i32* @internal_ret1_rw(i32* %r0, i32* %w0) { | define internal i32* @internal_ret1_rw(i32* %r0, i32* %w0) { | ||||
entry: | entry: | ||||
%0 = load i32, i32* %r0, align 4 | %0 = load i32, i32* %r0, align 4 | ||||
%tobool = icmp ne i32 %0, 0 | %tobool = icmp ne i32 %0, 0 | ||||
br i1 %tobool, label %if.end, label %if.then | br i1 %tobool, label %if.end, label %if.then | ||||
if.then: ; preds = %entry | if.then: ; preds = %entry | ||||
Show All 9 Lines | if.end: ; preds = %entry | ||||
%call4 = call i32* @external_ret2_nrw(i32* %r0, i32* %r0, i32* %w0) | %call4 = call i32* @external_ret2_nrw(i32* %r0, i32* %r0, i32* %w0) | ||||
br label %return | br label %return | ||||
return: ; preds = %if.end, %if.then | return: ; preds = %if.end, %if.then | ||||
%retval.0 = phi i32* [ %call4, %if.end ], [ %w0, %if.then ] | %retval.0 = phi i32* [ %call4, %if.end ], [ %w0, %if.then ] | ||||
ret i32* %retval.0 | ret i32* %retval.0 | ||||
} | } | ||||
; CHECK: Function Attrs: nounwind | ; CHECK: Function Attrs: nofree nounwind | ||||
; CHECK-NEXT: define i32* @external_source_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | ; CHECK-NEXT: define i32* @external_source_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | ||||
define i32* @external_source_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { | define i32* @external_source_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { | ||||
entry: | entry: | ||||
%call = call i32* @external_sink_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | %call = call i32* @external_sink_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | ||||
%call1 = call i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | %call1 = call i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) | ||||
ret i32* %call1 | ret i32* %call1 | ||||
} | } | ||||
; Verify that we see only expected attribute sets, the above lines only check | ; Verify that we see only expected attribute sets, the above lines only check | ||||
; for a subset relation. | ; for a subset relation. | ||||
; | ; | ||||
; CHECK-NOT: attributes # | ; CHECK-NOT: attributes # | ||||
; CHECK: attributes #{{.*}} = { nounwind } | ; CHECK: attributes #{{.*}} = { nofree nounwind } | ||||
; CHECK: attributes #{{.*}} = { norecurse nounwind } | ; CHECK: attributes #{{.*}} = { nofree norecurse nounwind } | ||||
; CHECK-NOT: attributes # | ; CHECK-NOT: attributes # |