From 168ebf8a2d7f942efb3d1b2c92cc69c5f6f51c3b Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 24 Jun 2009 17:48:09 +0000 Subject: [PATCH] less buggycopy propagation --- .../src/Analysis/Loops/CopyPropagation.java | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Robust/src/Analysis/Loops/CopyPropagation.java b/Robust/src/Analysis/Loops/CopyPropagation.java index 3fd27ef7..71c9e7ca 100644 --- a/Robust/src/Analysis/Loops/CopyPropagation.java +++ b/Robust/src/Analysis/Loops/CopyPropagation.java @@ -4,6 +4,7 @@ import IR.Operation; import java.util.Iterator; import java.util.Hashtable; import java.util.HashSet; +import java.util.Set; import java.util.Map; public class CopyPropagation { @@ -30,9 +31,10 @@ public class CopyPropagation { tab=new Hashtable(); //Compute intersection - HashSet toremove=new HashSet(); for(int i=1;i tp=table.get(fn.getPrev(i)); + if (tp==null) + continue; for(Iterator tmpit=tp.entrySet().iterator();tmpit.hasNext();) { Map.Entry t=(Map.Entry)tmpit.next(); TempDescriptor tmp=(TempDescriptor)t.getKey(); @@ -44,7 +46,8 @@ public class CopyPropagation { } } } - + + HashSet toremove=new HashSet(); TempDescriptor[]writes=fn.writesTemps(); for(int i=0;i nodeset=fm.getNodeSet(); + for(Iterator it=fm.getNodeSet().iterator();it.hasNext();) { FlatNode fn=it.next(); - Hashtable tab=table.get(fn); + if (fn.numPrev()==0) + continue; + + Hashtable tab=new Hashtable(); + + for(int i=0;i tp=table.get(fn.getPrev(i)); + + for(Iterator tmpit=tp.entrySet().iterator();tmpit.hasNext();) { + Map.Entry t=(Map.Entry)tmpit.next(); + TempDescriptor tmp=(TempDescriptor)t.getKey(); + + if (!tab.containsKey(tmp)) + tab.put(tmp, tp.get(tmp)); + else if (tab.get(tmp)!=tp.get(tmp)) { + tab.put(tmp, bogustd); + } + } + } + TempMap tmap=null; TempDescriptor[]reads=fn.readsTemps(); for(int i=0;i