RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v7]

Johannes Graham duke at openjdk.org
Tue Jan 28 00:26:47 UTC 2025


On Sat, 25 Jan 2025 16:23:00 GMT, Johannes Graham <duke at openjdk.org> wrote:

>> C2 does not eliminate XOR nodes with constant arguments. This has a noticeable effect on `Long.expand` with a constant mask, on architectures that don't have instructions equivalent  to `PDEP` to be used in an intrinsic.
>> 
>> This patch demonstrates a potential fix to the problem, but there might well be better ways to do it.
>
> Johannes Graham has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - formatting
>  - simplified version of bounds check
>  - tests for xor hi=power of 2

I'm going to need some guidance on using gtest for this. I can't really call xor on the types - that would need a Node which doesn't seem to easily be created in a stand-alone way. I can move the tricky code from `add_ring` to a static method to test that more directly. I'm having trouble getting a test to run without the vm crashing.

As soon as I  try creating a type, for example `const TypeLong *v=TypeLong::make(0)`, I get something like this:


#  Internal Error (/Users/j3graham/jdkdev/jdk/src/hotspot/share/compiler/compilerThread.hpp:67), pid=25205, tid=259
#  assert(t->is_Compiler_thread()) failed: incorrect cast to CompilerThread
#

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23089#issuecomment-2617249001


More information about the hotspot-compiler-dev mailing list