Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

xry111 (Xi Ruoyao)
User

Projects

User does not belong to any projects.

User Details

User Since
Mar 8 2022, 3:45 AM (81 w, 3 d)

Recent Activity

Fri, Sep 1

xry111 added a reviewer for D159272: [LoongArch] Improve codegen for atomic ops: xry111.

I'll see if a similar change is desired for GCC too.

Fri, Sep 1, 9:44 AM · Restricted Project, Restricted Project

Jul 26 2023

xry111 accepted D156293: [lld][ELF][test] Fix excessive output file size in loongarch-add-sub.s.

FWIW GNU assembler does not agree with this test case: it complains relocation out of range for baz and quux.

Jul 26 2023, 6:40 AM · Restricted Project, Restricted Project
xry111 added a comment to D138135: [lld][ELF] Support LoongArch.

It looks like there's a test failure happening in post-commit from one of the newly added tests: https://lab.llvm.org/buildbot/#/builders/42/builds/10617 Can you investigate (and revert if that's going to take a while to resolve)?

Jul 26 2023, 5:00 AM · Restricted Project, Restricted Project

Jul 25 2023

xry111 added a comment to D138135: [lld][ELF] Support LoongArch.

A question: does LLD automatically supports pack-relative-relocs once a new port is added? I'm trying to implement it for LoongArch BFD linker but it seems I don't have enough skill.

Jul 25 2023, 1:21 AM · Restricted Project, Restricted Project

Jul 24 2023

xry111 updated the summary of D156116: [Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour.
Jul 24 2023, 8:16 PM · Restricted Project, Restricted Project
xry111 accepted D156116: [Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour.

The change itself LGTM.

Jul 24 2023, 6:12 AM · Restricted Project, Restricted Project
xry111 added a comment to D156116: [Clang][LoongArch] Fix ABI handling of empty structs in C++ to match GCC behaviour.

Ooops. These corner cases are really annoying.

Jul 24 2023, 6:12 AM · Restricted Project, Restricted Project

Jul 20 2023

xry111 added a comment to D155824: [LoongArch] Support -march=native and -mtune=.

Do we need to convert Xuerui's label alignment change to use the -mtune framework?

How to set the numbers if TuneCPU is empty? If there is no differences among empty, loongarch64 and la464, seems it's better to do this until we support other uarchs, e.g. la[236]64.

Just like the TODO in D148622:

63   // TODO: Check TuneCPU and override defaults (that are for LA464) once we
64   // support optimizing for more uarchs.
Jul 20 2023, 7:20 PM · Restricted Project, Restricted Project, Restricted Project
xry111 added a comment to D155824: [LoongArch] Support -march=native and -mtune=.

Do we need to convert Xuerui's label alignment change to use the -mtune framework?

Jul 20 2023, 5:44 AM · Restricted Project, Restricted Project, Restricted Project

Jul 19 2023

xry111 added a comment to D138135: [lld][ELF] Support LoongArch.

Friendly ping; ideally I'd like this port to get included in LLVM 17, which will vastly simplify things ecosystem-wide, such as ClangBuiltLinux testing, Gentoo LLVM stagebuilding, and possibly many more large projects depending on lld.

This is on my radar and I will take a look again soon. There are also random other LoongArch things I need to take a look and I did. This is totally fine to be cherry picked into the release/17.x branch even after it is created.
I am sorry that I did not respond in time for the initial period of the patch (when it changed from the "WIP" state to the normal in-review state), but I think the request after 3 days may be a bit too quick.
Honestly the linker is probably I care about the most and I don't want to lower the bar. (There are other things that I am concerned with as well, but I may not have too much energy to prevent something less appropriate happen; but if I notice, I'll make a comment).

Thanks for the clarification. I didn't know if the release branch cherry-pick could be done in this case so I was a little anxious, sorry for the less-than-a-week ping.

I fully understand your passion and care for the linker and I agree with not lowering the bar; I'll do my best to improve the code together.

Jul 19 2023, 11:41 PM · Restricted Project, Restricted Project

Jun 27 2023

xry111 added a comment to D153865: [LoongArch] Add back SDNPSideEffect properties to CSR and IOCSR read ops.

Interesting. Does cpucfg have the same issue?

Jun 27 2023, 6:28 AM · Restricted Project, Restricted Project
xry111 added a comment to D153865: [LoongArch] Add back SDNPSideEffect properties to CSR and IOCSR read ops.

Ah, in the C standard "reading a volatile variable" is indeed a side effect. I must have been thinking about another definition of "side effect".

Jun 27 2023, 6:20 AM · Restricted Project, Restricted Project
xry111 added a comment to D153865: [LoongArch] Add back SDNPSideEffect properties to CSR and IOCSR read ops.

But it's puzzling. Is reading a CSR really a side effect?

Jun 27 2023, 5:55 AM · Restricted Project, Restricted Project

Jun 17 2023

xry111 added inline comments to D153193: [LoongArch] Optimize conditional selection of integer.
Jun 17 2023, 7:46 AM · Restricted Project, Restricted Project

Jun 16 2023

xry111 accepted D153119: [LoongArch][NFC] Precommit test for D153120 (the fix of CSRWR and CSRXCHG).

LGTM.

Jun 16 2023, 8:29 AM · Restricted Project, Restricted Project
xry111 retitled D153119: [LoongArch][NFC] Precommit test for D153120 (the fix of CSRWR and CSRXCHG) from [LoongArch] Precommit test for the fix of CSRWR and CSRXCHG to [LoongArch][NFC] Precommit test for D153120 (the fix of CSRWR and CSRXCHG).
Jun 16 2023, 8:28 AM · Restricted Project, Restricted Project
xry111 updated the summary of D153120: [LoongArch] Fix handling of the chain of CSRWR and CSRXCHG nodes.
Jun 16 2023, 3:07 AM · Restricted Project, Restricted Project

May 24 2023

xry111 added a comment to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

If you are really determined to do this, then OK. I'm in a very bad
mood and I don't want to spend my mental strength on debating (esp. on a
corner case unlikely to affect "real" code) anymore.

