Track blocks visited in reverse postorder.
authorCameron Zwarich <zwarich@apple.com>
Thu, 24 Feb 2011 10:00:13 +0000 (10:00 +0000)
committerCameron Zwarich <zwarich@apple.com>
Thu, 24 Feb 2011 10:00:13 +0000 (10:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126377 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/FunctionLoweringInfo.h
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 7f03a7a0f71fffe9e2353b5531bc0780330ca2b0..8b1c852e4f2674ff630640a4bb7e0c0767354dde 100644 (file)
@@ -106,6 +106,10 @@ public:
     LiveOutInfo() : NumSignBits(0), KnownOne(1, 0), KnownZero(1, 0) {}
   };
 
+  /// VisitedBBs - The set of basic blocks visited thus far by instruction
+  /// selection.
+  DenseSet<const BasicBlock*> VisitedBBs;
+
   /// PHINodesToUpdate - A list of phi instructions whose operand list will
   /// be updated after processing the current basic block.
   /// TODO: This isn't per-function state, it's per-basic-block state. But
index 98582ba99f1456422f20e4d5d93f9352a108f921..c55cf85a6d22bd88f6566a1f4dff33dd4c2020b3 100644 (file)
@@ -219,6 +219,7 @@ void FunctionLoweringInfo::clear() {
   CatchInfoFound.clear();
 #endif
   LiveOutRegInfo.clear();
+  VisitedBBs.clear();
   ArgDbgValues.clear();
   ByValArgFrameIndexMap.clear();
   RegFixups.clear();
index 835aab25c2ab39da7772b3d64e21ab3065dc2fc8..9d3f5bc7e3bcc9879960a4e0a52791f4288a5c75 100644 (file)
@@ -831,6 +831,10 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
 #ifndef NDEBUG
     CheckLineNumbers(LLVMBB);
 #endif
+
+    if (OptLevel != CodeGenOpt::None)
+      FuncInfo->VisitedBBs.insert(LLVMBB);
+
     FuncInfo->MBB = FuncInfo->MBBMap[LLVMBB];
     FuncInfo->InsertPt = FuncInfo->MBB->getFirstNonPHI();