JVM_IR add bytecode shape check to all relevant for-loop tests
diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java
index 5f18b57..8a59aa0 100644
--- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java
+++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java
@@ -2834,9 +2834,9 @@
}
@Test
- @TestMetadata("ForInReversedReversedRange.kt")
+ @TestMetadata("forInReversedReversedRange.kt")
public void testForInReversedReversedRange() throws Exception {
- runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt");
+ runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt");
}
@Test
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt
index 6915d62..f140ecd 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt
@@ -32,3 +32,10 @@
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 3 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt
index ba8b330..1d91c2a 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt
@@ -32,3 +32,10 @@
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt
index b48eb11..91c51a2 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt
@@ -29,3 +29,10 @@
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 4 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt
index db34cd1..695f993 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt
@@ -30,3 +30,10 @@
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 6 ILOAD
+// 4 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt
index 9b9e688..28d1226 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt
@@ -32,3 +32,10 @@
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 3 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt
index bf9e9aa..744ccc7 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt
@@ -23,3 +23,10 @@
// 0 iterator
// 0 hasNext
// 0 nextChar
+
+// JVM_IR_TEMPLATES
+// 10 ILOAD
+// 8 ISTORE
+// 0 IADD
+// 0 ISUB
+// 3 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt
index 151d23c..e1f81c0 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt
@@ -19,3 +19,10 @@
// 0 nextChar
// 1 INVOKEINTERFACE java/lang/CharSequence\.charAt \(I\)C
// 1 INVOKEINTERFACE java/lang/CharSequence\.length \(\)I
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt
index 2cd523c..a2271b5 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt
@@ -33,3 +33,10 @@
// The ICONST_0 is for initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 3 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt
index 557eab3..fbac7c4 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt
@@ -27,3 +27,10 @@
// The ICONST_0 is for initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 4 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt
index f8e5621..0a42b93 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt
@@ -31,3 +31,10 @@
// The ICONST_0 is for initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 6 ILOAD
+// 4 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt
index 1651494..672578f 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt
@@ -33,3 +33,10 @@
// The ICONST_0 is for initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 3 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt
index 6554311..ce551be 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt
@@ -33,3 +33,10 @@
// The ICONST_0 is for initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt
index 4638e67..087edff 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt
@@ -36,3 +36,10 @@
// The ICONST_0 is for initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 4 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt
index 2f95dab..7bfaf3d 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -23,4 +25,11 @@
// 0 getFirst
// 0 getLast
// 0 getStep
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt
index f549d73..f63c3a7 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -24,4 +26,11 @@
// 0 getLast
// 0 getStep
// 2 IF_ICMP
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt
index b04e9ac..43371eb 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -24,4 +26,11 @@
// 0 getLast
// 0 getStep
// 2 LCMP
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt
index 6d6b64f..523eef3 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt
@@ -19,3 +19,10 @@
}
// 0 iterator
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt
index 2274a5e..b9e8472 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt
@@ -27,3 +27,9 @@
// 1 IF_ICMPGE
// 1 IF
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 4 ISTORE
+// 2 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt
index b9d1a17..2a019b68 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt
@@ -27,3 +27,10 @@
// 0 IF_ICMPLE
// 1 IF_ICMPGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 4 ISTORE
+// 2 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt
index bddfdc0..c7b68c0 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt
@@ -25,3 +25,10 @@
// 0 IF_ICMPGT
// 0 IF_ICMPLE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 4 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt
index ab06d2f..d35db7d 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt
@@ -24,3 +24,10 @@
// 0 IF_ICMPGT
// 0 IF_ICMPLE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 4 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt
index 66ffeac..679ce61 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt
@@ -25,3 +25,10 @@
// 0 IF_ICMPGT
// 0 IF_ICMPLE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 4 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt
index 41b0f16..b4db297 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt
@@ -23,3 +23,10 @@
// 1 getIndices
// 1 getFirst
// 1 getLast
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 4 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt
index 26d7185..653ae1b 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt
@@ -24,3 +24,10 @@
// 0 IF_ICMPGT
// 0 IF_ICMPLE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 4 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt
index 0e18ea8..d080739 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt
@@ -24,3 +24,10 @@
// 0 IF_ICMPGT
// 0 IF_ICMPLE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 4 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt
index cae16a1..dcd5cbc 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt
@@ -28,3 +28,10 @@
// - Initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 2 ILOAD
+// 2 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt
index e92ec00..084b7b3 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt
@@ -25,3 +25,10 @@
// 1 next
// 0 component1
// 0 component2
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt
index b098bf6..40fd587 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt
@@ -31,3 +31,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt
index 63cc5f3..a47fbf8 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt
@@ -31,3 +31,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt
index 3dbed3e..5ad138c 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt
@@ -31,3 +31,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 2 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt
index 398cc02..f800b6d 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt
@@ -34,3 +34,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt
index 2cddbdd..b44307c 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -21,4 +23,11 @@
// 1 INVOKESTATIC .*\.array \(\)
// 1 ARRAYLENGTH
// 1 IF_ICMPGE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt
index 3e759da..a5e89f9 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -27,4 +29,11 @@
// 1 INVOKESTATIC .*\.longArray \(\)
// 2 ARRAYLENGTH
// 2 IF_ICMPGE
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 6 ISTORE
+// 0 IADD
+// 0 ISUB
+// 4 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt
index d3362e0..7fb258e 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt
@@ -37,3 +37,10 @@
// 0 getFirst
// 0 getLast
// 0 getStep
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 5 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt
index 784610c..b6347ea 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt
@@ -38,3 +38,10 @@
// 0 getLast
// 0 getStep
// 0 getIndices
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 4 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt
index 084c5c2..7b25286 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt
@@ -37,3 +37,10 @@
// 0 getFirst
// 0 getLast
// 0 getStep
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 5 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt
index ae85d27..f472c68 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt
@@ -39,3 +39,10 @@
// 0 getStep
// 0 reversed
// 0 step
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 6 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt
index 79f6366..03cdc230 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt
@@ -38,3 +38,10 @@
// 0 getLast
// 0 getStep
// 0 reversed
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 5 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt
index e7e9f33..602b91d 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt
@@ -39,3 +39,10 @@
// 0 getStep
// 0 reversed
// 0 step
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 5 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt
index c2e4219..e16f847 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt
@@ -38,3 +38,10 @@
// 0 getLast
// 0 getStep
// 0 step
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 6 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt
index db11336..5dd6324 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt
@@ -37,3 +37,10 @@
// 0 getFirst
// 0 getLast
// 0 getStep
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 5 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt
index 327a27b..37b1492 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt
@@ -37,3 +37,10 @@
// 0 getFirst
// 0 getLast
// 0 getStep
+
+// JVM_IR_TEMPLATES
+// 2 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt
index 545400b..a9527eb 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt
@@ -22,3 +22,10 @@
// 1 next
// 0 component1
// 0 component2
+
+// JVM_IR_TEMPLATES
+// 0 ILOAD
+// 0 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt
index 1fe083d..26e5a6f 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt
@@ -23,3 +23,10 @@
// 1 component1
// 1 component2
// 1 reversed
+
+// JVM_IR_TEMPLATES
+// 0 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt
index 4ef7213..deff5d2 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt
@@ -27,3 +27,10 @@
// The ICONST_0 is for initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 2 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt
index 8854d8b..2bebffe 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt
@@ -30,4 +30,11 @@
// JVM_IR_TEMPLATES
// 1 IF_ICMPGE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 4 ISTORE
+// 2 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt
index 243dbf9..07c2026 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -24,4 +26,11 @@
// 0 getLast
// 0 getStep
// 2 IF_ICMP
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt
index 0e3fb0a..f70e8fe 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt
@@ -27,4 +27,6 @@
// 1 IF
// 4 ILOAD
// 3 ISTORE
+// 1 IADD
+// 0 ISUB
// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt
index e74ea96..f9d4e64 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -24,4 +26,11 @@
// 0 getLast
// 0 getStep
// 2 IF_ICMP
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt
index 3c594de..af8251d 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt
@@ -35,4 +35,11 @@
// JVM_IR_TEMPLATES
// 1 LCMP
// 1 IFGE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 0 ILOAD
+// 0 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt
index 886fc86..88e5aae 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -24,4 +26,11 @@
// 0 getLast
// 0 getStep
// 2 LCMP
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt
index cb9c0b8..a08cfd9 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt
@@ -33,4 +33,11 @@
// JVM_IR_TEMPLATES
// 1 IF_ICMPGE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt
index cbd8d3f..8cd10e3 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt
@@ -22,4 +22,11 @@
// 0 getLast
// 0 getStep
// 2 IF_ICMP
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 8 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt
index 080a8e7..6238535 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt
@@ -35,4 +35,11 @@
// JVM_IR_TEMPLATES
// 1 IF_ICMPGT
// 1 IF_ICMPLE
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 4 ISTORE
+// 3 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt
index 830098e..4f65583 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt
@@ -36,3 +36,10 @@
// 1 IF_ICMPGT
// 1 IF_ICMPLE
// 2 IF
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 4 ISTORE
+// 3 IADD
+// 1 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt
index 5a4e53a..da0a8e9 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt
@@ -35,4 +35,11 @@
// JVM_IR_TEMPLATES
// 1 IF_ICMPGT
// 1 IF_ICMPLE
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 4 ISTORE
+// 3 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt
index 34f72e6..2dd5747 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt
@@ -49,4 +49,11 @@
// 2 IF_ICMPLE
// 1 IFLE
// 4 IF
-// 2 LCMP
\ No newline at end of file
+// 2 LCMP
+
+// JVM_IR_TEMPLATES
+// 11 ILOAD
+// 9 ISTORE
+// 3 IADD
+// 1 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt
index dcf79ec..4390c7e 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt
@@ -27,3 +27,10 @@
// 0 getFirst
// 0 getLast
// 0 getStep
+
+// JVM_IR_TEMPLATES
+// 0 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt
index 1baf3ee..7dbfc22 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt
@@ -41,3 +41,10 @@
// 0 getEnd
// 3 getFirst
// 3 getLast
+
+// JVM_IR_TEMPLATES
+// 15 ILOAD
+// 9 ISTORE
+// 3 IADD
+// 1 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt
index b684b60..f9409a0 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt
@@ -50,4 +50,11 @@
// 1 IFGT
// 1 IFLE
// 4 IF
-// 2 LCMP
\ No newline at end of file
+// 2 LCMP
+
+// JVM_IR_TEMPLATES
+// 11 ILOAD
+// 9 ISTORE
+// 3 IADD
+// 1 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt
index b3f65f5..b0745b7 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt
@@ -27,3 +27,10 @@
// 0 getFirst
// 0 getLast
// 0 getStep
+
+// JVM_IR_TEMPLATES
+// 8 ILOAD
+// 4 ISTORE
+// 3 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt
index 5b75846..9e4567ff3 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt
@@ -53,4 +53,11 @@
// 1 IFGT
// 1 IFLE
// 4 IF
-// 2 LCMP
\ No newline at end of file
+// 2 LCMP
+
+// JVM_IR_TEMPLATES
+// 11 ILOAD
+// 9 ISTORE
+// 3 IADD
+// 1 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt
similarity index 94%
rename from compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt
rename to compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt
index 494304a..731b3a2 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt
@@ -41,3 +41,10 @@
// 0 getEnd
// 3 getFirst
// 3 getLast
+
+// JVM_IR_TEMPLATES
+// 15 ILOAD
+// 9 ISTORE
+// 3 IADD
+// 1 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt
index dd520bd..15766d8 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt
@@ -41,3 +41,10 @@
// 0 getEnd
// 3 getFirst
// 3 getLast
+
+// JVM_IR_TEMPLATES
+// 15 ILOAD
+// 9 ISTORE
+// 3 IADD
+// 1 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt
index 250c982..592fbbb 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt
@@ -49,4 +49,11 @@
// 3 reversed
// 3 getFirst
// 3 getLast
-// 3 getStep
\ No newline at end of file
+// 3 getStep
+
+// JVM_IR_TEMPLATES
+// 24 ILOAD
+// 12 ISTORE
+// 4 IADD
+// 1 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt
index 259ff412..907e753 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt
@@ -49,4 +49,11 @@
// 3 reversed
// 3 getFirst
// 3 getLast
-// 3 getStep
\ No newline at end of file
+// 3 getStep
+
+// JVM_IR_TEMPLATES
+// 24 ILOAD
+// 12 ISTORE
+// 4 IADD
+// 1 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt
index 3c3b027..77b7e20 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt
@@ -28,3 +28,10 @@
// - Initializing the index in the lowered for-loop.
// 1 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 2 ILOAD
+// 2 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt
index 5fe54f6..38fbb23 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt
@@ -25,3 +25,10 @@
// 1 next
// 0 component1
// 0 component2
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt
index 60421e6..184f900 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt
@@ -31,3 +31,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt
index c884418..d37a643 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt
@@ -31,3 +31,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt
index 86ba7f2..f449eba 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt
@@ -31,3 +31,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 2 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt
index 5347ddc..90431bd 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt
@@ -41,3 +41,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for cmeThrown. 3rd is for initializing the index in the lowered for-loop.
// 3 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 5 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt
index 389e89f..3020c0d 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt
@@ -34,3 +34,10 @@
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
// 2 ICONST_0
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt
index 488e3d5..3f49202 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt
@@ -20,3 +20,10 @@
// 0 INVOKEINTERFACE
// 1 charAt \(I\)C
// 1 length \(\)I
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt
index b36d158..7c95b84 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt
@@ -25,3 +25,10 @@
// 1 IF_ICMPGE
// 0 IF_ICMPLT
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 2 ISTORE
+// 1 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt
index ea803f6..7942353 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -27,3 +29,10 @@
// 1 IF_ICMPGE
// 0 IF_ICMPLT
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt
index dc0d268..15bae23 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -25,4 +27,11 @@
// 0 getStep
// 1 IFGE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 4 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt
index 28c0a8a..90442ef 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt
@@ -24,3 +24,10 @@
// 1 IF_ICMPGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 6 ILOAD
+// 3 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt
index 1ec658f..6394346 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -26,3 +28,10 @@
// 1 IF_ICMPGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt
index ed369f8..962da64 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -29,3 +31,10 @@
// 1 IF_ICMPGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt
index 1b6265e..6cbc3fb 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt
@@ -25,3 +25,10 @@
// 1 LCMP
// 1 IFGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 0 ILOAD
+// 0 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt
index e2d012a..29e2a14 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -27,3 +29,10 @@
// 1 LCMP
// 1 IFGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt
index 9f4a809..5c8ccd7b 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt
@@ -1,3 +1,5 @@
+// IGNORE_BACKEND_FIR: JVM_IR
+
// IMPORTANT!
// Please, when your changes cause failures in bytecodeText tests for 'for' loops,
// examine the resulting bytecode shape carefully.
@@ -26,3 +28,10 @@
// 1 IFGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt b/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt
index f348020..6e96c36 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt
@@ -21,4 +21,11 @@
// 0 getFirst
// 0 getLast
// 1 IF_ICMP
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 4 ISTORE
+// 1 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt b/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt
index bb704b0..a2c687a 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt
@@ -40,5 +40,8 @@
// 16 IINC
// JVM_IR_TEMPLATES
+// 136 ILOAD
+// 56 ISTORE
// 0 IADD
-// 20 IINC
+// 0 ISUB
+// 20 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt b/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt
index 8d25daf..6eb14f9 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt
@@ -35,4 +35,11 @@
// 0 IF_ICMPGT
// 0 IF_CMPEQ
-// 8 IF_ICMPGE
\ No newline at end of file
+// 8 IF_ICMPGE
+
+// JVM_IR_TEMPLATES
+// 56 ILOAD
+// 24 ISTORE
+// 8 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt
index d24916c..ae9b22b 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt
@@ -27,3 +27,10 @@
// JVM_IR_TEMPLATES
// 1 IF_ICMPGE
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt
index 084fedc..fd6bc27 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt
@@ -19,4 +19,11 @@
// 0 getLast
// 0 getStep
// 2 IF_ICMP
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 5 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt
index 8297e69..d03587c 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt
@@ -29,4 +29,11 @@
// 1 NEW java/lang/IllegalArgumentException
// 1 ATHROW
// 0 IF
-// 0 ARETURN
\ No newline at end of file
+// 0 ARETURN
+
+// JVM_IR_TEMPLATES
+// 0 ILOAD
+// 0 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt
index e468f03..8f037f5 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt
@@ -18,20 +18,6 @@
// For "step" progressions in JVM IR, when the step is constant and == 1, and "step" is called on a literal progression which we already
// know to have a step whose absolute value is 1, we can essentially ignore the "step" call.
-//
-// Expected lowered form of loop:
-//
-// // Standard form of loop over progression
-// var inductionVar = 1
-// val last = 4
-// if (inductionVar <= last) {
-// // Loop is not empty
-// do {
-// val i = inductionVar
-// inductionVar += 1
-// // Loop body
-// } while (inductionVar <= last)
-// }
// 0 iterator
// 0 getStart
@@ -43,4 +29,11 @@
// 0 NEW java/lang/IllegalArgumentException
// 0 ATHROW
// 1 IF_ICMPLE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 2 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt
index 03f7ee8..53d93cc 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt
@@ -18,20 +18,7 @@
// For "step" progressions in JVM IR, when the step is constant and == 1, and "step" is called on a literal progression which we already
// know to have a step whose absolute value is 1, we can essentially ignore the "step" call.
-//
-// Expected lowered form of loop:
-//
-// // Standard form of loop over progression
-// var inductionVar = 1
-// val last = 4
-// if (inductionVar <= last) {
-// // Loop is not empty
-// do {
-// val i = inductionVar
-// inductionVar += 1
-// // Loop body
-// } while (inductionVar <= last)
-// }
+
// 0 iterator
// 0 getStart
@@ -43,4 +30,11 @@
// 0 NEW java/lang/IllegalArgumentException
// 0 ATHROW
// 1 IF_ICMPLE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 2 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt
index a45cd97..eaf4b0b 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt
@@ -19,20 +19,6 @@
// For "step" progressions in JVM IR, a call to getProgressionLastElement() is made to compute the "last" value.
// If the step is non-constant, there is a check that it is > 0, and if not, an IllegalArgumentException is thrown. However, when the
// step is constant and > 0, this check does not need to be added.
-//
-// Expected lowered form of loop:
-//
-// // Standard form of loop over progression
-// val last = 1
-// var inductionVar = getProgressionLastElement(1, 8, 2)
-// if (last <= inductionVar) {
-// // Loop is not empty
-// do {
-// val i = inductionVar
-// inductionVar += -2
-// // Loop body
-// } while (last <= inductionVar)
-// }
// 0 reversed
// 0 iterator
@@ -46,4 +32,11 @@
// 0 ATHROW
// 1 IF_ICMPGT
// 1 IF_ICMPLE
-// 2 IF
\ No newline at end of file
+// 2 IF
+
+// JVM_IR_TEMPLATES
+// 3 ILOAD
+// 2 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt
index 01ab7c3..7e0422e 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -29,3 +30,11 @@
// 2 IF
// 0 INVOKESTATIC kotlin/UInt.constructor-impl
// 0 INVOKE\w+ kotlin/UInt.(un)?box-impl
+
+
+// JVM_IR_TEMPLATES
+// 8 ILOAD
+// 6 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt
index 3682f7b..53bfb08 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -29,3 +30,11 @@
// 2 IF
// 0 INVOKESTATIC kotlin/ULong.constructor-impl
// 0 INVOKE\w+ kotlin/ULong.(un)?box-impl
+
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt
index d45d232..5b4b458 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt
@@ -67,3 +67,11 @@
// 0 getStep
// 0 INVOKESTATIC kotlin/U(Int|Long).constructor-impl
// 0 INVOKE\w+ kotlin/U(Int|Long).(un)?box-impl
+
+
+// JVM_IR_TEMPLATES
+// 40 ILOAD
+// 27 ISTORE
+// 6 IADD
+// 0 ISUB
+// 3 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt
index 32d19b7..187addb 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -29,3 +30,10 @@
// 2 IF
// 0 INVOKESTATIC kotlin/UInt.constructor-impl
// 0 INVOKE\w+ kotlin/UInt.(un)?box-impl
+
+// JVM_IR_TEMPLATES
+// 9 ILOAD
+// 6 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt
index eb984c8..bf00ec2 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -29,3 +30,10 @@
// 2 IF
// 0 INVOKESTATIC kotlin/ULong.constructor-impl
// 0 INVOKE\w+ kotlin/ULong.(un)?box-impl
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt
index 68214df..ec46f00 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -36,4 +37,11 @@
// JVM_IR_TEMPLATES
// 1 INVOKESTATIC kotlin/UnsignedKt.uintCompare
// 1 IFGE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 6 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt
index 77808f3..378396a 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -36,3 +37,10 @@
// JVM_IR_TEMPLATES
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 7 ILOAD
+// 6 ISTORE
+// 0 IADD
+// 0 ISUB
+// 2 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt
index a33f293..f52bb4d 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -39,4 +40,11 @@
// JVM_IR_TEMPLATES
// 1 INVOKESTATIC kotlin/UnsignedKt.ulongCompare
// 1 IFGE
-// 1 IF
\ No newline at end of file
+// 1 IF
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
\ No newline at end of file
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt
index 82e8312..086ed54 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// IMPORTANT!
@@ -36,3 +37,10 @@
// JVM_IR_TEMPLATES
// 1 IF
+
+// JVM_IR_TEMPLATES
+// 1 ILOAD
+// 1 ISTORE
+// 0 IADD
+// 0 ISUB
+// 1 IINC
diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt
index 366c5ca..ef7941e 100644
--- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt
+++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt
@@ -33,3 +33,10 @@
// 0 ARETURN
// 0 INVOKESTATIC kotlin/UInt.constructor-impl
// 0 INVOKE\w+ kotlin/UInt.(un)?box-impl
+
+// JVM_IR_TEMPLATES
+// 0 ILOAD
+// 0 ISTORE
+// 0 IADD
+// 0 ISUB
+// 0 IINC
\ No newline at end of file
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java
index bc9c6740..7e18d81 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java
@@ -2810,9 +2810,9 @@
}
@Test
- @TestMetadata("ForInReversedReversedRange.kt")
+ @TestMetadata("forInReversedReversedRange.kt")
public void testForInReversedReversedRange() throws Exception {
- runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt");
+ runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt");
}
@Test
diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java
index b81907d..e111da5 100644
--- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java
+++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java
@@ -2834,9 +2834,9 @@
}
@Test
- @TestMetadata("ForInReversedReversedRange.kt")
+ @TestMetadata("forInReversedReversedRange.kt")
public void testForInReversedReversedRange() throws Exception {
- runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt");
+ runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt");
}
@Test