================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to