[llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp UnifyFunctionExitNodes.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 21 10:53:10 CST 2003


Changes in directory llvm/lib/Transforms/Utils:

BreakCriticalEdges.cpp updated: 1.16 -> 1.17
UnifyFunctionExitNodes.cpp updated: 1.28 -> 1.29

---
Log message:

Minor cleanups and simplifications



---
Diffs of the changes:  (+5 -11)

Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.16 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.17
--- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.16	Thu Nov 20 12:25:23 2003
+++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp	Fri Nov 21 10:52:03 2003
@@ -106,7 +106,7 @@
   BasicBlock *NewBB = new BasicBlock(TIBB->getName() + "." +
                                      DestBB->getName() + "_crit_edge");
   // Create our unconditional branch...
-  new BranchInst(DestBB, 0, 0, NewBB);
+  new BranchInst(DestBB, NewBB);
   
   // Branch to the new block, breaking the edge...
   TI->setSuccessor(SuccNum, NewBB);


Index: llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
diff -u llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.28 llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.29
--- llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.28	Thu Nov 20 12:25:23 2003
+++ llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp	Fri Nov 21 10:52:03 2003
@@ -21,13 +21,12 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iPHINode.h"
 #include "llvm/Type.h"
-
-namespace llvm {
+using namespace llvm;
 
 static RegisterOpt<UnifyFunctionExitNodes>
 X("mergereturn", "Unify function exit nodes");
 
-Pass *createUnifyFunctionExitNodesPass() {
+Pass *llvm::createUnifyFunctionExitNodesPass() {
   return new UnifyFunctionExitNodes();
 }
 
@@ -91,11 +90,8 @@
     // If the function doesn't return void... add a PHI node to the block...
     PN = new PHINode(F.getReturnType(), "UnifiedRetVal");
     NewRetBlock->getInstList().push_back(PN);
-    new ReturnInst(PN, NewRetBlock);
-  } else {
-    // If it returns void, just add a return void instruction to the block
-    new ReturnInst(0, NewRetBlock);
   }
+  new ReturnInst(PN, NewRetBlock);
 
   // Loop over all of the blocks, replacing the return instruction with an
   // unconditional branch.
@@ -109,10 +105,8 @@
     if (PN) PN->addIncoming(BB->getTerminator()->getOperand(0), BB);
 
     BB->getInstList().pop_back();  // Remove the return insn
-    new BranchInst(NewRetBlock, 0, 0, BB);
+    new BranchInst(NewRetBlock, BB);
   }
   ReturnBlock = NewRetBlock;
   return true;
 }
-
-} // End llvm namespace





More information about the llvm-commits mailing list