This is an archive of the discontinued LLVM Phabricator instance.

[LoongArch] Support lowering frames larger than 2048 bytes
ClosedPublic

Authored by xen0n on Sep 24 2022, 3:09 AM.

Diff Detail

Event Timeline

xen0n created this revision.Sep 24 2022, 3:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2022, 3:09 AM
xen0n requested review of this revision.Sep 24 2022, 3:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2022, 3:09 AM

Had better to add some tests.

llvm/lib/Target/LoongArch/LoongArchRegisterInfo.cpp
138
xen0n marked an inline comment as done.Sep 25 2022, 8:53 PM
xen0n added inline comments.
llvm/lib/Target/LoongArch/LoongArchRegisterInfo.cpp
138

No it's two sentences so the suggestion is wrong.

I'll add the trailing periods though (obviously the current expression can be interpreted ambiguously by non-native speakers judging from this). Thanks for the catch!

SixWeining added inline comments.Sep 25 2022, 10:10 PM
llvm/lib/Target/LoongArch/LoongArchRegisterInfo.cpp
138

Oh, my bad :) Thanks.

xen0n updated this revision to Diff 462831.Sep 26 2022, 12:56 AM
xen0n marked an inline comment as done.

cosmetic fixes and testcase addition

SixWeining added inline comments.Sep 26 2022, 5:16 AM
llvm/test/CodeGen/LoongArch/frame.ll
34–56

How about this IR which is simpler:

define void @test_large_frame_size_2032() {
; CHECK-LABEL: test_large_frame_size_2032:
; CHECK:       # %bb.0:
; CHECK-NEXT:    addi.d $sp, $sp, -2032
; CHECK-NEXT:    .cfi_def_cfa_offset 2032
; CHECK-NEXT:    addi.d $sp, $sp, 2032
; CHECK-NEXT:    ret
  %1 = alloca i8, i32 2032
  ret void
}
xen0n updated this revision to Diff 462870.Sep 26 2022, 5:22 AM

simplify the test cases

xen0n marked an inline comment as done.Sep 26 2022, 5:25 AM
xen0n added inline comments.
llvm/test/CodeGen/LoongArch/frame.ll
34–56

Thanks for the suggestion; I adapted CodeGen/Generic/2010-11-04-BigByval.ll which also happened to expose the suboptimal codegen. Your version is simpler and focuses solely on the frame size handling, which I'll take. Thanks.

LGTM. Thanks. Others may also have a look.

llvm/test/CodeGen/LoongArch/frame.ll
34–56

Thanks for the quick update. :)

SixWeining accepted this revision.Sep 26 2022, 5:34 AM

Sorry. Forget to leave a LGTM.

This revision is now accepted and ready to land.Sep 26 2022, 5:34 AM
This revision was landed with ongoing or failed builds.Sep 27 2022, 4:00 AM
This revision was automatically updated to reflect the committed changes.