diff options
Diffstat (limited to 'lib/Target/WebAssembly/WebAssemblyPeephole.cpp')
| -rw-r--r-- | lib/Target/WebAssembly/WebAssemblyPeephole.cpp | 26 | 
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/Target/WebAssembly/WebAssemblyPeephole.cpp b/lib/Target/WebAssembly/WebAssemblyPeephole.cpp index d2fbc5a22308..a54484407805 100644 --- a/lib/Target/WebAssembly/WebAssemblyPeephole.cpp +++ b/lib/Target/WebAssembly/WebAssemblyPeephole.cpp @@ -8,7 +8,7 @@  //===----------------------------------------------------------------------===//  ///  /// \file -/// \brief Late peephole optimizations for WebAssembly. +/// Late peephole optimizations for WebAssembly.  ///  //===----------------------------------------------------------------------===// @@ -50,6 +50,9 @@ public:  } // end anonymous namespace  char WebAssemblyPeephole::ID = 0; +INITIALIZE_PASS(WebAssemblyPeephole, DEBUG_TYPE, +                "WebAssembly peephole optimizations", false, false) +  FunctionPass *llvm::createWebAssemblyPeephole() {    return new WebAssemblyPeephole();  } @@ -80,18 +83,13 @@ static bool MaybeRewriteToFallthrough(MachineInstr &MI, MachineBasicBlock &MBB,      return false;    if (&MBB != &MF.back())      return false; -  if (MF.getSubtarget<WebAssemblySubtarget>() -        .getTargetTriple().isOSBinFormatELF()) { -    if (&MI != &MBB.back()) -      return false; -  } else { -    MachineBasicBlock::iterator End = MBB.end(); -    --End; -    assert(End->getOpcode() == WebAssembly::END_FUNCTION); -    --End; -    if (&MI != &*End) -      return false; -  } + +  MachineBasicBlock::iterator End = MBB.end(); +  --End; +  assert(End->getOpcode() == WebAssembly::END_FUNCTION); +  --End; +  if (&MI != &*End) +    return false;    if (FallthroughOpc != WebAssembly::FALLTHROUGH_RETURN_VOID) {      // If the operand isn't stackified, insert a COPY to read the operand and @@ -113,7 +111,7 @@ static bool MaybeRewriteToFallthrough(MachineInstr &MI, MachineBasicBlock &MBB,  }  bool WebAssemblyPeephole::runOnMachineFunction(MachineFunction &MF) { -  DEBUG({ +  LLVM_DEBUG({      dbgs() << "********** Peephole **********\n"             << "********** Function: " << MF.getName() << '\n';    });  | 
