on darwin empty functions need to codegen into something of non-zero length,
[oota-llvm.git] / test / CodeGen / X86 / 2010-03-17-ISelBug.ll
1 ; RUN: llc < %s -mtriple=i386-apple-darwin5
2 ; rdar://7761790
3
4 %"struct..0$_485" = type { i16, i16, i32 }
5 %union.PPToken = type { %"struct..0$_485" }
6 %struct.PPOperation = type { %union.PPToken, %union.PPToken, [6 x %union.PPToken], i32, i32, i32, [1 x i32], [0 x i8] }
7
8 define i32* @t() align 2 nounwind {
9 entry:
10   %operation = alloca %struct.PPOperation, align 8 ; <%struct.PPOperation*> [#uses=2]
11   %0 = load i32*** null, align 4  ; [#uses=1]
12   %1 = ptrtoint i32** %0 to i32   ; <i32> [#uses=1]
13   %2 = sub nsw i32 %1, undef                      ; <i32> [#uses=2]
14   br i1 false, label %bb20, label %bb.nph380
15
16 bb20:                                             ; preds = %entry
17   ret i32* null
18
19 bb.nph380:                                        ; preds = %entry
20   %scevgep403 = getelementptr %struct.PPOperation* %operation, i32 0, i32 1, i32 0, i32 2 ; <i32*> [#uses=1]
21   %3 = ashr i32 %2, 1                             ; <i32> [#uses=1]
22   %tmp405 = and i32 %3, -2                        ; <i32> [#uses=1]
23   %scevgep408 = getelementptr %struct.PPOperation* %operation, i32 0, i32 1, i32 0, i32 1 ; <i16*> [#uses=1]
24   %tmp410 = and i32 %2, -4                        ; <i32> [#uses=1]
25   br label %bb169
26
27 bb169:                                            ; preds = %bb169, %bb.nph380
28   %index.6379 = phi i32 [ 0, %bb.nph380 ], [ %4, %bb169 ] ; <i32> [#uses=3]
29   %tmp404 = mul i32 %index.6379, -2               ; <i32> [#uses=1]
30   %tmp406 = add i32 %tmp405, %tmp404              ; <i32> [#uses=1]
31   %scevgep407 = getelementptr i32* %scevgep403, i32 %tmp406 ; <i32*> [#uses=1]
32   %tmp409 = mul i32 %index.6379, -4               ; <i32> [#uses=1]
33   %tmp411 = add i32 %tmp410, %tmp409              ; <i32> [#uses=1]
34   %scevgep412 = getelementptr i16* %scevgep408, i32 %tmp411 ; <i16*> [#uses=1]
35   store i16 undef, i16* %scevgep412, align 2
36   store i32 undef, i32* %scevgep407, align 4
37   %4 = add nsw i32 %index.6379, 1                 ; <i32> [#uses=1]
38   br label %bb169
39 }