Mercurial > hg > graal-compiler
changeset 22426:b20e743478d3
Unguarded floating read should adopt Pi guard if possible
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Mon, 10 Aug 2015 16:22:43 -0700 |
parents | c96f260ac76d |
children | f6a2cf072e8b |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingReadNode.java |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingReadNode.java Mon Aug 10 16:22:28 2015 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingReadNode.java Mon Aug 10 16:22:43 2015 -0700 @@ -75,9 +75,17 @@ public Node canonical(CanonicalizerTool tool) { if (getAddress() instanceof OffsetAddressNode) { OffsetAddressNode objAddress = (OffsetAddressNode) getAddress(); - if (objAddress.getBase() instanceof PiNode && ((PiNode) objAddress.getBase()).getGuard() == getGuard()) { - OffsetAddressNode newAddress = new OffsetAddressNode(((PiNode) objAddress.getBase()).getOriginalNode(), objAddress.getOffset()); - return new FloatingReadNode(newAddress, getLocationIdentity(), getLastLocationAccess(), stamp(), getGuard(), getBarrierType()); + if (objAddress.getBase() instanceof PiNode) { + PiNode piBase = (PiNode) objAddress.getBase(); + /* + * If the Pi and the read have the same guard or the read is unguarded, use the + * guard of the Pi along with the original value. This encourages a canonical form + * guarded reads. + */ + if (piBase.getGuard() == getGuard() || getGuard() == null) { + OffsetAddressNode newAddress = new OffsetAddressNode(piBase.getOriginalNode(), objAddress.getOffset()); + return new FloatingReadNode(newAddress, getLocationIdentity(), getLastLocationAccess(), stamp(), getGuard() == null ? piBase.getGuard() : getGuard(), getBarrierType()); + } } } return ReadNode.canonicalizeRead(this, getAddress(), getLocationIdentity(), tool);