[llvm] [NVPTX][NFC] Refactoring and cleanup in NVPTXISelLowering (PR #137222)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 15:41:51 PDT 2025
================
@@ -3388,49 +3373,55 @@ 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;
+ const auto *In = Ins.begin();
----------------
AlexMaclean wrote:
I've refactored things a bit more and I think the latest version shows the benefits of an iterator-based approach. Now, at the start of each loop iteration we update the iterator once and create an ArrayRef to the `Ins` corresponding to this arg. Then in the rest of the loop we can just iterate over or index into this ArrayRef. This is much simpler then what we have previously where the index was incremented and decremented in confusing, control flow-dependent ways, so hopefully with this change we won't need to debug any further issues. I've also added several asserts to encode our assumption about how different data-structures will line up.
https://github.com/llvm/llvm-project/pull/137222
More information about the llvm-commits
mailing list