diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-01-23 17:06:04 +0000 |
---|---|---|
committer | Jeremy Morse <jeremy.morse@sony.com> | 2025-01-27 20:30:45 +0000 |
commit | 285009f202ca8bfcc6b607eba0e919867559e725 (patch) | |
tree | 946f3501a8597d5130efe61e807910fb2bce43d5 /llvm/lib/IR/Verifier.cpp | |
parent | a85b2dc45a5f1312d6ee5e2522c24e81a086bf60 (diff) | |
download | llvm-285009f202ca8bfcc6b607eba0e919867559e725.zip llvm-285009f202ca8bfcc6b607eba0e919867559e725.tar.gz llvm-285009f202ca8bfcc6b607eba0e919867559e725.tar.bz2 |
[NFC][DebugInfo] Rewrite more call-sites to insert with iterators (#124288)
As part of the "RemoveDIs" work to eliminate debug intrinsics, we're
replacing methods that use Instruction*'s as positions with iterators. The
call-sites updated in this patch are those where the dyn_cast_or_null cast
utility doesn't compose well with iterator insertion. It can distinguish
between nullptr and a "present" (non-null) Instruction pointer, but not
between a legal and illegal instruction iterator. This can lead to
end-iterator dereferences and thus crashes.
We can improve this in the future (as parent-pointers can now be accessed
from ilist nodes), but for the moment, add explicit tests for end()
iterators at the five call sites affected by this.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 54de812..8432779 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -6521,8 +6521,10 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) { const ColorVector &CV = BlockEHFuncletColors.find(CallBB)->second; assert(CV.size() > 0 && "Uncolored block"); for (BasicBlock *ColorFirstBB : CV) - if (dyn_cast_or_null<FuncletPadInst>(ColorFirstBB->getFirstNonPHI())) - InEHFunclet = true; + if (auto It = ColorFirstBB->getFirstNonPHIIt(); + It != ColorFirstBB->end()) + if (dyn_cast_or_null<FuncletPadInst>(&*It)) + InEHFunclet = true; // Check for funclet operand bundle bool HasToken = false; |