55 lines · plain
1; Check the inliner doesn't inline a function with a stack size exceeding a given limit.2; RUN: opt < %s -passes=inline -S | FileCheck --check-prefixes=ALL,UNLIMITED %s3; RUN: opt < %s -passes=inline -S -inline-max-stacksize=256 | FileCheck --check-prefixes=ALL,LIMITED %s4 5declare void @init(ptr)6 7define internal i32 @foo() {8 %1 = alloca [65 x i32], align 169 call void @init(ptr %1)10 %2 = load i32, ptr %1, align 411 ret i32 %212}13 14define i32 @barNoAttr() {15 %1 = call i32 @foo()16 ret i32 %117; ALL: define {{.*}}@barNoAttr18; ALL-NOT: define19; UNLIMITED-NOT: call {{.*}}@foo20; LIMITED: call {{.*}}@foo21}22 23; Check that, under the imposed limit, baz() inlines bar(), but not foo().24define i32 @bazNoAttr() {25 %1 = call i32 @barNoAttr()26 ret i32 %127; ALL: define {{.*}}@baz28; UNLIMITED-NOT: call {{.*}}@barNoAttr29; UNLIMITED-NOT: call {{.*}}@foo30; LIMITED-NOT: call {{.*}}@barNoAttr31; LIMITED: call {{.*}}@foo32}33 34; Check that the function attribute prevents inlining of foo().35define i32 @barAttr() #0 {36 %1 = call i32 @foo()37 ret i32 %138; ALL: define {{.*}}@barAttr39; ALL-NOT: define40; ALL: call {{.*}}@foo41}42 43; Check that the commandline option overrides the function attribute.44define i32 @bazAttr() #1 {45 %1 = call i32 @barAttr()46 ret i32 %147; ALL: define {{.*}}@bazAttr48; UNLIMITED-NOT: call {{.*}}@barAttr49; UNLIMITED-NOT: call {{.*}}@foo50; LIMITED: call {{.*}}@foo51}52 53attributes #0 = { "inline-max-stacksize"="256" }54attributes #1 = { "inline-max-stacksize"="512" }55