brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 61f759c Raw
46 lines · plain
1; Test that functions with dynamic allocas get inlined in a case where2; naively inlining it would result in a miscompilation.3; Functions with dynamic allocas can only be inlined into functions that4; already have dynamic allocas.5 6; RUN: opt < %s -passes=inline -S | FileCheck %s7;8; FIXME: This test is xfailed because the inline cost rewrite disabled *all*9; inlining of functions which contain a dynamic alloca. It should be re-enabled10; once that functionality is restored.11; XFAIL: *12 13declare void @ext(ptr)14 15define internal void @callee(i32 %N) {16  %P = alloca i32, i32 %N17  call void @ext(ptr %P)18  ret void19}20 21define void @foo(i32 %N) {22; CHECK-LABEL: @foo(23; CHECK: alloca i32, i32 %{{.*}}24; CHECK: call ptr @llvm.stacksave()25; CHECK: alloca i32, i32 %{{.*}}26; CHECK: call void @ext27; CHECK: call void @llvm.stackrestore28; CHECK: ret29 30entry:31  %P = alloca i32, i32 %N32  call void @ext(ptr %P)33  br label %loop34 35loop:36  %count = phi i32 [ 0, %entry ], [ %next, %loop ]37  %next = add i32 %count, 138  call void @callee(i32 %N)39  %cond = icmp eq i32 %count, 10000040  br i1 %cond, label %out, label %loop41 42out:43  ret void44}45 46