Here is an example of it: https://godbolt.org/z/jvvdhEEE9 Both LLVM and current GCC can generate optimal codegen.
But I am ok with that you go ahead commit this PR to fix the segfault, and fix the regression of such case in the following patches. > From: "Robin Dapp"<[email protected]> > Date: Thu, Jan 22, 2026, 17:22 > Subject: Re: [PATCH] RISC-V: Fix intrinsic FoF load at -O0 [PR122869]. > To: "钟居哲"<[email protected]>, "Robin Dapp"<[email protected]> > Cc: <[email protected]>, <[email protected]>, > <[email protected]>, <[email protected]>, "Robin > Dapp"<[email protected]> > > As I remembered, the reason I put vleff intrinsic genereted into vleff + > > csrr > > vl in gimple level is because: > > > > In this intrinsic code: > > > > vleff (.... &vl, avl) > > vadd (..., vl) > > > > The assembly will become: > > > > vleff .... > > vadd ... > > > > Instead of > > > > vleff .... > > csrr vl > > vadd ... > > > > The "csrr vl" will be elided. > > > > So I wonder, whether "csrr vl" can be elided after this patch ? > > Good point, and, yes, code-gen now is definitely worse with my patch. When > splitting early in gimple we just have much more opportunity to optimize > things. I'm not happy with the resulting code now but it gets rid of the > segmentation fault at least. I'll think about it some more. > > -- > Regards > Robin >
