private Node tryFoldExpr ( Node subtree ) { Node result = trySimplifyUnusedResult ( subtree . getFirstChild ( ) ) ; if ( result == null ) { Node parent = subtree . getParent ( ) ; // If the EXPR_RESULT no longer has any children, remove it as well. if ( parent . isLabel ( ) ) { Node replacement = IR . block ( ) . srcref ( subtree ) ; parent . replaceChild ( subtree , replacement ) ; subtree = replacement ; } else { subtree . detach ( ) ; subtree = null ; } } return subtree ; }
Try folding EXPR_RESULT nodes by removing useless Ops and expressions .