May 24 2023, 8:00 AM · Restricted Project, Restricted Project
xry111 added a comment to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

If we want to ignore empty structures, it is not enough to only modify psABI, because the current implementations of gcc and clang do not ignore empty structures in all cases. For example:

struct { struct{}; int i; }; // in this case, the empty struct is not ignored.
struct { struct{}; float f; }; // ignored.

This is the same behavior as RISC-V. While attempting to pass a struct through FPRs, the empty field is ignored. But if passing through FPR does not work and it's passed through GPRs, the empty fields are not ignored:

Yes, but our psABI still differs from RISC-V in the description of parameter passing, and it would be better to have consistent behavior regardless of whether there are floating points or not.

May 24 2023, 2:36 AM · Restricted Project, Restricted Project
xry111 added a comment to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

I think the paragraph means:

class Empty {};
int test(Empty empty, int a);

Then we should put a into a1, not a0. And we are indeed doing so.

yes. with this patch, a will be passed with a1 register.

I mean now GCC and Clang have the same behavior, so it's easier to just document the behavior in our psABI doc instead of making both Clang and GCC rigidly following the interpretation of psABI (which is currently unclear about zero-sized fields now) anyway.

And the current behavior of GCC and Clang treating a class containing two floating-point members and some empty fields is same as RISC-V, so it's highly unlikely we are violating the C++ standard or IA64 C++ ABI (or the entire RISC-V ecosystem would be violating them). The only issue is our psABI is unclear about empty fields, and the easiest way to solve the issue is revising the psABI (maybe, just "borrowing" some paragraphs from RISC-V psABI if there is no copyright issue).

If we want to ignore empty structures, it is not enough to only modify psABI, because the current implementations of gcc and clang do not ignore empty structures in all cases. For example:

struct { struct{}; int i; }; // in this case, the empty struct is not ignored.
struct { struct{}; float f; }; // ignored.

This is the same behavior as RISC-V. While attempting to pass a struct through FPRs, the empty field is ignored. But if passing through FPR does not work and it's passed through GPRs, the empty fields are not ignored:

https://godbolt.org/z/T1PKoxbYM

Whether to ignore empty structures or not can affect the testing of gdb. @seehearfeel knows more details.

I guess we should be able to fix it for GDB because they must have fixed it for RISC-V already.

May 24 2023, 2:01 AM · Restricted Project, Restricted Project
xry111 added a comment to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

