1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2 ; Check that when argument promotion changes a function in some parent node of
3 ; the call graph, any analyses that happened to be cached for that function are
4 ; actually invalidated. We are using `demanded-bits` here because when printed
5 ; it will end up caching a value for every instruction, making it easy to
6 ; detect the instruction-level changes that will fail here. With improper
7 ; invalidation this will crash in the second printer as it tries to reuse
8 ; now-invalid demanded bits.
10 ; RUN: opt < %s -passes='function(print<demanded-bits>),cgscc(argpromotion,function(print<demanded-bits>))' -S | FileCheck %s
14 define internal i32 @a(ptr %x) {
15 ; CHECK-LABEL: define {{[^@]+}}@a
16 ; CHECK-SAME: (i32 [[X_0_VAL:%.*]]) {
18 ; CHECK-NEXT: ret i32 [[X_0_VAL]]
26 ; CHECK-LABEL: define {{[^@]+}}@b() {
28 ; CHECK-NEXT: [[G_VAL:%.*]] = load i32, ptr @G, align 4
29 ; CHECK-NEXT: [[V:%.*]] = call i32 @a(i32 [[G_VAL]])
30 ; CHECK-NEXT: ret i32 [[V]]
33 %v = call i32 @a(ptr @G)
38 ; CHECK-LABEL: define {{[^@]+}}@c() {
40 ; CHECK-NEXT: [[G_VAL:%.*]] = load i32, ptr @G, align 4
41 ; CHECK-NEXT: [[V1:%.*]] = call i32 @a(i32 [[G_VAL]])
42 ; CHECK-NEXT: [[V2:%.*]] = call i32 @b()
43 ; CHECK-NEXT: [[RESULT:%.*]] = add i32 [[V1]], [[V2]]
44 ; CHECK-NEXT: ret i32 [[RESULT]]
47 %v1 = call i32 @a(ptr @G)
49 %result = add i32 %v1, %v2