diff --git a/functions/aux_values.c b/functions/aux_values.c
index cbdb3910b9304328e04cf11516c4d07ba9af8d3c..bd451c638099b36ba16fc41ab73bea546fc0d0ed 100644
--- a/functions/aux_values.c
+++ b/functions/aux_values.c
@@ -23,7 +23,7 @@ void print_bb_aux(function * fun)
         {
                 if (bb->aux !=NULL && *((int *)bb->aux)>=0)
                 {
-                        printf("bb aux value here : %i\n",*((int *)bb->aux));
+                        printf("bb %i aux value here : %i\n",bb->index,*((int *)bb->aux));
                 }
         }
 }
diff --git a/functions/frontier.c b/functions/frontier.c
index bbdd464110e24f9362374fd56955b789584eb756..60c628f50f63634af90a9238b0e14217649ed682 100644
--- a/functions/frontier.c
+++ b/functions/frontier.c
@@ -55,3 +55,196 @@ void bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun)
 		}
 	}
 }
+
+void bitmap_pdf_union(function * fun)
+{
+	printf("\n---------\n");
+	printf("---Union---\n");
+	printf("---------\n\n");
+	//init
+        calculate_dominance_info(CDI_POST_DOMINATORS);
+	bitmap_head *pfrontiers;
+	basic_block bb;
+	pfrontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun));
+
+	FOR_ALL_BB_FN (bb, cfun)
+	{
+		bitmap_initialize (&pfrontiers[bb->index], &bitmap_default_obstack);
+	}
+
+	bitmap_head node_set ;
+	bitmap_initialize( &node_set,  &bitmap_default_obstack);
+
+	FOR_ALL_BB_FN (bb, cfun)
+	{
+			bitmap_set_bit( &node_set, bb->index ) ;
+	}
+
+	bitmap_head pdf_set;
+	bitmap_initialize (&pdf_set, &bitmap_default_obstack);
+
+	bitmap_post_dominance_frontiers (pfrontiers, fun);	
+	bitmap_set_pdf_union(node_set, pfrontiers, &pdf_set, fun);
+	bitmap_print( stdout, &pdf_set, "PDF Union: ", "\n\n" ) ;
+
+        free_dominance_info(fun, CDI_POST_DOMINATORS);
+}	
+void bitmap_set_pdf_union(bitmap_head node_set, bitmap_head *pdf, bitmap_head * pdf_set, function * fun)
+{
+	basic_block bb;
+
+	/* Create the union of each PDF */
+	FOR_ALL_BB_FN( bb, cfun )
+	{
+		if ( bitmap_bit_p( &node_set, bb->index ) )
+		{
+			bitmap_ior_into( pdf_set, &pdf[bb->index] ) ;
+		}
+	}
+
+
+}
+
+
+
+void bitmap_iterated_pdf_union(function * fun)
+{
+	printf("\n---------\n");
+	printf("---Iterated---\n");
+	printf("---------\n\n");
+	//init
+        calculate_dominance_info(CDI_POST_DOMINATORS);
+	bitmap_head *pfrontiers;
+	basic_block bb;
+	pfrontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun));
+
+	FOR_ALL_BB_FN (bb, cfun)
+	{
+		bitmap_initialize (&pfrontiers[bb->index], &bitmap_default_obstack);
+	}
+
+	bitmap_head node_set ;
+	bitmap_initialize( &node_set,  &bitmap_default_obstack);
+
+	FOR_ALL_BB_FN (bb, cfun)
+	{
+			bitmap_set_bit( &node_set, bb->index ) ;
+	}
+
+	bitmap_head pdf_set;
+	bitmap_initialize (&pdf_set, &bitmap_default_obstack);
+
+	bitmap_post_dominance_frontiers (pfrontiers, fun);	
+	bitmap_set_pdf_union(node_set, pfrontiers, &pdf_set, fun);
+
+	bitmap_head ipdf_set;
+	bitmap_initialize (&ipdf_set, &bitmap_default_obstack);
+
+	iterated_post_dominance(pdf_set, pfrontiers, &ipdf_set, fun);
+
+	printf( "\n\nIterated PDF: ") ;
+	bitmap_print( stdout, &ipdf_set, "", "\n\n" ) ;
+
+        free_dominance_info(fun, CDI_POST_DOMINATORS);
+}	
+
+void iterated_post_dominance(bitmap_head pdf_node_set, bitmap_head *pdf, bitmap_head * ipdf_set, function * fun)
+{
+	basic_block bb, b;
+	bitmap_head bitmap_tmp, bitmap_test;
+	bitmap_initialize (&bitmap_tmp, &bitmap_default_obstack);
+	bitmap_initialize (&bitmap_test, &bitmap_default_obstack);
+
+	FOR_ALL_BB_FN( bb, fun )
+	{
+		if ( bitmap_bit_p( &pdf_node_set, bb->index ) )
+		{
+			bitmap_copy(&bitmap_test, &pdf_node_set);
+			while(!bitmap_equal_p(&bitmap_tmp, &bitmap_test) /*|| begin*/)
+			{
+				bitmap_copy(&bitmap_tmp, &bitmap_test);
+				FOR_ALL_BB_FN( b, fun )
+				{
+					if(bitmap_bit_p(&pdf[bb->index], b->index))
+					{
+						bitmap_set_bit(&bitmap_test, b->index);
+					}
+					
+				}
+			}	
+			bitmap_copy(&bitmap_test, ipdf_set);
+			bitmap_ior(ipdf_set, &bitmap_test, &bitmap_tmp);	
+		}
+	}
+}
+
+
+void bitmap_mpi_iterated_pdf_union(function * fun)
+{
+	printf("\n---------\n");
+	printf("---MPI Iterated---\n");
+	printf("---------\n\n");
+	//init
+        calculate_dominance_info(CDI_POST_DOMINATORS);
+	bitmap_head *pfrontiers;
+	basic_block bb;
+	pfrontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun));
+
+	FOR_ALL_BB_FN (bb, cfun)
+	{
+		bitmap_initialize (&pfrontiers[bb->index], &bitmap_default_obstack);
+	}
+
+	bitmap_head node_set ;
+	bitmap_initialize( &node_set,  &bitmap_default_obstack);
+
+	FOR_ALL_BB_FN (bb, cfun)
+	{
+			bitmap_set_bit( &node_set, bb->index ) ;
+	}
+
+	bitmap_head pdf_set;
+	bitmap_initialize (&pdf_set, &bitmap_default_obstack);
+
+	bitmap_post_dominance_frontiers (pfrontiers, fun);	
+	bitmap_set_pdf_union(node_set, pfrontiers, &pdf_set, fun);
+
+	bitmap_head ipdf_set;
+	bitmap_initialize (&ipdf_set, &bitmap_default_obstack);
+
+	iterated_post_dominance(pdf_set, pfrontiers, &ipdf_set, fun);
+
+	bitmap_head mpi_set, mpi_ipdf;
+	bitmap_initialize( &mpi_set,  &bitmap_default_obstack);
+	bitmap_initialize( &mpi_ipdf,  &bitmap_default_obstack);
+
+	FOR_ALL_BB_FN (bb, cfun)
+	{
+                if (bb->aux !=NULL && *((int *)bb->aux)>=0)
+		{
+			bitmap_set_bit( &mpi_set, bb->index ) ;
+		}
+	}
+
+	//bitmap_set_pdf_intersect(ipdf_set, pfrontiers, &mpi_ipdf, fun);
+	bitmap_print( stdout, &ipdf_set, "iterated PDF: ", "\n\n" ) ;
+	bitmap_and_into(&ipdf_set, &mpi_set);
+	bitmap_print( stdout, &ipdf_set, "MPI iterated PDF: ", "\n\n" ) ;
+	bitmap_print( stdout, &mpi_set, "MPI set: ", "\n\n" ) ;
+        free_dominance_info(fun, CDI_POST_DOMINATORS);
+}	
+//void bitmap_set_pdf_intersect(bitmap_head node_set, bitmap_head *pdf, bitmap_head * pdf_set, function * fun)
+//{
+//	basic_block bb;
+//
+//	/* Create the union of each PDF */
+//	FOR_ALL_BB_FN( bb, fun )
+//	{
+//		if ( bitmap_bit_p( &node_set, bb->index ) && bb->aux !=NULL && *((int *)bb->aux)>=0)
+//		{
+//			bitmap_ior_into( pdf_set, &node_set ) ;
+//		}
+//	}
+//
+//
+//}
diff --git a/functions/frontier.h b/functions/frontier.h
index b3847c39dbd69da83814e4873dde63891707e7e0..aff8db3454c30389d94987927d7481ef50d3c49f 100644
--- a/functions/frontier.h
+++ b/functions/frontier.h
@@ -2,4 +2,10 @@
 #define __PDFDD__H
 void bitmap_pdf(function * fun);
 void bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun);
