Skip to content

Commit b153cc5

Browse files
committed
[RISCV] Fix boundary error in compress-opt-select.ll
Per the comment, this test is intending to test the first constant which can't be encoded via a c.addi. However, -32 *can* be encoded as in a c.addi, and all that's preventing it from doing so is the register allocators choice to use a difference destination register on the add than it's source. (Which compressed doesn't support.) The current LLC codegen for this test looks like: addi a1, a0, -32 li a0, -99 bnez a1, .LBB0_2 li a0, 42 .LBB0_2: ret After llvm#108889, we sink the LI, and the register allocator picks the same source and dest register for the addi resulting in the c.addi form being emitted. So, to avoid a confusing diff let's fix the test to check what was originally intended.
1 parent 267ad43 commit b153cc5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/test/CodeGen/RISCV/compress-opt-select.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ define i32 @f_small_edge_neg(i32 %in0) minsize {
9191
; constant is medium and not fit in 6 bit (compress imm),
9292
; but fit in 12 bit (imm)
9393
; RV32IFDC-LABEL: <f_medium_ledge_pos>:
94-
; RV32IFDC: addi [[MAYZEROREG:.*]], [[REG:.*]], -0x20
94+
; RV32IFDC: addi [[MAYZEROREG:.*]], [[REG:.*]], -0x21
9595
; RV32IFDC: RESBROPT [[MAYZEROREG]], [[PLACE:.*]]
9696
; --- no compress extension
9797
; RV32IFD-LABEL: <f_medium_ledge_pos>:
98-
; RV32IFD: addi [[REG:.*]], zero, 0x20
98+
; RV32IFD: addi [[REG:.*]], zero, 0x21
9999
; RV32IFD: RESBRNORMAL [[ANOTHER:.*]], [[REG]], [[PLACE:.*]]
100100
define i32 @f_medium_ledge_pos(i32 %in0) minsize {
101-
%cmp = icmp CMPCOND i32 %in0, 32
101+
%cmp = icmp CMPCOND i32 %in0, 33
102102
%toRet = select i1 %cmp, i32 -99, i32 42
103103
ret i32 %toRet
104104
}

0 commit comments

Comments
 (0)