1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
4 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
6 ; Checks if !prof metadata is corret in deadargelim.
8 define void @caller() #0 {
9 ; TUNIT-LABEL: define {{[^@]+}}@caller() {
10 ; TUNIT-NEXT: [[X:%.*]] = alloca i32, align 4
11 ; TUNIT-NEXT: store i32 42, ptr [[X]], align 4
12 ; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[X]], align 4
13 ; TUNIT-NEXT: call void @promote_i32_ptr(i32 [[TMP1]]), !prof [[PROF0:![0-9]+]]
14 ; TUNIT-NEXT: ret void
16 ; CGSCC-LABEL: define {{[^@]+}}@caller() {
17 ; CGSCC-NEXT: call void @promote_i32_ptr(i32 noundef 42), !prof [[PROF0:![0-9]+]]
18 ; CGSCC-NEXT: ret void
22 call void @promote_i32_ptr(ptr %x), !prof !0
26 define internal void @promote_i32_ptr(ptr %xp) {
27 ; CHECK: Function Attrs: memory(readwrite, argmem: none)
28 ; CHECK-LABEL: define {{[^@]+}}@promote_i32_ptr
29 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
30 ; CHECK-NEXT: [[XP_PRIV:%.*]] = alloca i32, align 4
31 ; CHECK-NEXT: store i32 [[TMP0]], ptr [[XP_PRIV]], align 4
32 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[XP_PRIV]], align 4
33 ; CHECK-NEXT: call void @use_i32(i32 [[X]])
34 ; CHECK-NEXT: ret void
36 %x = load i32, ptr %xp
37 call void @use_i32(i32 %x)
41 declare void @use_i32(i32)
43 !0 = !{!"branch_weights", i32 30}
45 ; TUNIT: attributes #[[ATTR0]] = { memory(readwrite, argmem: none) }
47 ; CGSCC: attributes #[[ATTR0]] = { memory(readwrite, argmem: none) }
49 ; TUNIT: [[PROF0]] = !{!"branch_weights", i32 30}
51 ; CGSCC: [[PROF0]] = !{!"branch_weights", i32 30}