I think the paragraph means:

class Empty {};
int test(Empty empty, int a);

Then we should put a into a1, not a0. And we are indeed doing so.

yes. with this patch, a will be passed with a1 register.

I mean now GCC and Clang have the same behavior, so it's easier to just document the behavior in our psABI doc instead of making both Clang and GCC rigidly following the interpretation of psABI (which is currently unclear about zero-sized fields now) anyway.

And the current behavior of GCC and Clang treating a class containing two floating-point members and some empty fields is same as RISC-V, so it's highly unlikely we are violating the C++ standard or IA64 C++ ABI (or the entire RISC-V ecosystem would be violating them). The only issue is our psABI is unclear about empty fields, and the easiest way to solve the issue is revising the psABI (maybe, just "borrowing" some paragraphs from RISC-V psABI if there is no copyright issue).

If we want to ignore empty structures, it is not enough to only modify psABI, because the current implementations of gcc and clang do not ignore empty structures in all cases. For example:

struct { struct{}; int i; }; // in this case, the empty struct is not ignored.
struct { struct{}; float f; }; // ignored.
May 24 2023, 1:57 AM · Restricted Project, Restricted Project
xry111 added a comment to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

Blocking this as it's a deliberate decision made in D132285.

Is there any imperative reason we must really pass the empty struct? The C++ standard only treats struct {} as size 1 for the semantics of pointer comparison. While there is no pointers to registers, ignoring it in the register calling convention will make no harm.

And AFAIK it will be an undefined behavior attempting to (mis)use the padding space of/after the empty struct to pass any information.

Our current modifications are closer to the description of Itanium C++ ABI, and we try to keep it consistent with the description of the calling convention under reasonable premise.

Hmm, could you provide a link to the section saying this in the Itanium C++ ABI?

http://itanium-cxx-abi.github.io/cxx-abi/abi.html#empty-parameters
http://itanium-cxx-abi.github.io/cxx-abi/abi.html#emptty-return-values

I see it has some words about passing or returning an empty class, but there seems no words about passing a class containing an empty class.

It's possible that my understanding is incorrect. There is indeed no place to see how an empty class is passed, just like there is no documentation on how to pass class A { class B { char c;};};.

May 24 2023, 1:18 AM · Restricted Project, Restricted Project
xry111 added a comment to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

Blocking this as it's a deliberate decision made in D132285.

Is there any imperative reason we must really pass the empty struct? The C++ standard only treats struct {} as size 1 for the semantics of pointer comparison. While there is no pointers to registers, ignoring it in the register calling convention will make no harm.

And AFAIK it will be an undefined behavior attempting to (mis)use the padding space of/after the empty struct to pass any information.

Our current modifications are closer to the description of Itanium C++ ABI, and we try to keep it consistent with the description of the calling convention under reasonable premise.

May 24 2023, 12:27 AM · Restricted Project, Restricted Project

May 23 2023

xry111 added a comment to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

Note that we are using the "de-facto" ABI throwing away this empty struct since the first release of GCC supporting LoongArch, and also Clang. So is there an imperative reason we must change it?

May 23 2023, 11:55 PM · Restricted Project, Restricted Project
xry111 requested changes to D151298: [clang][LoongArch] Fix the calling convention for empty struct in C++ mode.

Blocking this as it's a deliberate decision made in D132285.

May 23 2023, 11:52 PM · Restricted Project, Restricted Project

May 17 2023

xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

I guess the most easy way is adding -flifetime-dse{,=1,=2} and -fno-lifetime-dse as no-op into Clang (and we can really implement -flifetime-dse{,=1,=2} in the future). But not sure if it's the "correct" thing to do.

May 17 2023, 5:36 AM · Restricted Project, Restricted Project

May 16 2023

xry111 added a comment to D150582: [clangd] Fix test failure when it's built with compiler flags unknown by clang.

Hmm, I'd tested the change before creating this but it seems those tests are "UNSUPPORTED" on my system :(.

May 16 2023, 12:00 AM · Restricted Project, Restricted Project

May 15 2023

xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

Hello,

The following four testcases fail for me with this patch:

Failed Tests (4):
  Clangd :: check-fail.test
  Clangd :: check-lines.test
  Clangd :: check.test
  Clangd :: path-mappings.test

