136 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -verify-machineinstrs -mtriple=wasm32-unknown-unknown < %s | FileCheck -check-prefix=WASM32 %s3 4@"\01LC" = internal constant [11 x i8] c"buf == %s\0A\00" ; <ptr> [#uses=1]5 6define void @test(ptr %a) nounwind ssp {7; WASM32-LABEL: test:8; WASM32: .functype test (i32) -> ()9; WASM32-NEXT: .local i3210; WASM32-NEXT: # %bb.0: # %entry11; WASM32-NEXT: global.get __stack_pointer12; WASM32-NEXT: i32.const 3213; WASM32-NEXT: i32.sub14; WASM32-NEXT: local.tee 115; WASM32-NEXT: global.set __stack_pointer16; WASM32-NEXT: local.get 117; WASM32-NEXT: local.get 018; WASM32-NEXT: i32.store 1619; WASM32-NEXT: local.get 120; WASM32-NEXT: i32.const 021; WASM32-NEXT: i32.load __stack_chk_guard22; WASM32-NEXT: i32.store 2823; WASM32-NEXT: local.get 124; WASM32-NEXT: i32.const 2025; WASM32-NEXT: i32.add26; WASM32-NEXT: local.get 027; WASM32-NEXT: call strcpy28; WASM32-NEXT: drop29; WASM32-NEXT: local.get 130; WASM32-NEXT: local.get 131; WASM32-NEXT: i32.const 2032; WASM32-NEXT: i32.add33; WASM32-NEXT: i32.store 034; WASM32-NEXT: i32.const LC35; WASM32-NEXT: local.get 136; WASM32-NEXT: call printf37; WASM32-NEXT: drop38; WASM32-NEXT: block39; WASM32-NEXT: i32.const 040; WASM32-NEXT: i32.load __stack_chk_guard41; WASM32-NEXT: local.get 142; WASM32-NEXT: i32.load 2843; WASM32-NEXT: i32.eq44; WASM32-NEXT: br_if 0 # 0: down to label045; WASM32-NEXT: # %bb.1: # %return46; WASM32-NEXT: call __stack_chk_fail47; WASM32-NEXT: unreachable48; WASM32-NEXT: .LBB0_2: # %return49; WASM32-NEXT: end_block # label0:50; WASM32-NEXT: local.get 151; WASM32-NEXT: i32.const 3252; WASM32-NEXT: i32.add53; WASM32-NEXT: global.set __stack_pointer54; WASM32-NEXT: # fallthrough-return55entry:56 %a_addr = alloca ptr ; <ptr> [#uses=2]57 %buf = alloca [8 x i8] ; <ptr> [#uses=2]58 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]59 store ptr %a, ptr %a_addr60 %0 = load ptr, ptr %a_addr, align 4 ; <ptr> [#uses=1]61 %1 = call ptr @strcpy(ptr %buf, ptr %0) nounwind ; <ptr> [#uses=0]62 %2 = call i32 (ptr, ...) @printf(ptr @"\01LC", ptr %buf) nounwind ; <i32> [#uses=0]63 br label %return64 65return: ; preds = %entry66 ret void67}68 69define i32 @test_return_i32(ptr %a) nounwind ssp {70; WASM32-LABEL: test_return_i32:71; WASM32: .functype test_return_i32 (i32) -> (i32)72; WASM32-NEXT: .local i3273; WASM32-NEXT: # %bb.0: # %entry74; WASM32-NEXT: global.get __stack_pointer75; WASM32-NEXT: i32.const 3276; WASM32-NEXT: i32.sub77; WASM32-NEXT: local.tee 178; WASM32-NEXT: global.set __stack_pointer79; WASM32-NEXT: local.get 180; WASM32-NEXT: local.get 081; WASM32-NEXT: i32.store 1682; WASM32-NEXT: local.get 183; WASM32-NEXT: i32.const 084; WASM32-NEXT: i32.load __stack_chk_guard85; WASM32-NEXT: i32.store 2886; WASM32-NEXT: local.get 187; WASM32-NEXT: i32.const 2088; WASM32-NEXT: i32.add89; WASM32-NEXT: local.get 090; WASM32-NEXT: call strcpy91; WASM32-NEXT: drop92; WASM32-NEXT: local.get 193; WASM32-NEXT: local.get 194; WASM32-NEXT: i32.const 2095; WASM32-NEXT: i32.add96; WASM32-NEXT: i32.store 097; WASM32-NEXT: i32.const LC98; WASM32-NEXT: local.get 199; WASM32-NEXT: call printf100; WASM32-NEXT: drop101; WASM32-NEXT: block102; WASM32-NEXT: i32.const 0103; WASM32-NEXT: i32.load __stack_chk_guard104; WASM32-NEXT: local.get 1105; WASM32-NEXT: i32.load 28106; WASM32-NEXT: i32.eq107; WASM32-NEXT: br_if 0 # 0: down to label1108; WASM32-NEXT: # %bb.1: # %return109; WASM32-NEXT: call __stack_chk_fail110; WASM32-NEXT: unreachable111; WASM32-NEXT: .LBB1_2: # %return112; WASM32-NEXT: end_block # label1:113; WASM32-NEXT: local.get 1114; WASM32-NEXT: i32.const 32115; WASM32-NEXT: i32.add116; WASM32-NEXT: global.set __stack_pointer117; WASM32-NEXT: i32.const 0118; WASM32-NEXT: # fallthrough-return119entry:120 %a_addr = alloca ptr ; <ptr> [#uses=2]121 %buf = alloca [8 x i8] ; <ptr> [#uses=2]122 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]123 store ptr %a, ptr %a_addr124 %0 = load ptr, ptr %a_addr, align 4 ; <ptr> [#uses=1]125 %1 = call ptr @strcpy(ptr %buf, ptr %0) nounwind ; <ptr> [#uses=0]126 %2 = call i32 (ptr, ...) @printf(ptr @"\01LC", ptr %buf) nounwind ; <i32> [#uses=0]127 br label %return128 129return: ; preds = %entry130 ret i32 0131}132 133declare ptr @strcpy(ptr, ptr) nounwind134 135declare i32 @printf(ptr, ...) nounwind136