RFR(S): 8136469: OptimizeStringConcat fails on pre-sized StringBuilder shapes
roland.westrelin at oracle.com
Tue Sep 22 13:04:42 UTC 2015
> This happens because PhaseStringOpts is performed right after parsing and we don’t optimize the test out in GVN. We don’t optimize the test out in GVN because IfProjNode::Identity() has an in(0)->outcnt() == 1 check that fails. That check is here so we don’t build a bad graph during IGVN but during GVN that extra check is not needed. We could optimize the If out. Except in Identity we don’t know whether we’re called from GVN or IGVN. We would know in Ideal but we can’t return in(0)->in(0), an old node, from Ideal. That’s frustrating.
Maybe we could add an IfProjNode::Ideal method that disconnects the other branch of the If when this branch is always taken and that does so even during parsing. Given Ideal is called before Identity, that would guarantee the next call to Identity optimizes the If out.
More information about the hotspot-compiler-dev