[PATCH] D90155: [NFC][IntrRefLDV] Some code clean up
Djordje Todorovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 26 07:08:31 PDT 2020
djtodoro created this revision.
djtodoro added a reviewer: jmorse.
djtodoro added projects: LLVM, debug-info.
Herald added subscribers: llvm-commits, hiraditya.
djtodoro requested review of this revision.
While I was reading the source code, I've found some minor nits:
- Use using instead of typedef
- Fix a comment
- Refactor
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D90155
Files:
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
Index: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
===================================================================
--- llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -411,7 +411,7 @@
const TargetLowering &TLI;
/// IndexedMap type, mapping from LocIdx to ValueIDNum.
- typedef IndexedMap<ValueIDNum, LocIdxToIndexFunctor> LocToValueType;
+ using LocToValueType = IndexedMap<ValueIDNum, LocIdxToIndexFunctor>;
/// Map of LocIdxes to the ValueIDNums that they store. This is tightly
/// packed, entries only exist for locations that are being tracked.
@@ -1302,23 +1302,22 @@
DenseMap<const DILocalVariable *, SmallSet<FragmentInfo, 4>>;
/// Machine location/value transfer function, a mapping of which locations
- // are assigned which new values.
- typedef std::map<LocIdx, ValueIDNum> MLocTransferMap;
+ /// are assigned which new values.
+ using MLocTransferMap = std::map<LocIdx, ValueIDNum>;
/// Live in/out structure for the variable values: a per-block map of
/// variables to their values. XXX, better name?
- typedef DenseMap<const MachineBasicBlock *,
- DenseMap<DebugVariable, DbgValue> *>
- LiveIdxT;
+ using LiveIdxT = DenseMap<const MachineBasicBlock *,
+ DenseMap<DebugVariable, DbgValue> *>;
- typedef std::pair<DebugVariable, DbgValue> VarAndLoc;
+ using VarAndLoc = std::pair<DebugVariable, DbgValue>;
/// Type for a live-in value: the predecessor block, and its value.
- typedef std::pair<MachineBasicBlock *, DbgValue *> InValueT;
+ using InValueT = std::pair<MachineBasicBlock *, DbgValue *>;
/// Vector (per block) of a collection (inner smallvector) of live-ins.
/// Used as the result type for the variable value dataflow problem.
- typedef SmallVector<SmallVector<VarAndLoc, 8>, 8> LiveInsT;
+ using LiveInsT = SmallVector<SmallVector<VarAndLoc, 8>, 8>;
const TargetRegisterInfo *TRI;
const TargetInstrInfo *TII;
@@ -1357,7 +1356,7 @@
DenseMap<unsigned, unsigned> BBNumToRPO;
/// Pair of MachineInstr, and its 1-based offset into the containing block.
- typedef std::pair<const MachineInstr *, unsigned> InstAndNum;
+ using InstAndNum = std::pair<const MachineInstr *, unsigned>;
/// Map from debug instruction number to the MachineInstr labelled with that
/// number, and its location within the function. Used to transform
/// instruction numbers in DBG_INSTR_REFs into machine value numbers.
@@ -2177,8 +2176,7 @@
// Create a map from the instruction number (if present) to the
// MachineInstr and its position.
- if (MI.peekDebugInstrNum()) {
- uint64_t InstrNo = MI.peekDebugInstrNum();
+ if (uint64_t InstrNo = MI.peekDebugInstrNum()) {
auto InstrAndPos = std::make_pair(&MI, CurInst);
auto InsertResult =
DebugInstrNumToInstr.insert(std::make_pair(InstrNo, InstrAndPos));
@@ -2356,7 +2354,7 @@
}
}
- // Uhhhhhh, reimplement NumInserted and NumRemoved pls.
+ // TODO: Reimplement NumInserted and NumRemoved.
return std::tuple<bool, bool>(Changed, DowngradeOccurred);
}
@@ -2572,7 +2570,7 @@
return std::tuple<Optional<ValueIDNum>, bool>(None, false);
// Lambda for seeking a common location within a range of location-sets.
- typedef SmallVector<SmallVector<LocIdx, 4>, 8>::iterator LocsIt;
+ using LocsIt = SmallVector<SmallVector<LocIdx, 4>, 8>::iterator;
auto SeekLocation =
[&Locs](llvm::iterator_range<LocsIt> SearchRange) -> Optional<LocIdx> {
// Starting with the first set of locations, take the intersection with
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90155.300658.patch
Type: text/x-patch
Size: 3687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201026/c5b85245/attachment.bin>
More information about the llvm-commits
mailing list