[llvm-commits] [llvm] r71742 - /llvm/trunk/lib/CodeGen/IfConversion.cpp

Bob Wilson bob.wilson at apple.com
Wed May 13 16:49:15 PDT 2009


Author: bwilson
Date: Wed May 13 18:48:58 2009
New Revision: 71742

URL: http://llvm.org/viewvc/llvm-project?rev=71742&view=rev
Log:
Revert a portion of Dan's change r71018 that I'm convinced is wrong.
Dan was trying to catch the case where a basic block ends with a conditional
branch to the fall-through block.  In this case, all the instructions have
been moved out of FromBBI, leaving it empty.  It cannot end with a
conditional branch.  As the existing comment indicates, it will always fall
through to the next block.  If the block already had the next block (NBB)
listed as a successor, the preceding loop has a check for that and does not
remove it.  Thus, we need to check and add the successor only when it is
not already listed.

With Dan's change, the empty block often ends up with the fall-through
successor listed twice.  This exposed the problem in pr4195, where
CodePlacementOpt did not handle the same predecessor listed more than once.
It is also at least partially responsible for pr4202 and probably a similar
issue with Thumb branches being out of range.

Modified:
    llvm/trunk/lib/CodeGen/IfConversion.cpp

Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=71742&r1=71741&r2=71742&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Wed May 13 18:48:58 2009
@@ -1212,7 +1212,7 @@
   }
 
   // Now FromBBI always falls through to the next block!
-  if (NBB)
+  if (NBB && !FromBBI.BB->isSuccessor(NBB))
     FromBBI.BB->addSuccessor(NBB);
 
   std::copy(FromBBI.Predicate.begin(), FromBBI.Predicate.end(),





More information about the llvm-commits mailing list