57 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; This test ensures that alloca instructions in the entry block for an inlined3; function are moved to the top of the function they are inlined into.4;5; RUN: opt -S -passes=inline < %s | FileCheck %s6; RUN: opt -S -passes='cgscc(inline)' < %s | FileCheck %s7 8define i32 @func(i32 %i) {9 %X = alloca i3210 store i32 %i, ptr %X11 ret i32 %i12}13 14declare void @bar()15 16define i32 @main(i32 %argc) {17; CHECK-LABEL: @main(18; CHECK-NEXT: Entry:19; CHECK-NEXT: [[X_I:%.*]] = alloca i3220;21Entry:22 call void @bar( )23 %X = call i32 @func( i32 7 )24 %Y = add i32 %X, %argc25 ret i32 %Y26}27 28; https://llvm.org/bugs/show_bug.cgi?id=2727729; Don't assume that the size is a ConstantInt (an undef value is also a constant).30 31define void @PR27277(i32 %p1) {32; CHECK-LABEL: @PR27277(33; CHECK-NEXT: [[VLA:%.*]] = alloca double, i32 %p134; CHECK-NEXT: call void @PR27277(i32 undef)35; CHECK-NEXT: ret void36;37 %vla = alloca double, i32 %p138 call void @PR27277(i32 undef)39 ret void40}41 42; Don't assume that the size is a ConstantInt (a ConstExpr is also a constant).43 44@GV = common global ptr null45 46define void @PR27277_part2(i32 %p1) {47; CHECK-LABEL: @PR27277_part2(48; CHECK-NEXT: [[VLA:%.*]] = alloca double, i32 %p149; CHECK-NEXT: call void @PR27277_part2(i32 ptrtoint (ptr @GV to i32))50; CHECK-NEXT: ret void51;52 %vla = alloca double, i32 %p153 call void @PR27277_part2(i32 ptrtoint (ptr @GV to i32))54 ret void55}56 57