Author: shihui
Date: 2011-04-07 21:51:30 -0400 (Thu, 07 Apr 2011)
New Revision: 3541

Modified:
   trunk/osprey/be/opt/opt_lmv.cxx
Log:
Fix bug754:

Loop multi-version transformation insert a pre-condition BB before loop header 
BB. 
If loop header BB is if_BB's merge BB, need change if BB's merge BB to newly 
inserted pre-condition BB. 
With attached simple case loop multi-version doesn't update the if_BB's 
merge_BB correctly.

Original implementation is searching IDOM for loop header BB.
if idom BB is if_BB and its if_merge BB is loop header BB, change its if_merge 
BB to pre-condition BB.
This simple test case has if statement followed by a multi-version optimized 
loop. 
And if statement has EH region in its body, cause if_merge BB not dominated by 
if BB.

Fix in CFG::LMV_gen_precondioning_stuff
Search all the BBs, find if_BB whose merge BB is original loop header BB, 
change its if_merge BB to pre-condition BB.

Code Review: Jian-Xin


Modified: trunk/osprey/be/opt/opt_lmv.cxx
===================================================================
--- trunk/osprey/be/opt/opt_lmv.cxx     2011-04-07 19:41:42 UTC (rev 3540)
+++ trunk/osprey/be/opt/opt_lmv.cxx     2011-04-08 01:51:30 UTC (rev 3541)
@@ -1637,14 +1637,14 @@
   Connect_predsucc (precond, orig_phdr);
 
   // Likewise if the preheader is the merge point of a lowered IF/THEN/ELSE
-  // then we must update the merge point on the immediate dominator
-  BB_NODE *idom = orig_phdr->Idom();
-  while (idom) {
-    if (idom->Kind()==BB_LOGIF && idom->If_merge() == orig_phdr) {
-      idom->Ifinfo()->Set_merge(precond);
-      break;
+  // use idom to find if parent is not safe.
+  // Case can be multientry, entry directly jump to header BB. 
+  // Iterate all BBs and if bb's if_merge is header, change to precond.
+  for (IDTYPE id = _first_bb_id+1; id <= _last_bb_id; id++) {
+    BB_NODE *bb = _bb_vec[id];
+    if (bb && bb->Kind() == BB_LOGIF && bb->If_merge() == orig_phdr) {
+      bb->Ifinfo()->Set_merge(precond);
     }
-    idom = idom->Idom();
   }
 
   // If the original preheader is the body of the parent loop we need


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to