- // otherwise keep visiting nodes in same context
- for( int i = 0; i < fn.numNext(); i++ ) {
- FlatNode nn = fn.getNext( i );
-
- if( !visited.contains( nn ) ) {
- flatNodesToVisit.put( nn, fm );
-
- // propagate your IR graph predecessor's stall site potential
- mergeIsPotentialStallSite( nn, isPotentialStallSite );
+ // if previous flat nodes have any changes,,
+ // propagate predecessor's status of stall site potential
+ boolean hasChanges=false;
+ boolean isPrevPossibleStallSite=false;
+ for(int i=0;i<fn.numPrev();i++){
+ FlatNode prevNode=fn.getPrev(i);
+ isPrevPossibleStallSite=isPrevPossibleStallSite|| isPotentialStallSite(prevNode);
+ }
+
+ isPotentialStallSite = isPrevPossibleStallSite || isPotentialStallSite;
+
+ Boolean currentStatus=fn2isPotentialStallSite.get(fn);
+ if(currentStatus==null || (fn instanceof FlatMethod) ){
+ //first visit
+ hasChanges=true;
+ }else{
+ //not first visit
+ if(isPotentialStallSite!=currentStatus){
+ hasChanges=true;
+ }
+ }
+
+ // only when current flat node has a change on the status of potential stall site,
+ // need to visit following flat nodes
+ if (hasChanges) {
+ for (int i = 0; i < fn.numNext(); i++) {
+ FlatNode nn = fn.getNext(i);
+ flatNodesToVisit.put(nn, fm);