Seems like some bots fail as well, e.g. https://lab.llvm.org/buildbot/#/builders/121/builds/30482

May 15 2023, 8:58 AM · Restricted Project, Restricted Project
xry111 requested review of D150582: [clangd] Fix test failure when it's built with compiler flags unknown by clang.
May 15 2023, 8:57 AM · Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

Hello,

The following four testcases fail for me with this patch:

Failed Tests (4):
  Clangd :: check-fail.test
  Clangd :: check-lines.test
  Clangd :: check.test
  Clangd :: path-mappings.test

Seems like some bots fail as well, e.g. https://lab.llvm.org/buildbot/#/builders/121/builds/30482

May 15 2023, 6:42 AM · Restricted Project, Restricted Project
xry111 added inline comments to D150505: [cmake] Disable GCC lifetime DSE.
May 15 2023, 6:07 AM · Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

It's already fixed by rG626849c71e85d546a004cc91866beab610222194. See above.

I'm fairly certain that patch only fixes the failing test and not the underlying problem. I don't know if there's a good way to work around this.

May 15 2023, 5:40 AM · Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.
May 15 2023, 5:29 AM · Restricted Project, Restricted Project

May 14 2023

xry111 added a comment to D149946: [LoongArch] Define `ual` feature and override `allowsMisalignedMemoryAccesses`.

OTOH if the Linux kernel is expected to emulate UAL, -march=generic should be allowed to generate unaligned access instructions for Linux targets. Frankly I prefer this personally, But I'm not sure if it will be a good practice in general...

May 14 2023, 9:42 PM · Restricted Project, Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

Added a "depends on" line in the commit msg, so not to puzzle people to wonder why this is landed again w/o change.

May 14 2023, 8:33 PM · Restricted Project, Restricted Project
xry111 updated the summary of D150505: [cmake] Disable GCC lifetime DSE.
May 14 2023, 8:33 PM · Restricted Project, Restricted Project
xry111 reopened D150505: [cmake] Disable GCC lifetime DSE.

With rG626849c71e85d546a004cc91866beab610222194 landed, this should be safe to land now.

May 14 2023, 8:25 PM · Restricted Project, Restricted Project
xry111 abandoned D150524: [cmake] Disable GCC lifetime DSE.
May 14 2023, 8:23 PM · Restricted Project, Restricted Project, Restricted Project
xry111 added a comment to D150524: [cmake] Disable GCC lifetime DSE.

Closing as https://reviews.llvm.org/rG626849c71e85d546a004cc91866beab610222194 is already landed and we just need to reopen D150505.

May 14 2023, 8:23 PM · Restricted Project, Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

Revised changeset at D150524.

May 14 2023, 5:07 AM · Restricted Project, Restricted Project
xry111 updated the summary of D150524: [cmake] Disable GCC lifetime DSE.
May 14 2023, 5:07 AM · Restricted Project, Restricted Project, Restricted Project
xry111 added reviewers for D150524: [cmake] Disable GCC lifetime DSE: MaskRay, thesamesam, nikic.
May 14 2023, 5:05 AM · Restricted Project, Restricted Project, Restricted Project
xry111 requested review of D150524: [cmake] Disable GCC lifetime DSE.
May 14 2023, 5:05 AM · Restricted Project, Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

Wow. The problem is clang-tidy using the compile_commands.json file in the build directory as a database for options (because the trivially-destructible.cpp.tmp.cpp file is in the build directory). As trivially-destructible.cpp.tmp.cpp is not really in compile_commands.json, it uses the options for tools/llvm-ar/CMakeFiles/llvm-ar.dir/llvm-ar-driver.cpp.o which is compiled by GCC with -fno-lifetime-dse...

May 14 2023, 12:34 AM · Restricted Project, Restricted Project

May 13 2023

xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

I can only reproduce it with a GCC-built LLVM.

