llvm.org GIT mirror llvm / d3aa25e
Don't crash trying to promote VLAs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79226 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 10 years ago
2 changed file(s) with 27 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
254254 // value cannot be decomposed at all.
255255 uint64_t AllocaSize = TD->getTypeAllocSize(AI->getAllocatedType());
256256
257 // Do not promote [0 x %struct].
258 if (AllocaSize == 0) continue;
259
257260 // Do not promote any struct whose size is too big.
258261 if (AllocaSize > SRThreshold) continue;
259
262
260263 if ((isa(AI->getAllocatedType()) ||
261264 isa(AI->getAllocatedType())) &&
262265 // Do not promote any struct into more than "32" separate vars.
0 ; RUN: llvm-as < %s | opt -scalarrepl -disable-opt
1
2 %struct.Item = type { [4 x i16], %struct.rule* }
3 %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 }
4 %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* }
5 %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* }
6 %struct.list = type { i8*, %struct.list* }
7 %struct.stateMap = type { i8*, %struct.plank*, i32, i16* }
8 %struct.plank = type { i8*, %struct.list*, i32 }
9 %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] }
10 %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* }
11 %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** }
12 %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* }
13 %struct.Index_Map = type { i32, %struct.item_set** }
14 %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* }
15 %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** }
16
17 define void @addHP_2_0() {
18 bb4.i:
19 %0 = malloc [0 x %struct.Item] ; <[0 x %struct.Item]*> [#uses=1]
20 %.sub.i.c.i = getelementptr [0 x %struct.Item]* %0, i32 0, i32 0 ; <%struct.Item*> [#uses=0]
21 unreachable
22 }