68 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4 5target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-pc-windows-msvc"7 8define internal void @add(ptr %this, ptr sret(i32) %r) {9;10; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)11; TUNIT-LABEL: define {{[^@]+}}@add12; TUNIT-SAME: (ptr noalias nofree nonnull readnone align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr noalias nofree noundef nonnull writeonly sret(i32) align 4 captures(none) dereferenceable(4) [[R:%.*]]) #[[ATTR0:[0-9]+]] {13; TUNIT-NEXT: store i32 undef, ptr [[R]], align 414; TUNIT-NEXT: ret void15;16; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)17; CGSCC-LABEL: define {{[^@]+}}@add18; CGSCC-SAME: (ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr noalias nofree noundef nonnull writeonly sret(i32) align 4 captures(none) dereferenceable(4) [[R:%.*]]) #[[ATTR0:[0-9]+]] {19; CGSCC-NEXT: [[BP:%.*]] = getelementptr { i32, i32 }, ptr [[THIS]], i32 0, i32 120; CGSCC-NEXT: [[A:%.*]] = load i32, ptr [[THIS]], align 821; CGSCC-NEXT: [[B:%.*]] = load i32, ptr [[BP]], align 422; CGSCC-NEXT: [[AB:%.*]] = add i32 [[A]], [[B]]23; CGSCC-NEXT: store i32 [[AB]], ptr [[R]], align 424; CGSCC-NEXT: ret void25;26 %ap = getelementptr {i32, i32}, ptr %this, i32 0, i32 027 %bp = getelementptr {i32, i32}, ptr %this, i32 0, i32 128 %a = load i32, ptr %ap29 %b = load i32, ptr %bp30 %ab = add i32 %a, %b31 store i32 %ab, ptr %r32 ret void33}34 35define void @f() {36; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)37; TUNIT-LABEL: define {{[^@]+}}@f38; TUNIT-SAME: () #[[ATTR1:[0-9]+]] {39; TUNIT-NEXT: [[R:%.*]] = alloca i32, align 440; TUNIT-NEXT: call void @add(ptr noalias nofree nonnull readnone align 8 captures(none) dereferenceable(8) undef, ptr noalias nofree noundef nonnull writeonly sret(i32) align 4 captures(none) dereferenceable(4) [[R]]) #[[ATTR2:[0-9]+]]41; TUNIT-NEXT: ret void42;43; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)44; CGSCC-LABEL: define {{[^@]+}}@f45; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {46; CGSCC-NEXT: [[R:%.*]] = alloca i32, align 447; CGSCC-NEXT: [[PAIR:%.*]] = alloca { i32, i32 }, align 848; CGSCC-NEXT: call void @add(ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[PAIR]], ptr noalias nofree noundef nonnull writeonly sret(i32) align 4 captures(none) dereferenceable(4) [[R]]) #[[ATTR2:[0-9]+]]49; CGSCC-NEXT: ret void50;51 %r = alloca i3252 %pair = alloca {i32, i32}53 54 call void @add(ptr %pair, ptr sret(i32) %r)55 ret void56}57;.58; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }59; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }60; TUNIT: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(write) }61;.62; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }63; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }64; CGSCC: attributes #[[ATTR2]] = { nofree nounwind willreturn }65;.66;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:67; CHECK: {{.*}}68