diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 17:45:36 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 17:45:47 -0800 |
commit | b01d1845c4a4155db54da713691d86e2d2f42040 (patch) | |
tree | ad926566a6bde12c346df151a4a103b41d4519f0 /tests | |
parent | 328f383f7c8b97b94d9a50e6adf68981036f0a30 (diff) |
handle a single empty alloca; fixes #1919
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/emptyalloca.ll | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/cases/emptyalloca.ll b/tests/cases/emptyalloca.ll new file mode 100644 index 00000000..f12a4161 --- /dev/null +++ b/tests/cases/emptyalloca.ll @@ -0,0 +1,31 @@ +; ModuleID = '/tmp/tmpjSNiky/a.out.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +@.str = private unnamed_addr constant [30 x i8] c"Module.print('hello, world!')\00", align 1 + +; Function Attrs: nounwind +define internal void @_Z9doNothingPi(i32* %arr) #0 { + %1 = alloca i32*, align 4 + store i32* %arr, i32** %1, align 4 + ret void +} + +define i32 @main() #1 { + %arr = alloca [0 x i32], align 4 + %1 = bitcast [0 x i32]* %arr to i8* + call void @llvm.memset.p0i8.i32(i8* %1, i8 0, i32 0, i32 4, i1 false) + %2 = getelementptr inbounds [0 x i32]* %arr, i32 0, i32 0 + call void @_Z9doNothingPi(i32* %2) + call void @emscripten_asm_const(i8* getelementptr inbounds ([30 x i8]* @.str, i32 0, i32 0)) + ret i32 0 +} + +; Function Attrs: nounwind +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #2 + +declare void @emscripten_asm_const(i8*) #1 + +attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind } |