1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; This test ensures that alloca instructions in the entry block for an inlined
3 ; function are moved to the top of the function they are inlined into.
5 ; RUN: opt -S -inline < %s | FileCheck %s
6 ; RUN: opt -S -passes='cgscc(inline)' < %s | FileCheck %s
8 define i32 @func(i32 %i) {
16 define i32 @main(i32 %argc) {
19 ; CHECK-NEXT: [[X_I:%.*]] = alloca i32
23 %X = call i32 @func( i32 7 )
24 %Y = add i32 %X, %argc
28 ; https://llvm.org/bugs/show_bug.cgi?id=27277
29 ; Don't assume that the size is a ConstantInt (an undef value is also a constant).
31 define void @PR27277(i32 %p1) {
32 ; CHECK-LABEL: @PR27277(
33 ; CHECK-NEXT: [[VLA:%.*]] = alloca double, i32 %p1
34 ; CHECK-NEXT: call void @PR27277(i32 undef)
35 ; CHECK-NEXT: ret void
37 %vla = alloca double, i32 %p1
38 call void @PR27277(i32 undef)
42 ; Don't assume that the size is a ConstantInt (a ConstExpr is also a constant).
44 @GV = common global i32* null
46 define void @PR27277_part2(i32 %p1) {
47 ; CHECK-LABEL: @PR27277_part2(
48 ; CHECK-NEXT: [[VLA:%.*]] = alloca double, i32 %p1
49 ; CHECK-NEXT: call void @PR27277_part2(i32 ptrtoint (i32** @GV to i32))
50 ; CHECK-NEXT: ret void
52 %vla = alloca double, i32 %p1
53 call void @PR27277_part2(i32 ptrtoint (i32** @GV to i32))