Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure DIVCHK and division/remainder simplifiers uphold contract
The divchkSimplifier was first simplifying its child node and then checking whether the DIVCHK is still needed after having simplified its child. It did that by checking whether the simplification of its child results in a node that is not the original child, or the simplified child is not a division or remainder operation. However, it might be that the simplified child is still a division or remainder operation that needs to be checked for division by zero, but is not the original child node. That leads divchkSimplifier to replace the DIVCHK with a treetop operation incorrectly. This change introduces a _nodeToDivchk field in OMR::Simplifier that the integer division and remainder simplifiers use to indicate whether the result of attempting the simplification results in a node that would still need to be checked for division by zero if the original node needed to be checked for division by zero. The divchkSimplifier, after simplifying its child division or remainder operation, checks _nodeToDivchk as a first step in determining whether the DIVCHK is still needed. This change also updates the fold*Constant methods to return true to indicate that they were able to perform the requested transformations, which are guarded by calls to performTransformation, or return false if they were unable to.
- Loading branch information