[llvm] [LiveDebugValues][NVPTX]VarLocBasedImpl handle vregs, enable for NVPTX (PR #111456)

Walter Erquinigo via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 10:06:16 PDT 2024


================
@@ -1240,9 +1245,15 @@ void VarLocBasedLDV::getUsedRegs(const VarLocSet &CollectFrom,
       LocIndex::rawIndexForReg(LocIndex::kFirstRegLocation);
   uint64_t FirstInvalidIndex =
       LocIndex::rawIndexForReg(LocIndex::kFirstInvalidRegLocation);
+  uint64_t FirstVirtualRegIndex =
+      LocIndex::rawIndexForReg(LocIndex::kFirstVirtualRegLocation);
   for (auto It = CollectFrom.find(FirstRegIndex),
-            End = CollectFrom.find(FirstInvalidIndex);
-       It != End;) {
+            PhysEnd = CollectFrom.find(FirstInvalidIndex);
+       It != CollectFrom.end();) {
+    if (It == PhysEnd) {
+      It = CollectFrom.find(FirstVirtualRegIndex);
+      continue;
+    }
----------------
walter-erquinigo wrote:

What about moving the code within the for loop into a lambda, and then having two different for loops invoke the lambda internally? The first loop would go over physical registers, and the second one would go over virtual ones. I think the code would be clearer that way

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


More information about the llvm-commits mailing list