JDK-8270068 : Add check/verfication for impossible constraints
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,18
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-07-08
  • Updated: 2021-08-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Description
When defining an @IR rule with failOn and counts attributes, one could end up with impossible constraints which always fail.

Example:
@Test
@Arguments(Argument.RANDOM_EACH)
@IR(failOn = {IRNode.LOAD, IRNode.STORE, IRNode.MUL, IRNode.DIV, IRNode.SUB})
@IR(counts = {IRNode.SUB, "1", IRNode.SUB, ">2"})with failOn
public int simpleOne(int x) {
      return 2020 - x;
}

IRNode.SUB should not appear (failOn) while it needs to be found exactly once (counts #1) an appear more than 2 times (counts #2). 

An idea is to catch such cases an immediately throw an exception to warn the user about such impossible rules.