[clang] [llvm] [polly] [NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (PR #123737)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 07:25:59 PST 2025
================
@@ -173,8 +173,9 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {
// Set the DebugLoc of the inserted PHI, if available.
DebugLoc DL;
- if (const Instruction *I = BB->getFirstNonPHI())
- DL = I->getDebugLoc();
+ BasicBlock::iterator It = BB->getFirstNonPHIIt();
+ if (It != BB->end())
+ DL = It->getDebugLoc();
----------------
SLTozer wrote:
Possible alternative, YMMV:
```suggestion
if (BasicBlock::iterator It = BB->getFirstNonPHIIt(); It != BB->end())
DL = It->getDebugLoc();
```
https://github.com/llvm/llvm-project/pull/123737
More information about the llvm-commits
mailing list