52 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes2; Check that when argument promotion changes a function in some parent node of3; the call graph, any analyses that happened to be cached for that function are4; actually invalidated. We are using `demanded-bits` here because when printed5; it will end up caching a value for every instruction, making it easy to6; detect the instruction-level changes that will fail here. With improper7; invalidation this will crash in the second printer as it tries to reuse8; now-invalid demanded bits.9;10; RUN: opt < %s -passes='function(print<demanded-bits>),cgscc(argpromotion,function(print<demanded-bits>))' -S | FileCheck %s11 12@G = constant i32 013 14define internal i32 @a(ptr %x) {15; CHECK-LABEL: define {{[^@]+}}@a16; CHECK-SAME: (i32 [[X_0_VAL:%.*]]) {17; CHECK-NEXT: entry:18; CHECK-NEXT: ret i32 [[X_0_VAL]]19;20entry:21 %v = load i32, ptr %x22 ret i32 %v23}24 25define i32 @b() {26; CHECK-LABEL: define {{[^@]+}}@b() {27; CHECK-NEXT: entry:28; CHECK-NEXT: [[G_VAL:%.*]] = load i32, ptr @G, align 429; CHECK-NEXT: [[V:%.*]] = call i32 @a(i32 [[G_VAL]])30; CHECK-NEXT: ret i32 [[V]]31;32entry:33 %v = call i32 @a(ptr @G)34 ret i32 %v35}36 37define i32 @c() {38; CHECK-LABEL: define {{[^@]+}}@c() {39; CHECK-NEXT: entry:40; CHECK-NEXT: [[G_VAL:%.*]] = load i32, ptr @G, align 441; 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]]45;46entry:47 %v1 = call i32 @a(ptr @G)48 %v2 = call i32 @b()49 %result = add i32 %v1, %v250 ret i32 %result51}52