Anyway, given LLVM_COMPILER_IS_GCC_COMPATIBLE is true for Clang (see llvm/cmake/modules/DetermineGCCCompatible.cmake), it seems easiest for us to just check CMAKE_COMPILER_IS_GNUCXX instead (given Clang doesn't acknowledge -fno-lifetime-dse at all).

I'll test that now.

May 13 2023, 11:42 PM · Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

I'm also investigating.

May 13 2023, 8:12 PM · Restricted Project, Restricted Project
xry111 added a comment to D150505: [cmake] Disable GCC lifetime DSE.

Thanks @nikic for grammar fix.

May 13 2023, 11:09 AM · Restricted Project, Restricted Project
xry111 updated the diff for D150505: [cmake] Disable GCC lifetime DSE.

Update comment and commit message to fix grammar errors according to suggestion from @nikic.

May 13 2023, 11:08 AM · Restricted Project, Restricted Project

May 12 2023

xry111 requested review of D150505: [cmake] Disable GCC lifetime DSE.
May 12 2023, 10:29 PM · Restricted Project, Restricted Project

May 9 2023

xry111 added a comment to D150196: [LoongArch] Remove AssemblerPredicate for features: f/d/lsx/lasx/lvz/lbt.

Hmm, I think it's a kernel issue and should be fixed by using -mabi=lp64s instead of -msoft-float for this specific file...

May 9 2023, 8:17 AM · Restricted Project, Restricted Project
xry111 added a comment to D150196: [LoongArch] Remove AssemblerPredicate for features: f/d/lsx/lasx/lvz/lbt.

Hmm, I think it's a kernel issue and should be fixed by using -mabi=lp64s instead of -msoft-float for this specific file...

May 9 2023, 6:38 AM · Restricted Project, Restricted Project

May 7 2023

xry111 added a comment to D149946: [LoongArch] Define `ual` feature and override `allowsMisalignedMemoryAccesses`.

From a LoongArch developer's perspective, it may be better to only enable UAL for LA464 and other supporting models, instead of for the generic loongarch64 model too. This is because although all server- and desktop-class LoongArch models have UAL, the embedded-class (Loongson-1 and Loongson-2 series' older models) doesn't, and some of them e.g. Loongson 2K1000LA are readily available on the market so they're arguably relevant. We don't want to generate misaligned memory accesses for those systems only to fall back to much slower emulation later.

If so, CPUs that support UAL will not benefit from this feature in default build (i.e. without -march or -mcpu or -mtune being specified).

Does generic model mean the lowest model or the most popular model?

May 7 2023, 2:20 AM · Restricted Project, Restricted Project, Restricted Project

Apr 19 2023

xry111 added a comment to D148622: [LoongArch] Align functions and loops better according to uarch.

Lulu said a benchmark should be performed for such a change (via gcc-patches) and I agree, so please hold the change until a benchmark is done.

Apr 19 2023, 2:46 AM · Restricted Project, Restricted Project

Apr 18 2023

xry111 added a comment to D148622: [LoongArch] Align functions and loops better according to uarch.

Hmm, it seems to me setMaxBytesForAlignment sets "the maximum amount of padding allowed for aligning the BB", not the max loop size. Or am I missing something?

I simply copied from AArch64 for that part. Maybe I should mention this in the commit message...

Apr 18 2023, 3:20 AM · Restricted Project, Restricted Project
xry111 added a comment to D148622: [LoongArch] Align functions and loops better according to uarch.

Hmm, it seems to me setMaxBytesForAlignment sets "the maximum amount of padding allowed for aligning the BB", not the max loop size. Or am I missing something?

Apr 18 2023, 2:53 AM · Restricted Project, Restricted Project

Mar 30 2023

xry111 added a comment to D136659: [AliasAnalysis] Introduce getModRefInfoMask() as a generalization of pointsToConstantMemory()..

We observed a crash in Thunderbird built with Rustc using LLVM 16.0.0 (happens with Rustc 1.68.x built with a system LLVM 16, and Rustc nightly 2023-03-25). See https://bugzilla.mozilla.org/show_bug.cgi?id=1824544.

Bisect suggests this change is the first bad commit.

Any pointer for diagnose?

Probably the same issue as https://github.com/llvm/llvm-project/issues/58776. It needs a smaller reproducer than "build all of firefox".

Mar 30 2023, 11:15 AM · Restricted Project, Restricted Project
xry111 added a comment to D136659: [AliasAnalysis] Introduce getModRefInfoMask() as a generalization of pointsToConstantMemory()..

