I have created a small ll file to reproduce the problem.
; ModuleID = 'test.c'
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "armv5e-none-linux-androideabi"
; Function Attrs: nounwind
define i32 @main() #0 {
entry:
%retval = alloca i32, align 4
%a = alloca i32, align 4
store i32 0, i32* %retval
store i32 0, i32* %a, align 4
%0 = load i32* %a, align 4
switch i32 %0, label %sw.default [
i32 1, label %sw.bb1
i32 2, label %sw.bb2
i32 3, label %sw.bb3
]
store i32 1, i32* %retval
br label %return
sw.bb1: ; preds = %entry
store i32 2, i32* %retval
br label %return
sw.bb2: ; preds = %entry
store i32 3, i32* %retval
br label %return
sw.bb3: ; preds = %entry
store i32 4, i32* %retval
br label %return
sw.default: ; preds = %entry
br label %sw.epilog
sw.epilog: ; preds = %sw.default
store i32 0, i32* %retval
br label %return
return: ; preds = %sw.epilog, %sw.bb3, %sw.bb2, %sw.bb1, %
sw.bb %2 = load i32* %retval
ret i32 %2
}
; Function Attrs: nounwind
declare i32 @rand() #0
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" }
attributes #1 = { nounwind }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 1, !"min_enum_size", i32 4}
!2 = !{i32 1, !"PIC Level", i32 1}
!3 = !{!"clang version 3.7.0 (trunk 229364)"}