1; RUN: llc < %s
2; PR4769
3target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"
4target triple = "msp430-generic-generic"
5
6define i16 @foo() nounwind readnone {
7entry:
8  %result = alloca i16, align 1                   ; <i16*> [#uses=2]
9  store volatile i16 0, i16* %result
10  %tmp = load volatile i16, i16* %result               ; <i16> [#uses=1]
11  ret i16 %tmp
12}
13
14define i16 @main() nounwind {
15entry:
16  br label %while.cond
17
18while.cond:                                       ; preds = %while.cond, %entry
19  %call = call i16 @bar() nounwind                ; <i16> [#uses=1]
20  %tobool = icmp eq i16 %call, 0                  ; <i1> [#uses=1]
21  br i1 %tobool, label %while.end, label %while.cond
22
23while.end:                                        ; preds = %while.cond
24  %result.i = alloca i16, align 1                 ; <i16*> [#uses=2]
25  store volatile i16 0, i16* %result.i
26  %tmp.i = load volatile i16, i16* %result.i           ; <i16> [#uses=0]
27  ret i16 0
28}
29
30declare i16 @bar()
31