We observed a crash in Thunderbird built with Rustc using LLVM 16.0.0 (happens with Rustc 1.68.x built with a system LLVM 16, and Rustc nightly 2023-03-25). See https://bugzilla.mozilla.org/show_bug.cgi?id=1824544.

Mar 30 2023, 9:47 AM · Restricted Project, Restricted Project

Mar 16 2023

xry111 added inline comments to D142688: [Clang][Driver] Handle LoongArch multiarch tuples.
Mar 16 2023, 1:08 AM · Restricted Project, Restricted Project

Mar 14 2023

xry111 requested review of D146109: [libunwind][AArch64] Unbreak building with GNU assembler.
Mar 14 2023, 9:01 PM · Restricted Project, Restricted Project, Restricted Project

Mar 8 2023

xry111 added a comment to D145494: [compiler-rt][builtins] Define AT_HWCAP2 for AArch64.

Do you have commit access, or do you need somebody to land this for you? If so, could you please share the Name <email> to use for the commit?

Mar 8 2023, 7:22 AM · Restricted Project, Restricted Project

Mar 7 2023

xry111 added inline comments to D145494: [compiler-rt][builtins] Define AT_HWCAP2 for AArch64.
Mar 7 2023, 5:41 AM · Restricted Project, Restricted Project
xry111 updated the diff for D145494: [compiler-rt][builtins] Define AT_HWCAP2 for AArch64.
Mar 7 2023, 5:38 AM · Restricted Project, Restricted Project
xry111 updated the summary of D145494: [compiler-rt][builtins] Define AT_HWCAP2 for AArch64.
Mar 7 2023, 5:36 AM · Restricted Project, Restricted Project
xry111 requested review of D145494: [compiler-rt][builtins] Define AT_HWCAP2 for AArch64.
Mar 7 2023, 5:33 AM · Restricted Project, Restricted Project

Feb 13 2023

xry111 added a comment to D143880: [LoongArch] Emit bytepick for picking from concatenation of two values.

@xry111: BTW your GCC implementation of this pattern looks for *arithmetic* right shifts; do you mean logical instead? Because obviously the higher bits would be full of ones after shifting if rj happen to have its MSB set. The sign extension shall happen *after* the pick.

My bad, I'm not familiar with GCC RTL patterns so I've mistakenly thought "lshiftrt could be some 'left' shift, so ashift must be an arithmetic right shift". Actually your pattern is correct as you have perfect test coverage. Please ignore my comment...

Feb 13 2023, 4:53 AM · Restricted Project, Restricted Project

Jan 21 2023

xry111 added a comment to D138135: [lld][ELF] Support LoongArch.

FWIW, BFD linker handles R_LARCH_PCALA_HI20 by creating a PLT for every R_LARCH_PCALA_HI20 against an undefined symbol. This can be really annoying if someone happens to make a simple typo in a symbol name (causing an runtime crash which is difficult to be diagnosed). And I guess using such an approach in LLD will annoy LLD maintainers.

Jan 21 2023, 8:53 PM · Restricted Project, Restricted Project
xry111 added a comment to D142278: [LoongArch] Allow %pc_lo12 relocs in JIRL's immediate operand position.

By the way, using PCALA_LO12 like this means lld will need to peek at the instruction and see if it's a jirl to handle the PCALA_LO12 relocation properly. I guess we'll need to investigate this issue a little. I hope it won't cause too much trouble.

Jan 21 2023, 5:12 AM · Restricted Project, Restricted Project
xry111 accepted D142278: [LoongArch] Allow %pc_lo12 relocs in JIRL's immediate operand position.

LGTM though I really dislike depending on some undocumented behavior of PCALA_LO12.

Jan 21 2023, 3:36 AM · Restricted Project, Restricted Project

Nov 25 2022

xry111 added inline comments to D138489: [tsan] Add tsan support for loongarch64.
Nov 25 2022, 2:57 AM · Restricted Project, Restricted Project, Restricted Project
xry111 added inline comments to D138489: [tsan] Add tsan support for loongarch64.
Nov 25 2022, 2:56 AM · Restricted Project, Restricted Project, Restricted Project

Nov 22 2022

xry111 added a comment to D138469: [LoongArch] Use tablegen size for getInstSizeInBytes.

And maybe this need to be sequenced after D138481?