+void bitmap_set_pdf_union(bitmap_head node_set, bitmap_head *pdf, bitmap_head * pdf_set, function * fun);
+void bitmap_pdf_union(function * fun);
+void iterated_post_dominance(bitmap_head pdf_node_set, bitmap_head *pdf, bitmap_head * ipdf_set, function * fun);
+void bitmap_iterated_pdf_union(function * fun);
+void bitmap_mpi_iterated_pdf_union(function * fun);
+void bitmap_set_pdf_intersect(bitmap_head node_set, bitmap_head *pdf, bitmap_head * pdf_set, function * fun);
 #endif
diff --git a/plugin.cpp b/plugin.cpp
index b27aa81fbb34e0959eed58c295c779f1ce165012..d5d9f5d9c96fdbf2500931cec95f7767076971b5 100755
--- a/plugin.cpp
+++ b/plugin.cpp
@@ -109,12 +109,17 @@ class split_count_pass : public gimple_opt_pass
 			//writing corresponding MPI Call in corresponding basic block
 			edit_all_aux_value(fun,(int*)NULL);
 			write_mpi_code(fun);
-			//print_bb_aux(fun);
+			print_bb_aux(fun);
 			/* Skip system header functions */
                         if ( !in_system_header_at( fun->function_start_locus ) ) 
                               cfgviz_dump( fun, function_name(fun), 1 ) ;
 		
+			//edit_all_aux_value(fun,(int*)LAST_AND_UNUSED_MPI_COLLECTIVE_CODE);
+			//write_mpi_code(fun);
 			bitmap_pdf(fun);
+			bitmap_pdf_union(fun);
+			bitmap_iterated_pdf_union(fun);
+			bitmap_mpi_iterated_pdf_union(fun);
 			return 0;
                 }
 };