RFR: 8322816: RISC-V: Incorrect guarantee in patch_vtype
Kim Barrett
kbarrett at openjdk.org
Wed Jan 3 00:12:47 UTC 2024
On Tue, 2 Jan 2024 08:56:08 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Please review this change that fixes a test for a guarantee. This also
>> removes a -Wparentheses warning when those are enabled (which is how the
>> problem was discovered).
>>
>> The problem is that operator precedence groups the sub-expressions differently
>> than intended. The fix is to override the operator precedence by adding
>> parentheses to achieve the intended grouping.
>>
>> Testing: Local (linux-x64) cross-build for linux-riscv with this change plus
>> -Wparentheses enabled and other changes to allow that to work.
>>
>> Requesting someone from the riscv porters to properly test this.
>
> src/hotspot/cpu/riscv/assembler_riscv.hpp line 1160:
>
>> 1158: #define patch_vtype(hsb, lsb, vlmul, vsew, vta, vma, vill) \
>> 1159: if (vill == 1) { \
>> 1160: guarantee((vlmul | vsew | vta | vma) == 0, \
>
> I see the `vill` parameter is always false in current code, which means this guarantee never gets excecuted. And I don't think we would make use of the `vill` field of vtype in future. So I personally perfer to remove this guarantee and its enclosing if block for now.
Rather than removing the guarantee, wouldn't it be better to guarantee/assert `vill == 0`?
Although looking at uses, that argument is a bool, so it should be `guarantee(!vill, ...)`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17215#discussion_r1439970844
More information about the hotspot-compiler-dev
mailing list