[llvm] [NVPTX][NFC] Refactoring and cleanup in NVPTXISelLowering (PR #137222)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 24 17:08:54 PDT 2025


================
@@ -3388,75 +3373,85 @@ SDValue NVPTXTargetLowering::LowerFormalArguments(
   //     individually present in Ins.
   // So a different index should be used for indexing into Ins.
   // See similar issue in LowerCall.
-  unsigned InsIdx = 0;
 
-  for (unsigned i = 0, e = theArgs.size(); i != e; ++i, ++InsIdx) {
-    Type *Ty = argTypes[i];
+  auto AllIns = ArrayRef(Ins);
+  for (const auto &Arg : F->args()) {
+    const auto ArgIns = AllIns.take_while(
+        [&](auto I) { return I.OrigArgIndex == Arg.getArgNo(); });
+    AllIns = AllIns.drop_front(ArgIns.size());
----------------
Artem-B wrote:

Nice. That makes it pretty obvious what we're doing here.

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


More information about the llvm-commits mailing list