Nov 22 2022, 6:05 AM · Restricted Project, Restricted Project
xry111 added inline comments to D138489: [tsan] Add tsan support for loongarch64.
Nov 22 2022, 5:57 AM · Restricted Project, Restricted Project, Restricted Project
xry111 added inline comments to D138481: [LoongArch] Add atomic ordering information for binary atomic operations.
Nov 22 2022, 2:29 AM · Restricted Project, Restricted Project
xry111 added inline comments to D138481: [LoongArch] Add atomic ordering information for binary atomic operations.
Nov 22 2022, 1:41 AM · Restricted Project, Restricted Project
xry111 added a comment to D138481: [LoongArch] Add atomic ordering information for binary atomic operations.

Mostly LGTM, I was considering this optimization just before seeing this diff.

Nov 22 2022, 1:39 AM · Restricted Project, Restricted Project

Nov 21 2022

xry111 accepted D138414: [Sanitizer] Fix the implementation of internal_fstat on LoongArch.

LGTM, thanks for fixing my stupid error!

Nov 21 2022, 3:55 AM · Restricted Project, Restricted Project

Nov 14 2022

xry111 added a comment to D137532: [LoongArch] Implement the TargetLowering::getRegisterByName hook.

I'm curious what usage case motivated the change? Not to say it's unnecessary but it's better to have people know a bit more background behind this work.

This interface is required by the code in https://github.com/loongson/linux/blob/master/arch/loongarch/include/asm/percpu.h#L12-L18. This patch can avoid crashes when compiling the kernel with llvm in the future.

Very nice to know.

BTW, are the normal GPRs already supported like this too (things like global register long foo __asm__("$a0")), even without this change, or are such usages invalid in the first place? Memory is failing me.

Nov 14 2022, 12:38 AM · Restricted Project, Restricted Project

Nov 11 2022

xry111 added a comment to D137541: [OMPT] Drop LoongArch support.

If I read the code correctly, calling __builtin_frame_address with a depth > 0 is only used in tests. Can we disable those tests if __builtin_frame_address cannot handle depth > 0?

Nov 11 2022, 8:46 PM · Restricted Project, Restricted Project

Nov 7 2022

xry111 added a comment to D137541: [OMPT] Drop LoongArch support.

GCC documentation claims:

Nov 7 2022, 10:07 PM · Restricted Project, Restricted Project
xry111 added inline comments to D137543: [OpenMP][test] Add #include <cstdint> for gcc-13.
Nov 7 2022, 5:22 AM · Restricted Project, Restricted Project
xry111 added a comment to D137541: [OMPT] Drop LoongArch support.

Is it possible to implement __builtin_frame_address for LoongArch then?

Nov 7 2022, 5:16 AM · Restricted Project, Restricted Project

Nov 4 2022

xry111 accepted D137396: [compiler-rt] Mark $t* as clobbered for Linux/LoongArch syscalls.
Nov 4 2022, 7:34 PM · Restricted Project, Restricted Project
xry111 added a comment to D137396: [compiler-rt] Mark $t* as clobbered for Linux/LoongArch syscalls.
-// Kernel ABI...
-//  syscall number is passed in a7
-//  (http://man7.org/linux/man-pages/man2/syscall.2.html) results are return in
-//  a0 and a1 (http://man7.org/linux/man-pages/man2/syscall.2.html) arguments
-//  are passed in: a0-a7 (confirmed by inspecting glibc sources).
+// Kernel ABI:
+// https://lore.kernel.org/loongarch/1f353678-3398-e30b-1c87-6edb278f74db@xen0n.name/T/#m1613bc86c2d7bf5f6da92bd62984302bfd699a2f
+//  syscall number is placed in a7
+//  parameters, if present, are placed in a0-a6
+//  upon return:
+//    the return value is placed in a0
+//    t0-t8 should be considered clobbered
+//    all other registers are preserved
Nov 4 2022, 6:57 PM · Restricted Project, Restricted Project
xry111 added a comment to D137396: [compiler-rt] Mark $t* as clobbered for Linux/LoongArch syscalls.

LGTM.
But I see the comments in this file:

