[llvm] [indvars] Missing variables at Og: (PR #69920)

Carlos Alberto Enciso via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 01:08:45 PDT 2024


================
@@ -1412,6 +1424,36 @@ static bool checkIsIndPhi(PHINode *Phi, Loop *L, ScalarEvolution *SE,
   return InductionDescriptor::isInductionPHI(Phi, L, SE, ID);
 }
 
+void llvm::addDebugValuesToIncomingValue(BasicBlock *Successor, Value *IndVar,
+                                         PHINode *PN) {
+  SmallVector<DbgVariableIntrinsic *> DbgUsers;
+  findDbgUsers(DbgUsers, IndVar);
+  for (auto *DebugUser : DbgUsers) {
+    // Skip debug-users with variadic variable locations; they will not,
+    // get updated, which is fine as that is the existing behaviour.
+    if (DebugUser->hasArgList())
+      continue;
+    auto *Cloned = cast<DbgVariableIntrinsic>(DebugUser->clone());
+    Cloned->replaceVariableLocationOp(0u, PN);
+    Cloned->insertBefore(Successor->getFirstNonPHI());
----------------
CarlosAlbertoEnciso wrote:

Changed to use new insert logic.

https://github.com/llvm/llvm-project/pull/69920


More information about the llvm-commits mailing list