@@ -239,3 +239,40 @@ define i32 @oneusecmp(i32 %a, i32 %b, i32 %d) {
239
239
%x = add i32 %s , %s2
240
240
ret i32 %x
241
241
}
242
+
243
+ define i32 @branch_sext_ret (i32 %x ) {
244
+ ; RV32-LABEL: branch_sext_ret:
245
+ ; RV32: # %bb.0: # %entry
246
+ ; RV32-NEXT: beqz a0, .LBB11_2
247
+ ; RV32-NEXT: # %bb.1: # %if.then
248
+ ; RV32-NEXT: ret
249
+ ; RV32-NEXT: .LBB11_2: # %if.end
250
+ ; RV32-NEXT: addi sp, sp, -16
251
+ ; RV32-NEXT: .cfi_def_cfa_offset 16
252
+ ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
253
+ ; RV32-NEXT: .cfi_offset ra, -4
254
+ ; RV32-NEXT: call abort
255
+ ;
256
+ ; RV64-LABEL: branch_sext_ret:
257
+ ; RV64: # %bb.0: # %entry
258
+ ; RV64-NEXT: sext.w a1, a0
259
+ ; RV64-NEXT: beqz a1, .LBB11_2
260
+ ; RV64-NEXT: # %bb.1: # %if.then
261
+ ; RV64-NEXT: ret
262
+ ; RV64-NEXT: .LBB11_2: # %if.end
263
+ ; RV64-NEXT: addi sp, sp, -16
264
+ ; RV64-NEXT: .cfi_def_cfa_offset 16
265
+ ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
266
+ ; RV64-NEXT: .cfi_offset ra, -8
267
+ ; RV64-NEXT: call abort
268
+ entry:
269
+ %cmp.not = icmp eq i32 %x , 0
270
+ br i1 %cmp.not , label %if.end , label %if.then
271
+ if.then:
272
+ ret i32 %x
273
+ if.end:
274
+ tail call void @abort () #2
275
+ unreachable
276
+ }
277
+
278
+ declare void @abort ()
0 commit comments