[WebAssembly] Don't perform the returned-argument optimization on constants.
[oota-llvm.git] / test / CodeGen / ARM / 2011-11-28-DAGCombineBug.ll
1 ; RUN: llc < %s -mtriple=thumbv7-apple-ios5.0.0 | FileCheck %s
2 ; rdar://10464621
3
4 ; DAG combine increases loads from packed types. ARM load / store optimizer then
5 ; combined them into a ldm which causes runtime exception.
6
7 %struct.InformationBlock = type <{ i32, %struct.FlagBits, %struct.FlagBits }>
8 %struct.FlagBits = type <{ [4 x i32] }>
9
10 @infoBlock = external global %struct.InformationBlock
11
12 define hidden void @foo() {
13 ; CHECK-LABEL: foo:
14 ; CHECK: ldr.w
15 ; CHECK: ldr.w
16 ; CHECK-NOT: ldm
17 entry:
18   %tmp13 = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 1, i32 0, i32 0), align 1
19   %tmp15 = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 1, i32 0, i32 1), align 1
20   %tmp17 = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 1, i32 0, i32 2), align 1
21   %tmp19 = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 1, i32 0, i32 3), align 1
22   %tmp = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 2, i32 0, i32 0), align 1
23   %tmp3 = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 2, i32 0, i32 1), align 1
24   %tmp4 = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 2, i32 0, i32 2), align 1
25   %tmp5 = load i32, i32* getelementptr inbounds (%struct.InformationBlock, %struct.InformationBlock* @infoBlock, i32 0, i32 2, i32 0, i32 3), align 1
26   %insert21 = insertvalue [4 x i32] undef, i32 %tmp13, 0
27   %insert23 = insertvalue [4 x i32] %insert21, i32 %tmp15, 1
28   %insert25 = insertvalue [4 x i32] %insert23, i32 %tmp17, 2
29   %insert27 = insertvalue [4 x i32] %insert25, i32 %tmp19, 3
30   %insert = insertvalue [4 x i32] undef, i32 %tmp, 0
31   %insert7 = insertvalue [4 x i32] %insert, i32 %tmp3, 1
32   %insert9 = insertvalue [4 x i32] %insert7, i32 %tmp4, 2
33   %insert11 = insertvalue [4 x i32] %insert9, i32 %tmp5, 3
34   tail call void @bar([4 x i32] %insert27, [4 x i32] %insert11)
35   ret void
36 }
37
38 declare void @bar([4 x i32], [4 x i32])