[llvm] 23b7e15 - [RISCV] Copy test from mem.ll to mem64.ll for completeness. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 18:45:17 PDT 2022


Author: Craig Topper
Date: 2022-04-29T18:41:56-07:00
New Revision: 23b7e15c675513c53a6d448e6b7cb95d6c1df029

URL: https://github.com/llvm/llvm-project/commit/23b7e15c675513c53a6d448e6b7cb95d6c1df029
DIFF: https://github.com/llvm/llvm-project/commit/23b7e15c675513c53a6d448e6b7cb95d6c1df029.diff

LOG: [RISCV] Copy test from mem.ll to mem64.ll for completeness. NFC

Add nounwind to both copies.

Addresses post-commit feedback from f91690f7db96aae16425241a17fe6649f5d156b4

Added: 
    

Modified: 
    llvm/test/CodeGen/RISCV/mem.ll
    llvm/test/CodeGen/RISCV/mem64.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/RISCV/mem.ll b/llvm/test/CodeGen/RISCV/mem.ll
index c6c3ce8f649b..00bd830788c7 100644
--- a/llvm/test/CodeGen/RISCV/mem.ll
+++ b/llvm/test/CodeGen/RISCV/mem.ll
@@ -243,13 +243,11 @@ define i32 @lw_sw_far_local(i32* %a, i32 %b)  {
 ; Make sure we don't remove the addi and fold the C from
 ; (add (addi FrameIndex, C), X) into the store address.
 ; FrameIndex cannot be the operand of an ADD. We must keep the ADDI.
-define void @addi_fold_crash(i32 %arg) {
+define void @addi_fold_crash(i32 %arg) nounwind {
 ; RV32I-LABEL: addi_fold_crash:
 ; RV32I:       # %bb.0: # %bb
 ; RV32I-NEXT:    addi sp, sp, -16
-; RV32I-NEXT:    .cfi_def_cfa_offset 16
 ; RV32I-NEXT:    sw ra, 12(sp) # 4-byte Folded Spill
-; RV32I-NEXT:    .cfi_offset ra, -4
 ; RV32I-NEXT:    addi a1, sp, 12
 ; RV32I-NEXT:    add a0, a1, a0
 ; RV32I-NEXT:    sb zero, 0(a0)

diff  --git a/llvm/test/CodeGen/RISCV/mem64.ll b/llvm/test/CodeGen/RISCV/mem64.ll
index 74f52ff12e65..9b86be8039d2 100644
--- a/llvm/test/CodeGen/RISCV/mem64.ll
+++ b/llvm/test/CodeGen/RISCV/mem64.ll
@@ -269,3 +269,32 @@ define i64 @lw_sw_far_local(i64* %a, i64 %b)  {
   store i64 %b, i64* %1
   ret i64 %2
 }
+
+%struct.quux = type { i32, [0 x i8] }
+
+; Make sure we don't remove the addi and fold the C from
+; (add (addi FrameIndex, C), X) into the store address.
+; FrameIndex cannot be the operand of an ADD. We must keep the ADDI.
+define void @addi_fold_crash(i64 %arg) nounwind {
+; RV64I-LABEL: addi_fold_crash:
+; RV64I:       # %bb.0: # %bb
+; RV64I-NEXT:    addi sp, sp, -16
+; RV64I-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
+; RV64I-NEXT:    addi a1, sp, 4
+; RV64I-NEXT:    add a0, a1, a0
+; RV64I-NEXT:    sb zero, 0(a0)
+; RV64I-NEXT:    mv a0, a1
+; RV64I-NEXT:    call snork at plt
+; RV64I-NEXT:    ld ra, 8(sp) # 8-byte Folded Reload
+; RV64I-NEXT:    addi sp, sp, 16
+; RV64I-NEXT:    ret
+bb:
+  %tmp = alloca %struct.quux, align 4
+  %tmp1 = getelementptr inbounds %struct.quux, %struct.quux* %tmp, i64 0, i32 1
+  %tmp2 = getelementptr inbounds %struct.quux, %struct.quux* %tmp, i64 0, i32 1, i64 %arg
+  store i8 0, i8* %tmp2, align 1
+  call void @snork([0 x i8]* %tmp1)
+  ret void
+}
+
+declare void @snork([0 x i8]*)


        


More information about the llvm-commits mailing list