|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes |
| 2 | +; RUN: opt -max-heap-to-stack-size=-1 -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM |
| 3 | +; RUN: opt -max-heap-to-stack-size=-1 -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM |
| 4 | +; RUN: opt -max-heap-to-stack-size=-1 -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM |
| 5 | +; RUN: opt -max-heap-to-stack-size=-1 -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM |
| 6 | + |
| 7 | +declare i64 @subfn(i8*) #0 |
| 8 | + |
| 9 | +declare noalias i8* @malloc(i64) |
| 10 | +declare noalias i8* @calloc(i64, i64) |
| 11 | +declare void @free(i8*) |
| 12 | + |
| 13 | +define i64 @f(i64 %len) { |
| 14 | +; IS________OPM-LABEL: define {{[^@]+}}@f |
| 15 | +; IS________OPM-SAME: (i64 [[LEN:%.*]]) { |
| 16 | +; IS________OPM-NEXT: entry: |
| 17 | +; IS________OPM-NEXT: [[MEM:%.*]] = call noalias i8* @malloc(i64 [[LEN]]) |
| 18 | +; IS________OPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM]]) [[ATTR1:#.*]] |
| 19 | +; IS________OPM-NEXT: call void @free(i8* [[MEM]]) |
| 20 | +; IS________OPM-NEXT: ret i64 [[RES]] |
| 21 | +; |
| 22 | +; IS________NPM-LABEL: define {{[^@]+}}@f |
| 23 | +; IS________NPM-SAME: (i64 [[LEN:%.*]]) { |
| 24 | +; IS________NPM-NEXT: entry: |
| 25 | +; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 [[LEN]], align 1 |
| 26 | +; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[TMP0]]) [[ATTR2:#.*]] |
| 27 | +; IS________NPM-NEXT: ret i64 [[RES]] |
| 28 | +; |
| 29 | +entry: |
| 30 | + %mem = call i8* @malloc(i64 %len) |
| 31 | + %res = call i64 @subfn(i8* %mem) |
| 32 | + call void @free(i8* %mem) |
| 33 | + ret i64 %res |
| 34 | +} |
| 35 | + |
| 36 | + |
| 37 | +define i64 @g(i64 %len) { |
| 38 | +; IS________OPM-LABEL: define {{[^@]+}}@g |
| 39 | +; IS________OPM-SAME: (i64 [[LEN:%.*]]) { |
| 40 | +; IS________OPM-NEXT: entry: |
| 41 | +; IS________OPM-NEXT: [[MEM:%.*]] = call noalias i8* @calloc(i64 [[LEN]], i64 noundef 8) |
| 42 | +; IS________OPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[MEM]]) [[ATTR1]] |
| 43 | +; IS________OPM-NEXT: call void @free(i8* [[MEM]]) |
| 44 | +; IS________OPM-NEXT: ret i64 [[RES]] |
| 45 | +; |
| 46 | +; IS________NPM-LABEL: define {{[^@]+}}@g |
| 47 | +; IS________NPM-SAME: (i64 [[LEN:%.*]]) { |
| 48 | +; IS________NPM-NEXT: entry: |
| 49 | +; IS________NPM-NEXT: [[TMP0:%.*]] = mul i64 [[LEN]], 8 |
| 50 | +; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 [[TMP0]], align 1 |
| 51 | +; IS________NPM-NEXT: [[CALLOC_BC:%.*]] = bitcast i8* [[TMP1]] to i8* |
| 52 | +; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[CALLOC_BC]], i8 0, i64 [[TMP0]], i1 false) |
| 53 | +; IS________NPM-NEXT: [[RES:%.*]] = call i64 @subfn(i8* [[TMP1]]) [[ATTR2]] |
| 54 | +; IS________NPM-NEXT: ret i64 [[RES]] |
| 55 | +; |
| 56 | +entry: |
| 57 | + %mem = call i8* @calloc(i64 %len, i64 8) |
| 58 | + %res = call i64 @subfn(i8* %mem) |
| 59 | + call void @free(i8* %mem) |
| 60 | + ret i64 %res |
| 61 | +} |
| 62 | + |
| 63 | +attributes #0 = { nounwind willreturn } |
0 commit comments