diff --git a/compiler/gen/src/crane/build.rs b/compiler/gen/src/crane/build.rs index dcd16c28d1..f96cb0860d 100644 --- a/compiler/gen/src/crane/build.rs +++ b/compiler/gen/src/crane/build.rs @@ -1083,7 +1083,7 @@ fn list_set<'a, B: Backend>( // to avoid misprediction. (In practice this should usually pass, // and CPUs generally default to predicting that a forward jump // shouldn't be taken; that is, they predict "else" won't be taken.) - builder.ins().icmp(IntCC::UnsignedLessThan, list_len, elem_index); + builder.ins().icmp(IntCC::UnsignedLessThan, elem_index, list_len); builder.ins().brz(comparison, fail_block, &[]); diff --git a/compiler/gen/tests/test_gen.rs b/compiler/gen/tests/test_gen.rs index 2069333395..7b5b623954 100644 --- a/compiler/gen/tests/test_gen.rs +++ b/compiler/gen/tests/test_gen.rs @@ -559,12 +559,12 @@ mod test_gen { // #[test] fn empty_list_literal() { - assert_llvm_evals_to!("[]", &[], &'static [i64], |x| x); + assert_evals_to!("[]", &[], &'static [i64]); } #[test] fn int_list_literal() { - assert_llvm_evals_to!("[ 12, 9, 6, 3 ]", &[12, 9, 6, 3], &'static [i64], |x| x); + assert_evals_to!("[ 12, 9, 6, 3 ]", &[12, 9, 6, 3], &'static [i64]); } #[test] @@ -1921,6 +1921,19 @@ mod test_gen { ); } + #[test] + fn i64_record_literal() { + assert_evals_to!( + indoc!( + r#" + { x: 3, y: 5 } + "# + ), + (3, 5), + (i64, i64) + ); + } + #[test] fn f64_record() { assert_evals_to!(