// Kernel ABI...
//  syscall number is passed in a7
//  (http://man7.org/linux/man-pages/man2/syscall.2.html) results are return in
//  a0 and a1 (http://man7.org/linux/man-pages/man2/syscall.2.html) arguments
//  are passed in: a0-a7 (confirmed by inspecting glibc sources).

// results are return in a0 and a1

Is this correct?

Nov 4 2022, 6:49 PM · Restricted Project, Restricted Project
xry111 accepted D137396: [compiler-rt] Mark $t* as clobbered for Linux/LoongArch syscalls.

Thanks for fixing another instance of stupid programming errors made by me!

Nov 4 2022, 12:53 AM · Restricted Project, Restricted Project
xry111 added inline comments to D137396: [compiler-rt] Mark $t* as clobbered for Linux/LoongArch syscalls.
Nov 4 2022, 12:36 AM · Restricted Project, Restricted Project
xry111 requested changes to D137396: [compiler-rt] Mark $t* as clobbered for Linux/LoongArch syscalls.

No, a1-a7 are saved by syscall.

Nov 4 2022, 12:34 AM · Restricted Project, Restricted Project
xry111 retitled D137394: [LoongArch] Generate PCALAU12I + JIRL instruction pair for medium codemodel from [LoongArch] Generate PACALAU12I + JIRL instruction pair for medium codemodel to [LoongArch] Generate PCALAU12I + JIRL instruction pair for medium codemodel.
Nov 4 2022, 12:20 AM · Restricted Project, Restricted Project

Nov 3 2022

xry111 added a comment to D137384: [MC][LoongArch] Fix needsRelocateWithSymbol() implementation.

Hmm, BFD linker does not support R_LARCH_GOT_PC_{HI12,LO20} with a non-zero addend:

Nov 3 2022, 8:28 PM · Restricted Project, Restricted Project
xry111 accepted D137383: [sanitizer] Add symbolizer support for loongarch64.

Straightforward enough to me.

Nov 3 2022, 7:49 PM · Restricted Project, Restricted Project

Nov 2 2022

xry111 added a comment to D137231: [sanitizer] Add the settings of Read and Write flags in SignalContext for LoongArch.

What is the kernel version that support this flags? Maybe give a link on Github?

Nov 2 2022, 9:12 PM · Restricted Project, Restricted Project

Nov 1 2022

xry111 updated the diff for D137160: [sanitizer] Fix vfork interception on loongarch64.

Enable ASAN vfork test for loongarch64.

Nov 1 2022, 11:00 PM · Restricted Project, Restricted Project
xry111 added inline comments to D136146: [Clang][LoongArch] Handle -march/-m{single,double,soft}-float/-mfpu options.
Nov 1 2022, 9:40 PM · Restricted Project, Restricted Project, Restricted Project
xry111 added a comment to D137160: [sanitizer] Fix vfork interception on loongarch64.

So this can make compiler-rt/test/asan/TestCases/Linux/vfork.cpp pass on loongarch64?

Nov 1 2022, 8:17 PM · Restricted Project, Restricted Project
xry111 added a comment to D137160: [sanitizer] Fix vfork interception on loongarch64.

Thanks but how to apply a patch to https://gcc.gnu.org/git/?p=gcc.git 's libasan is a step I missed...

Nov 1 2022, 8:06 PM · Restricted Project, Restricted Project
xry111 added a comment to D137160: [sanitizer] Fix vfork interception on loongarch64.

If you can write down how to test this somewhere, then I can verify such changes if needed in the future.

Nov 1 2022, 6:37 PM · Restricted Project, Restricted Project
xry111 added a comment to D137160: [sanitizer] Fix vfork interception on loongarch64.

Hmm, should I modify the diff to make git clang-format happy?

Nov 1 2022, 10:48 AM · Restricted Project, Restricted Project
xry111 added a comment to D137160: [sanitizer] Fix vfork interception on loongarch64.

@tangyouling I guess this will fix some test failures you've noticed.

Nov 1 2022, 6:45 AM · Restricted Project, Restricted Project
xry111 requested review of D137160: [sanitizer] Fix vfork interception on loongarch64.
Nov 1 2022, 6:44 AM · Restricted Project, Restricted Project
xry111 accepted D137145: [sanitizer] Fix build error with current LoongArch Clang.
Nov 1 2022, 5:23 AM · Restricted Project, Restricted Project