hev ab17b5408a
[LoongArch][RISCV] Fix incorrect indexing of incoming byval arguments in tail call eligibility check (#188006)
The loop that validates byval arguments in
`isEligibleForTailCallOptimization()` incorrectly used the loop index
`i` when accessing `getIncomingByValArgs()`, even though `j` is the
index tracking the number of encountered byval arguments.

This mismatch could lead to out-of-bounds access or incorrect type
comparisons when non-byval arguments are interleaved with byval
arguments, causing the tail call eligibility check to fail or behave
incorrectly.

Fix this by using `j` consistently as the index into the incoming byval
argument list and only incrementing it after the bounds check.

This issue affects both LoongArch and RISCV backends, which share the
same logic pattern.

Fixes #187832
2026-03-25 23:26:08 +08:00
..