new write barrier class
[IRC.git] / Robust / src / Analysis / Loops / DeadCode.java
index 4df9eb4841f54fc3febfe0b52b1706ea71719771..d624fdd44862b87ecc6c09e90c8ed21d2b1aa4c3 100644 (file)
@@ -72,10 +72,9 @@ public class DeadCode {
     //get rid of useless nodes
     for(Iterator<FlatNode> it=fm.getNodeSet().iterator();it.hasNext();) {
       FlatNode fn=it.next();
-      if (!useful.contains(fn)) {
+      if (!useful.contains(fn)||isuseless(fn)) {
        //We have a useless node
        FlatNode fnnext=fn.getNext(0);
-
        for(int i=0;i<fn.numPrev();i++) {
          FlatNode nprev=fn.getPrev(i);
              
@@ -91,4 +90,13 @@ public class DeadCode {
       }
     }
   }
+  public boolean isuseless(FlatNode fn) {
+    if (fn.kind()==FKind.FlatOpNode) {
+      FlatOpNode fon=(FlatOpNode)fn;
+      if (fon.getOp().getOp()==Operation.ASSIGN&&fon.getLeft()==fon.getDest())
+       return true;
+    }
+    return false;
+  }
+
 }
\ No newline at end of file