aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2025-01-24 13:27:56 +0000
committerGitHub <noreply@github.com>2025-01-24 13:27:56 +0000
commit6292a808b3524d9ba6f4ce55bc5b9e547b088dd8 (patch)
tree75d8253ec7b5085328930a26daf1f20c39682f80 /llvm/lib/Transforms/Utils/Local.cpp
parenta5cc897cdedfdca018a83fac5734ebe086acb817 (diff)
downloadllvm-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/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 94cf118..d5cf62e 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2108,7 +2108,7 @@ insertDbgVariableRecordsForPHIs(BasicBlock *BB,
for (auto PHI : InsertedPHIs) {
BasicBlock *Parent = PHI->getParent();
// Avoid inserting a debug-info record into an EH block.
- if (Parent->getFirstNonPHI()->isEHPad())
+ if (Parent->getFirstNonPHIIt()->isEHPad())
continue;
for (auto VI : PHI->operand_values()) {
auto V = DbgValueMap.find(VI);
@@ -2174,7 +2174,7 @@ void llvm::insertDebugValuesForPHIs(BasicBlock *BB,
for (auto *PHI : InsertedPHIs) {
BasicBlock *Parent = PHI->getParent();
// Avoid inserting an intrinsic into an EH block.
- if (Parent->getFirstNonPHI()->isEHPad())
+ if (Parent->getFirstNonPHIIt()->isEHPad())
continue;
for (auto *VI : PHI->operand_values()) {
auto V = DbgValueMap.find(VI);
@@ -3206,7 +3206,7 @@ static bool markAliveBlocks(Function &F,
BasicBlock *HandlerBB = *I;
if (DTU)
++NumPerSuccessorCases[HandlerBB];
- auto *CatchPad = cast<CatchPadInst>(HandlerBB->getFirstNonPHI());
+ auto *CatchPad = cast<CatchPadInst>(HandlerBB->getFirstNonPHIIt());
if (!HandlerSet.insert({CatchPad, Empty}).second) {
if (DTU)
--NumPerSuccessorCases[HandlerBB];