brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · f8e0543 Raw
86 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 5%struct.ss = type { i32, i64 }6 7; Don't drop 'byval' on %X here.8define internal i32 @f(ptr byval(%struct.ss) %b, ptr byval(i32) %X, i32 %i) nounwind {9;10; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)11; CHECK-LABEL: define {{[^@]+}}@f12; CHECK-SAME: (i32 [[TMP0:%.*]], i64 [[TMP1:%.*]], i32 [[TMP2:%.*]]) #[[ATTR0:[0-9]+]] {13; CHECK-NEXT:  entry:14; CHECK-NEXT:    [[X_PRIV:%.*]] = alloca i32, align 415; CHECK-NEXT:    store i32 [[TMP2]], ptr [[X_PRIV]], align 416; CHECK-NEXT:    [[B_PRIV:%.*]] = alloca [[STRUCT_SS:%.*]], align 817; CHECK-NEXT:    store i32 [[TMP0]], ptr [[B_PRIV]], align 418; CHECK-NEXT:    [[B_PRIV_B4:%.*]] = getelementptr i8, ptr [[B_PRIV]], i64 419; CHECK-NEXT:    store i64 [[TMP1]], ptr [[B_PRIV_B4]], align 420; CHECK-NEXT:    [[VAL1:%.*]] = load i32, ptr [[B_PRIV]], align 821; CHECK-NEXT:    [[VAL2:%.*]] = add i32 [[VAL1]], 122; CHECK-NEXT:    store i32 [[VAL2]], ptr [[B_PRIV]], align 823; CHECK-NEXT:    store i32 0, ptr [[X_PRIV]], align 424; CHECK-NEXT:    [[L:%.*]] = load i32, ptr [[X_PRIV]], align 425; CHECK-NEXT:    [[A:%.*]] = add i32 [[L]], [[VAL2]]26; CHECK-NEXT:    ret i32 [[A]]27;28entry:29 30  %val1 = load i32, ptr %b, align 431  %val2 = add i32 %val1, 132  store i32 %val2, ptr %b, align 433 34  store i32 %i, ptr %X35  %l = load i32, ptr %X36  %a = add i32 %l, %val237  ret i32 %a38}39 40; Also make sure we don't drop the call zeroext attribute.41define i32 @test(ptr %X) {42;43; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)44; TUNIT-LABEL: define {{[^@]+}}@test45; TUNIT-SAME: (ptr nofree nonnull readonly captures(none) [[X:%.*]]) #[[ATTR1:[0-9]+]] {46; TUNIT-NEXT:  entry:47; TUNIT-NEXT:    [[S:%.*]] = alloca [[STRUCT_SS:%.*]], align 848; TUNIT-NEXT:    store i32 1, ptr [[S]], align 849; TUNIT-NEXT:    [[VAL4:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i32 0, i32 150; TUNIT-NEXT:    [[TMP0:%.*]] = load i32, ptr [[S]], align 851; TUNIT-NEXT:    [[S_B4:%.*]] = getelementptr i8, ptr [[S]], i64 452; TUNIT-NEXT:    [[TMP1:%.*]] = load i64, ptr [[S_B4]], align 853; TUNIT-NEXT:    [[TMP2:%.*]] = load i32, ptr [[X]], align 454; TUNIT-NEXT:    [[C:%.*]] = call i32 @f(i32 [[TMP0]], i64 [[TMP1]], i32 [[TMP2]]) #[[ATTR2:[0-9]+]]55; TUNIT-NEXT:    ret i32 [[C]]56;57; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)58; CGSCC-LABEL: define {{[^@]+}}@test59; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[X:%.*]]) #[[ATTR1:[0-9]+]] {60; CGSCC-NEXT:  entry:61; CGSCC-NEXT:    [[S:%.*]] = alloca [[STRUCT_SS:%.*]], align 862; CGSCC-NEXT:    [[VAL4:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i32 0, i32 163; CGSCC-NEXT:    [[TMP0:%.*]] = load i32, ptr [[X]], align 464; CGSCC-NEXT:    [[C:%.*]] = call i32 @f(i32 noundef 1, i64 noundef 2, i32 [[TMP0]]) #[[ATTR2:[0-9]+]]65; CGSCC-NEXT:    ret i32 [[C]]66;67entry:68  %S = alloca %struct.ss69  store i32 1, ptr %S, align 870  %val4 = getelementptr %struct.ss, ptr %S, i32 0, i32 171  store i64 2, ptr %val4, align 472 73  %c = call i32 @f(ptr byval(%struct.ss) %S, ptr byval(i32) %X, i32 zeroext 0)74 75  ret i32 %c76}77;.78; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }79; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }80; TUNIT: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn }81;.82; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }83; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) }84; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }85;.86