changeset 13730:168976cae9ce

fix invalid MemoryPhiNodes at loop begins
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 22 Jan 2014 15:27:31 +0100
parents 9a6faa08bffe
children 9161ed8ce796 3424bc098ca0
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Wed Jan 22 15:27:31 2014 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Wed Jan 22 15:27:31 2014 +0100
@@ -308,19 +308,21 @@
                 modifiedLocations.addAll(initialState.lastMemorySnapshot.keySet());
             }
 
-            Map<LocationIdentity, PhiNode> phis = new HashMap<>();
+            Map<LocationIdentity, MemoryPhiNode> phis = new HashMap<>();
             for (LocationIdentity location : modifiedLocations) {
                 MemoryPhiNode phi = loop.graph().addWithoutUnique(new MemoryPhiNode(loop, location));
                 phi.addInput(ValueNodeUtil.asNode(initialState.getLastLocationAccess(location)));
                 phis.put(location, phi);
-                initialState.lastMemorySnapshot.put(location, phi);
+            }
+            for (Map.Entry<LocationIdentity, MemoryPhiNode> entry : phis.entrySet()) {
+                initialState.lastMemorySnapshot.put(entry.getKey(), entry.getValue());
             }
 
             LoopInfo<MemoryMapImpl> loopInfo = ReentrantNodeIterator.processLoop(this, loop, initialState);
 
             for (Map.Entry<LoopEndNode, MemoryMapImpl> entry : loopInfo.endStates.entrySet()) {
                 int endIndex = loop.phiPredecessorIndex(entry.getKey());
-                for (Map.Entry<LocationIdentity, PhiNode> phiEntry : phis.entrySet()) {
+                for (Map.Entry<LocationIdentity, MemoryPhiNode> phiEntry : phis.entrySet()) {
                     LocationIdentity key = phiEntry.getKey();
                     PhiNode phi = phiEntry.getValue();
                     phi.initializeValueAt(endIndex, ValueNodeUtil.asNode(entry.getValue().getLastLocationAccess(key)));