diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-01-24 13:27:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-24 13:27:56 +0000 |
commit | 6292a808b3524d9ba6f4ce55bc5b9e547b088dd8 (patch) | |
tree | 75d8253ec7b5085328930a26daf1f20c39682f80 /llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | |
parent | a5cc897cdedfdca018a83fac5734ebe086acb817 (diff) | |
download | llvm-6292a808b3524d9ba6f4ce55bc5b9e547b088dd8.zip llvm-6292a808b3524d9ba6f4ce55bc5b9e547b088dd8.tar.gz llvm-6292a808b3524d9ba6f4ce55bc5b9e547b088dd8.tar.bz2 |
[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)
As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNonPHI and similar feed into
instruction insertion positions. Call-sites where that's necessary were
updated a year ago; but to ensure some type safety however, we'd like to
have all calls to getFirstNonPHI use the iterator-returning version.
This patch changes a bunch of call-sites calling getFirstNonPHI to use
getFirstNonPHIIt, which returns an iterator. All these call sites are
where it's obviously safe to fetch the iterator then dereference it. A
follow-up patch will contain less-obviously-safe changes.
We'll eventually deprecate and remove the instruction-pointer
getFirstNonPHI, but not before adding concise documentation of what
considerations are needed (very few).
---------
Co-authored-by: Stephen Tozer <Melamoto@gmail.com>
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 3e89b18..33c6341 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -250,7 +250,7 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, // Don't create MachineBasicBlocks for imaginary EH pad blocks. These blocks // are really data, and no instructions can live here. if (BB.isEHPad()) { - const Instruction *PadInst = BB.getFirstNonPHI(); + BasicBlock::const_iterator PadInst = BB.getFirstNonPHIIt(); // If this is a non-landingpad EH pad, mark this function as using // funclets. // FIXME: SEH catchpads do not create EH scope/funclets, so we could avoid @@ -261,13 +261,13 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, MF->getFrameInfo().setHasOpaqueSPAdjustment(true); } if (isa<CatchSwitchInst>(PadInst)) { - assert(&*BB.begin() == PadInst && + assert(BB.begin() == PadInst && "WinEHPrepare failed to remove PHIs from imaginary BBs"); continue; } if (isa<FuncletPadInst>(PadInst) && Personality != EHPersonality::Wasm_CXX) - assert(&*BB.begin() == PadInst && "WinEHPrepare failed to demote PHIs"); + assert(BB.begin() == PadInst && "WinEHPrepare failed to demote PHIs"); } MachineBasicBlock *MBB = mf.CreateMachineBasicBlock(&BB); |