[PATCH] D58319: [WebAssembly] Remove getBottom function from CFGStackify (NFC)

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 23:21:16 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL354657: [WebAssembly] Remove getBottom function from CFGStackify (NFC) (authored by aheejin, committed by ).

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58319/new/

https://reviews.llvm.org/D58319

Files:
  llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp


Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
@@ -75,8 +75,6 @@
   DenseMap<const MachineInstr *, MachineBasicBlock *> TryToEHPad;
   // <EH pad, TRY marker> map
   DenseMap<const MachineBasicBlock *, MachineInstr *> EHPadToTry;
-  // <LOOP|TRY marker, Loop/exception bottom BB> map
-  DenseMap<const MachineInstr *, MachineBasicBlock *> BeginToBottom;
 
   // Helper functions to register scope information created by marker
   // instructions.
@@ -84,8 +82,6 @@
   void registerTryScope(MachineInstr *Begin, MachineInstr *End,
                         MachineBasicBlock *EHPad);
 
-  MachineBasicBlock *getBottom(const MachineInstr *Begin);
-
 public:
   static char ID; // Pass identification, replacement for typeid
   WebAssemblyCFGStackify() : MachineFunctionPass(ID) {}
@@ -179,27 +175,6 @@
   EHPadToTry[EHPad] = Begin;
 }
 
-// Given a LOOP/TRY marker, returns its bottom BB. Use cached information if any
-// to prevent recomputation.
-MachineBasicBlock *
-WebAssemblyCFGStackify::getBottom(const MachineInstr *Begin) {
-  const auto &MLI = getAnalysis<MachineLoopInfo>();
-  const auto &WEI = getAnalysis<WebAssemblyExceptionInfo>();
-  if (BeginToBottom.count(Begin))
-    return BeginToBottom[Begin];
-  if (Begin->getOpcode() == WebAssembly::LOOP) {
-    MachineLoop *L = MLI.getLoopFor(Begin->getParent());
-    assert(L);
-    BeginToBottom[Begin] = WebAssembly::getBottom(L);
-  } else if (Begin->getOpcode() == WebAssembly::TRY) {
-    WebAssemblyException *WE = WEI.getExceptionFor(TryToEHPad[Begin]);
-    assert(WE);
-    BeginToBottom[Begin] = WebAssembly::getBottom(WE);
-  } else
-    assert(false);
-  return BeginToBottom[Begin];
-}
-
 /// Insert a BLOCK marker for branches to MBB (if needed).
 void WebAssemblyCFGStackify::placeBlockMarker(MachineBasicBlock &MBB) {
   // This should have been handled in placeTryMarker.
@@ -268,7 +243,9 @@
     // the BLOCK.
     if (MI.getOpcode() == WebAssembly::LOOP ||
         MI.getOpcode() == WebAssembly::TRY) {
-      if (MBB.getNumber() > getBottom(&MI)->getNumber())
+      auto *BottomBB =
+          &*std::prev(MachineFunction::iterator(BeginToEnd[&MI]->getParent()));
+      if (MBB.getNumber() > BottomBB->getNumber())
         AfterSet.insert(&MI);
 #ifndef NDEBUG
       else
@@ -770,10 +747,10 @@
   EndToBegin.clear();
   TryToEHPad.clear();
   EHPadToTry.clear();
-  BeginToBottom.clear();
 }
 
 bool WebAssemblyCFGStackify::runOnMachineFunction(MachineFunction &MF) {
+  errs() << "Function: " << MF.getName() << "\n";
   LLVM_DEBUG(dbgs() << "********** CFG Stackifying **********\n"
                        "********** Function: "
                     << MF.getName() << '\n');


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58319.187905.patch
Type: text/x-patch
Size: 2885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190222/7c3a9a90/attachment.bin>


More information about the llvm-commits mailing list