133 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \3; RUN: | FileCheck %s -check-prefix=RV32I4; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \5; RUN: | FileCheck %s -check-prefix=RV64I6;7; Before getExceptionPointerRegister() and getExceptionSelectorRegister()8; lowering hooks were defined this would trigger an assertion during live9; variable analysis10 11declare void @foo(ptr %p);12declare void @bar(ptr %p);13declare dso_local i32 @__gxx_personality_v0(...)14 15define void @caller(ptr %p) personality ptr @__gxx_personality_v0 {16; RV32I-LABEL: caller:17; RV32I: # %bb.0: # %entry18; RV32I-NEXT: addi sp, sp, -1619; RV32I-NEXT: .cfi_def_cfa_offset 1620; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill21; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill22; RV32I-NEXT: sw s1, 4(sp) # 4-byte Folded Spill23; RV32I-NEXT: .cfi_offset ra, -424; RV32I-NEXT: .cfi_offset s0, -825; RV32I-NEXT: .cfi_offset s1, -1226; RV32I-NEXT: .cfi_remember_state27; RV32I-NEXT: mv s0, a028; RV32I-NEXT: beqz a0, .LBB0_229; RV32I-NEXT: # %bb.1: # %bb230; RV32I-NEXT: .Ltmp0:31; RV32I-NEXT: mv a0, s032; RV32I-NEXT: call bar33; RV32I-NEXT: .Ltmp1:34; RV32I-NEXT: j .LBB0_335; RV32I-NEXT: .LBB0_2: # %bb136; RV32I-NEXT: .Ltmp2:37; RV32I-NEXT: mv a0, s038; RV32I-NEXT: call foo39; RV32I-NEXT: .Ltmp3:40; RV32I-NEXT: .LBB0_3: # %end241; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload42; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload43; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload44; RV32I-NEXT: .cfi_restore ra45; RV32I-NEXT: .cfi_restore s046; RV32I-NEXT: .cfi_restore s147; RV32I-NEXT: addi sp, sp, 1648; RV32I-NEXT: .cfi_def_cfa_offset 049; RV32I-NEXT: ret50; RV32I-NEXT: .LBB0_4: # %lpad51; RV32I-NEXT: .cfi_restore_state52; RV32I-NEXT: .Ltmp4:53; RV32I-NEXT: mv s1, a054; RV32I-NEXT: mv a0, s055; RV32I-NEXT: call callee56; RV32I-NEXT: mv a0, s157; RV32I-NEXT: call _Unwind_Resume58;59; RV64I-LABEL: caller:60; RV64I: # %bb.0: # %entry61; RV64I-NEXT: addi sp, sp, -3262; RV64I-NEXT: .cfi_def_cfa_offset 3263; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill64; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill65; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill66; RV64I-NEXT: .cfi_offset ra, -867; RV64I-NEXT: .cfi_offset s0, -1668; RV64I-NEXT: .cfi_offset s1, -2469; RV64I-NEXT: .cfi_remember_state70; RV64I-NEXT: mv s0, a071; RV64I-NEXT: beqz a0, .LBB0_272; RV64I-NEXT: # %bb.1: # %bb273; RV64I-NEXT: .Ltmp0:74; RV64I-NEXT: mv a0, s075; RV64I-NEXT: call bar76; RV64I-NEXT: .Ltmp1:77; RV64I-NEXT: j .LBB0_378; RV64I-NEXT: .LBB0_2: # %bb179; RV64I-NEXT: .Ltmp2:80; RV64I-NEXT: mv a0, s081; RV64I-NEXT: call foo82; RV64I-NEXT: .Ltmp3:83; RV64I-NEXT: .LBB0_3: # %end284; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload85; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload86; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload87; RV64I-NEXT: .cfi_restore ra88; RV64I-NEXT: .cfi_restore s089; RV64I-NEXT: .cfi_restore s190; RV64I-NEXT: addi sp, sp, 3291; RV64I-NEXT: .cfi_def_cfa_offset 092; RV64I-NEXT: ret93; RV64I-NEXT: .LBB0_4: # %lpad94; RV64I-NEXT: .cfi_restore_state95; RV64I-NEXT: .Ltmp4:96; RV64I-NEXT: mv s1, a097; RV64I-NEXT: mv a0, s098; RV64I-NEXT: call callee99; RV64I-NEXT: mv a0, s1100; RV64I-NEXT: call _Unwind_Resume101entry:102 %0 = icmp eq ptr %p, null103 br i1 %0, label %bb1, label %bb2104 105bb1:106 invoke void @foo(ptr %p) to label %end1 unwind label %lpad107 108bb2:109 invoke void @bar(ptr %p) to label %end2 unwind label %lpad110 111lpad:112 %1 = landingpad { ptr, i32 } cleanup113 call void @callee(ptr %p)114 resume { ptr, i32 } %1115 116end1:117 ret void118 119end2:120 ret void121}122 123define internal void @callee(ptr %p) {124; RV32I-LABEL: callee:125; RV32I: # %bb.0:126; RV32I-NEXT: ret127;128; RV64I-LABEL: callee:129; RV64I: # %bb.0:130; RV64I-NEXT: ret131 ret void132}133