//===- RemoveRedundantDebugValues.cpp - Remove Redundant Debug Value MIs --===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file RemoveRedundantDebugValues.cpp
///
/// The RemoveRedundantDebugValues pass removes redundant DBG_VALUEs that
/// appear in MIR after the register allocator.
using namespace llvm;
;
;
// namespace
//===----------------------------------------------------------------------===//
// Implementation
//===----------------------------------------------------------------------===//
char RemoveRedundantDebugValues::ID = 0;
char &llvm::RemoveRedundantDebugValuesID = RemoveRedundantDebugValues::ID;
/// Default construct and initialize the pass.
:
// This analysis aims to remove redundant DBG_VALUEs by going forward
// in the basic block by considering the first DBG_VALUE as a valid
// until its first (location) operand is not clobbered/modified.
// For example:
// (1) DBG_VALUE $edi, !"var1", ...
// (2) <block of code that does affect $edi>
// (3) DBG_VALUE $edi, !"var1", ...
// ...
// in this case, we can remove (3).
// TODO: Support DBG_VALUE_LIST and other debug instructions.
static bool
// This analysis aims to remove redundant DBG_VALUEs by going backward
// in the basic block and removing all but the last DBG_VALUE for any
// given variable in a set of consecutive DBG_VALUE instructions.
// For example:
// (1) DBG_VALUE $edi, !"var1", ...
// (2) DBG_VALUE $esi, !"var2", ...
// (3) DBG_VALUE $edi, !"var1", ...
// ...
// in this case, we can remove (1).
static bool
bool
bool