From 5c5fa192f7d94c7795f3d304beccdab339fbbb10 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 21 Oct 2022 13:08:56 -0700 Subject: [PATCH] Cranelift: use `.enumerate()` to avoid indexing in s390x backend (#5094) This can help rustc/llvm avoid bounds checks, but more importantly I will have future changes here that remove indexing of params, and instead hand them out as an iterator. --- cranelift/codegen/src/isa/s390x/abi.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cranelift/codegen/src/isa/s390x/abi.rs b/cranelift/codegen/src/isa/s390x/abi.rs index 8d48e4bc9a..3f7c6bf5e0 100644 --- a/cranelift/codegen/src/isa/s390x/abi.rs +++ b/cranelift/codegen/src/isa/s390x/abi.rs @@ -245,9 +245,7 @@ impl ABIMachineSpec for S390xMachineDeps { next_gpr += 1; } - for i in 0..params.len() { - let mut param = params[i]; - + for (i, mut param) in params.iter().copied().enumerate() { let intreg = in_int_reg(param.value_type); let fltreg = in_flt_reg(param.value_type); let vecreg = in_vec_reg(param.value_type);