Avoid dependency between TableGen and CodeGen
[oota-llvm.git] / lib / CodeGen / Analysis.cpp
index 0f7e83a8470e444e381c0d18afc176b8acd4f15e..75579a2b45595c6174d985e8dd2faa5578a98f56 100644 (file)
@@ -517,7 +517,7 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM) {
       if (isa<DbgInfoIntrinsic>(BBI))
         continue;
       if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() ||
-          !isSafeToSpeculativelyExecute(BBI))
+          !isSafeToSpeculativelyExecute(&*BBI))
         return false;
     }
 
@@ -649,18 +649,15 @@ bool llvm::canBeOmittedFromSymbolTable(const GlobalValue *GV) {
 static void collectFuncletMembers(
     DenseMap<const MachineBasicBlock *, int> &FuncletMembership, int Funclet,
     const MachineBasicBlock *MBB) {
+  // Add this MBB to our funclet.
+  auto P = FuncletMembership.insert(std::make_pair(MBB, Funclet));
+
   // Don't revisit blocks.
-  if (FuncletMembership.count(MBB) > 0) {
-    if (FuncletMembership[MBB] != Funclet) {
-      assert(false && "MBB is part of two funclets!");
-      report_fatal_error("MBB is part of two funclets!");
-    }
+  if (!P.second) {
+    assert(P.first->second == Funclet && "MBB is part of two funclets!");
     return;
   }
 
-  // Add this MBB to our funclet.
-  FuncletMembership[MBB] = Funclet;
-
   bool IsReturn = false;
   int NumTerminators = 0;
   for (const MachineInstr &MI : MBB->terminators()) {
@@ -725,7 +722,7 @@ llvm::getFuncletMembership(const MachineFunction &MF) {
     return FuncletMembership;
 
   // Identify all the basic blocks reachable from the function entry.
-  collectFuncletMembers(FuncletMembership, EntryBBNumber, MF.begin());
+  collectFuncletMembers(FuncletMembership, EntryBBNumber, &MF.front());
   // All blocks not part of a funclet are in the parent function.
   for (const MachineBasicBlock *MBB : UnreachableBlocks)
     collectFuncletMembers(FuncletMembership, EntryBBNumber, MBB);