Change uses of Function::front to Function::getEntryBlock for readability.
authorDan Gohman <gohman@apple.com>
Thu, 22 Mar 2007 16:38:57 +0000 (16:38 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 22 Mar 2007 16:38:57 +0000 (16:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35265 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
lib/Analysis/ProfileInfo.cpp
lib/Analysis/ProfileInfoLoader.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/LICM.cpp
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Scalar/TailRecursionElimination.cpp
lib/Transforms/Utils/CloneFunction.cpp
lib/Transforms/Utils/CodeExtractor.cpp
lib/Transforms/Utils/InlineFunction.cpp
lib/Transforms/Utils/SimplifyCFG.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/Instructions.cpp

index 719eeada15aac0b99de951f2d4c76a092c5a5472..6eead0fd6ecad2a040d2b1b3ebe333cbf8dea0d8 100644 (file)
@@ -33,7 +33,7 @@ unsigned ProfileInfo::getExecutionCount(BasicBlock *BB) const {
   // Are there zero predecessors of this block?
   if (PI == PE) {
     // If this is the entry block, look for the Null -> Entry edge.
-    if (BB == &BB->getParent()->front())
+    if (BB == &BB->getParent()->getEntryBlock())
       return getEdgeWeight(0, BB);
     else
       return 0;   // Otherwise, this is a dead block.
index 23ceb52d8e2ef7d748fcd692ad5f77189188da2a..dec29a40b178b24167a1d83dc4c9fad7255e0b3d 100644 (file)
@@ -152,7 +152,8 @@ void ProfileInfoLoader::getFunctionCounts(std::vector<std::pair<Function*,
       getBlockCounts(BlockCounts);
 
       for (unsigned i = 0, e = BlockCounts.size(); i != e; ++i)
-        if (&BlockCounts[i].first->getParent()->front() == BlockCounts[i].first)
+        if (&BlockCounts[i].first->getParent()->getEntryBlock() ==
+            BlockCounts[i].first)
           Counts.push_back(std::make_pair(BlockCounts[i].first->getParent(),
                                           BlockCounts[i].second));
     } else {
index 70506e32fcd41315c59bd1d3937132c95bc91046..5a12aeb706995fab2dd892bd1ae4e52c5a4ac778 100644 (file)
@@ -4328,7 +4328,7 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
   std::vector<SDOperand> UnorderedChains;
 
   // Lower any arguments needed in this block if this is the entry block.
-  if (LLVMBB == &LLVMBB->getParent()->front())
+  if (LLVMBB == &LLVMBB->getParent()->getEntryBlock())
     LowerArguments(LLVMBB, SDL, UnorderedChains);
 
   BB = FuncInfo.MBBMap[LLVMBB];
index 1523f01f3773604c9ba4f6ae16b3c26915b83775..12f02f758ecb4a8ea5af76fb6ad386b827d4a2d3 100644 (file)
@@ -9946,7 +9946,8 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
   if (isa<PHINode>(I) || I->mayWriteToMemory()) return false;
 
   // Do not sink alloca instructions out of the entry block.
-  if (isa<AllocaInst>(I) && I->getParent() == &DestBlock->getParent()->front())
+  if (isa<AllocaInst>(I) && I->getParent() ==
+        &DestBlock->getParent()->getEntryBlock())
     return false;
 
   // We can only sink load instructions if there is nothing between the load and
index 7a578a8fb42315f826b02e996377488558e698fa..482ac77353793d23e24a87d5e843ab395e08c38b 100644 (file)
@@ -471,7 +471,7 @@ void LICM::sink(Instruction &I) {
 
     if (I.getType() != Type::VoidTy)
       AI = new AllocaInst(I.getType(), 0, I.getName(),
-                          I.getParent()->getParent()->front().begin());
+                          I.getParent()->getParent()->getEntryBlock().begin());
 
     // Secondly, insert load instructions for each use of the instruction
     // outside of the loop.
index a26fcbefe810ff5716715e2111727117a5a54c97..a29fe4ad3eb83fd44c52fb33970990abf24e785f 100644 (file)
@@ -891,7 +891,7 @@ void SROA::ConvertToScalar(AllocationInst *AI, const Type *ActualTy) {
   ++NumConverted;
   
   BasicBlock *EntryBlock = AI->getParent();
-  assert(EntryBlock == &EntryBlock->getParent()->front() &&
+  assert(EntryBlock == &EntryBlock->getParent()->getEntryBlock() &&
          "Not in the entry block!");
   EntryBlock->getInstList().remove(AI);  // Take the alloca out of the program.
   
index c1ce9d4d3dd3954605fb5e994938cc755551a527..cd3b79aab6ceb1b64a7a5f674aa3afd0b2f583f8 100644 (file)
@@ -108,7 +108,7 @@ static bool CheckForEscapingAllocas(BasicBlock *BB,
       // If this alloca is in the body of the function, or if it is a variable
       // sized allocation, we cannot tail call eliminate calls marked 'tail'
       // with this mechanism.
-      if (BB != &BB->getParent()->front() ||
+      if (BB != &BB->getParent()->getEntryBlock() ||
           !isa<ConstantInt>(AI->getArraySize()))
         CannotTCETailMarkedCall = true;
     }
index d80a83157ab6b9d87e017031897a2ee7c7b0bfe5..cff58ab15410c916e72f7e2b5c18b7d5af1a13fe 100644 (file)
@@ -59,7 +59,7 @@ BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB,
     CodeInfo->ContainsUnwinds        |= isa<UnwindInst>(BB->getTerminator());
     CodeInfo->ContainsDynamicAllocas |= hasDynamicAllocas;
     CodeInfo->ContainsDynamicAllocas |= hasStaticAllocas && 
-                                        BB != &BB->getParent()->front();
+                                        BB != &BB->getParent()->getEntryBlock();
   }
   return NewBB;
 }
index f304df2a93dbf03d3c96099c37e1760b9d9f8542..a4e7ab8972dd0e53cb173ef951ed7c50c253d2ab 100644 (file)
@@ -104,7 +104,7 @@ void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) {
   bool HasPredsFromRegion = false;
   unsigned NumPredsOutsideRegion = 0;
 
-  if (Header != &Header->getParent()->front()) {
+  if (Header != &Header->getParent()->getEntryBlock()) {
     PHINode *PN = dyn_cast<PHINode>(Header->begin());
     if (!PN) return;  // No PHI nodes.
 
index d57a8f58aba6b07471172c2684d7c7ea5bc11f7a..a1a638b0c2c3ff89d652ca0465b3bf5a6bdc023e 100644 (file)
@@ -265,9 +265,10 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
           // Transfer all of the allocas over in a block.  Using splice means
           // that the instructions aren't removed from the symbol table, then
           // reinserted.
-          Caller->front().getInstList().splice(InsertPoint,
-                                               FirstNewBlock->getInstList(),
-                                               AI, I);
+          Caller->getEntryBlock().getInstList().splice(
+              InsertPoint,
+              FirstNewBlock->getInstList(),
+              AI, I);
         }
       }
   }
index 91664bf2d9d9d93f71c7a2ef3e3b9f682cdcdbc3..1bf72a1076e9b60cb00c67a99ae46ea602c8c13b 100644 (file)
@@ -1185,7 +1185,8 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
 
   assert(BB && BB->getParent() && "Block not embedded in function!");
   assert(BB->getTerminator() && "Degenerate basic block encountered!");
-  assert(&BB->getParent()->front() != BB && "Can't Simplify entry block!");
+  assert(&BB->getParent()->getEntryBlock() != BB &&
+         "Can't Simplify entry block!");
 
   // Remove basic blocks that have no predecessors... which are unreachable.
   if (pred_begin(BB) == pred_end(BB) ||
index 674e077a4fde7c4f303d02ae0c336a498f9aee80..0792550e1c58cd412994ef49ecedfecdd8fae4b6 100644 (file)
@@ -1036,7 +1036,7 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
   if (BB->getParent() == 0)
     Out << "\t\t; Error: Block without parent!";
   else {
-    if (BB != &BB->getParent()->front()) {  // Not the entry block?
+    if (BB != &BB->getParent()->getEntryBlock()) {  // Not the entry block?
       // Output predecessors for the block...
       Out << "\t\t;";
       pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
index 8c836a2515cef6d9e0e608a5daef360e61dd6bed..c7da56b96ff9784b490fa535808e317dcad8fea6 100644 (file)
@@ -170,7 +170,7 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
   if (HasUndefInput && !AllowNonDominatingInstruction)
     if (Instruction *IV = dyn_cast<Instruction>(InVal))
       // If it's in the entry block, it dominates everything.
-      if (IV->getParent() != &IV->getParent()->getParent()->front() ||
+      if (IV->getParent() != &IV->getParent()->getParent()->getEntryBlock() ||
           isa<InvokeInst>(IV))
         return 0;   // Cannot guarantee that InVal dominates this PHINode.