@@ -1014,12 +1014,12 @@ mod hir_opt_tests {
10141014 PatchPoint NoSingletonClass(Array@0x1008)
10151015 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
10161016 v27:ArrayExact = GuardType v10, ArrayExact
1017- v34 :CInt64[0] = Const CInt64(0)
1017+ v35 :CInt64[0] = Const CInt64(0)
10181018 v29:CInt64 = ArrayLength v27
1019- v30:CInt64[0] = GuardLess v34 , v29
1020- v33 :BasicObject = ArrayAref v27, v30
1019+ v30:CInt64[0] = GuardLess v35 , v29
1020+ v34 :BasicObject = ArrayAref v27, v30
10211021 CheckInterrupts
1022- Return v33
1022+ Return v34
10231023 " ) ;
10241024 }
10251025
@@ -1047,12 +1047,12 @@ mod hir_opt_tests {
10471047 PatchPoint NoSingletonClass(Array@0x1008)
10481048 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
10491049 v27:ArrayExact = GuardType v10, ArrayExact
1050- v34 :CInt64[0] = Const CInt64(0)
1050+ v35 :CInt64[0] = Const CInt64(0)
10511051 v29:CInt64 = ArrayLength v27
1052- v30:CInt64[0] = GuardLess v34 , v29
1053- v33 :BasicObject = ArrayAref v27, v30
1052+ v30:CInt64[0] = GuardLess v35 , v29
1053+ v34 :BasicObject = ArrayAref v27, v30
10541054 CheckInterrupts
1055- Return v33
1055+ Return v34
10561056 " ) ;
10571057 }
10581058
@@ -1077,10 +1077,15 @@ mod hir_opt_tests {
10771077 v13:Fixnum[-10] = Const Value(-10)
10781078 PatchPoint NoSingletonClass(Array@0x1008)
10791079 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
1080- v31 :CInt64[-10] = Const CInt64(-10)
1080+ v32 :CInt64[-10] = Const CInt64(-10)
10811081 v26:CInt64 = ArrayLength v11
1082- v27:CInt64[-10] = GuardLess v31, v26
1083- SideExit GuardGreaterEq
1082+ v27:CInt64[-10] = GuardLess v32, v26
1083+ v28:CInt64 = AdjustBounds v27, v26
1084+ v29:CInt64[0] = Const CInt64(0)
1085+ v30:CInt64 = GuardGreaterEq v28, v29
1086+ v31:BasicObject = ArrayAref v11, v30
1087+ CheckInterrupts
1088+ Return v31
10841089 " ) ;
10851090 }
10861091
@@ -2343,12 +2348,12 @@ mod hir_opt_tests {
23432348 PatchPoint NoSingletonClass(Array@0x1008)
23442349 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
23452350 v27:ArrayExact = GuardType v10, ArrayExact
2346- v34 :CInt64[0] = Const CInt64(0)
2351+ v35 :CInt64[0] = Const CInt64(0)
23472352 v29:CInt64 = ArrayLength v27
2348- v30:CInt64[0] = GuardLess v34 , v29
2349- v33 :BasicObject = ArrayAref v27, v30
2353+ v30:CInt64[0] = GuardLess v35 , v29
2354+ v34 :BasicObject = ArrayAref v27, v30
23502355 CheckInterrupts
2351- Return v33
2356+ Return v34
23522357 " ) ;
23532358 assert_snapshot ! ( inspect( "test [1,2,3]" ) , @"1" ) ;
23542359 }
@@ -6055,12 +6060,12 @@ mod hir_opt_tests {
60556060 v12:Fixnum[0] = Const Value(0)
60566061 PatchPoint NoSingletonClass(Array@0x1010)
60576062 PatchPoint MethodRedefined(Array@0x1010, []@0x1018, cme:0x1020)
6058- v33 :CInt64[0] = Const CInt64(0)
6063+ v34 :CInt64[0] = Const CInt64(0)
60596064 v28:CInt64 = ArrayLength v23
6060- v29:CInt64[0] = GuardLess v33 , v28
6061- v32 :BasicObject = ArrayAref v23, v29
6065+ v29:CInt64[0] = GuardLess v34 , v28
6066+ v33 :BasicObject = ArrayAref v23, v29
60626067 CheckInterrupts
6063- Return v32
6068+ Return v33
60646069 " ) ;
60656070 // TODO(max): Check the result of `S[0] = 5; test` using `inspect` to make sure that we
60666071 // actually do the load at run-time.
@@ -6087,12 +6092,12 @@ mod hir_opt_tests {
60876092 v13:Fixnum[1] = Const Value(1)
60886093 PatchPoint NoSingletonClass(Array@0x1008)
60896094 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
6090- v31 :CInt64[1] = Const CInt64(1)
6095+ v32 :CInt64[1] = Const CInt64(1)
60916096 v26:CInt64 = ArrayLength v11
6092- v27:CInt64[1] = GuardLess v31 , v26
6093- v32 :Fixnum[5] = Const Value(5)
6097+ v27:CInt64[1] = GuardLess v32 , v26
6098+ v33 :Fixnum[5] = Const Value(5)
60946099 CheckInterrupts
6095- Return v32
6100+ Return v33
60966101 " ) ;
60976102 }
60986103
@@ -6117,10 +6122,15 @@ mod hir_opt_tests {
61176122 v13:Fixnum[-3] = Const Value(-3)
61186123 PatchPoint NoSingletonClass(Array@0x1008)
61196124 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
6120- v31 :CInt64[-3] = Const CInt64(-3)
6125+ v32 :CInt64[-3] = Const CInt64(-3)
61216126 v26:CInt64 = ArrayLength v11
6122- v27:CInt64[-3] = GuardLess v31, v26
6123- SideExit GuardGreaterEq
6127+ v27:CInt64[-3] = GuardLess v32, v26
6128+ v28:CInt64 = AdjustBounds v27, v26
6129+ v29:CInt64[0] = Const CInt64(0)
6130+ v30:CInt64 = GuardGreaterEq v28, v29
6131+ v31:BasicObject = ArrayAref v11, v30
6132+ CheckInterrupts
6133+ Return v31
61246134 " ) ;
61256135 }
61266136
@@ -6145,10 +6155,15 @@ mod hir_opt_tests {
61456155 v13:Fixnum[-10] = Const Value(-10)
61466156 PatchPoint NoSingletonClass(Array@0x1008)
61476157 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
6148- v31 :CInt64[-10] = Const CInt64(-10)
6158+ v32 :CInt64[-10] = Const CInt64(-10)
61496159 v26:CInt64 = ArrayLength v11
6150- v27:CInt64[-10] = GuardLess v31, v26
6151- SideExit GuardGreaterEq
6160+ v27:CInt64[-10] = GuardLess v32, v26
6161+ v28:CInt64 = AdjustBounds v27, v26
6162+ v29:CInt64[0] = Const CInt64(0)
6163+ v30:CInt64 = GuardGreaterEq v28, v29
6164+ v31:BasicObject = ArrayAref v11, v30
6165+ CheckInterrupts
6166+ Return v31
61526167 " ) ;
61536168 }
61546169
@@ -6173,12 +6188,12 @@ mod hir_opt_tests {
61736188 v13:Fixnum[10] = Const Value(10)
61746189 PatchPoint NoSingletonClass(Array@0x1008)
61756190 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
6176- v31 :CInt64[10] = Const CInt64(10)
6191+ v32 :CInt64[10] = Const CInt64(10)
61776192 v26:CInt64 = ArrayLength v11
6178- v27:CInt64[10] = GuardLess v31 , v26
6179- v32 :NilClass = Const Value(nil)
6193+ v27:CInt64[10] = GuardLess v32 , v26
6194+ v33 :NilClass = Const Value(nil)
61806195 CheckInterrupts
6181- Return v32
6196+ Return v33
61826197 " ) ;
61836198 }
61846199
@@ -8665,12 +8680,12 @@ mod hir_opt_tests {
86658680 v19:Fixnum[0] = Const Value(0)
86668681 PatchPoint NoSingletonClass(Array@0x1008)
86678682 PatchPoint MethodRedefined(Array@0x1008, []@0x1010, cme:0x1018)
8668- v37 :CInt64[0] = Const CInt64(0)
8683+ v38 :CInt64[0] = Const CInt64(0)
86698684 v32:CInt64 = ArrayLength v14
8670- v33:CInt64[0] = GuardLess v37 , v32
8671- v36 :BasicObject = ArrayAref v14, v33
8685+ v33:CInt64[0] = GuardLess v38 , v32
8686+ v37 :BasicObject = ArrayAref v14, v33
86728687 CheckInterrupts
8673- Return v36
8688+ Return v37
86748689 " ) ;
86758690 }
86768691
@@ -8705,11 +8720,12 @@ mod hir_opt_tests {
87058720 v31:CInt64 = UnboxFixnum v30
87068721 v32:CInt64 = ArrayLength v29
87078722 v33:CInt64 = GuardLess v31, v32
8708- v34:CInt64[0] = Const CInt64(0)
8709- v35:CInt64 = GuardGreaterEq v33, v34
8710- v36:BasicObject = ArrayAref v29, v35
8723+ v34:CInt64 = AdjustBounds v33, v32
8724+ v35:CInt64[0] = Const CInt64(0)
8725+ v36:CInt64 = GuardGreaterEq v34, v35
8726+ v37:BasicObject = ArrayAref v29, v36
87118727 CheckInterrupts
8712- Return v36
8728+ Return v37
87138729 " ) ;
87148730 }
87158731
@@ -8745,11 +8761,12 @@ mod hir_opt_tests {
87458761 v31:CInt64 = UnboxFixnum v30
87468762 v32:CInt64 = ArrayLength v29
87478763 v33:CInt64 = GuardLess v31, v32
8748- v34:CInt64[0] = Const CInt64(0)
8749- v35:CInt64 = GuardGreaterEq v33, v34
8750- v36:BasicObject = ArrayAref v29, v35
8764+ v34:CInt64 = AdjustBounds v33, v32
8765+ v35:CInt64[0] = Const CInt64(0)
8766+ v36:CInt64 = GuardGreaterEq v34, v35
8767+ v37:BasicObject = ArrayAref v29, v36
87518768 CheckInterrupts
8752- Return v36
8769+ Return v37
87538770 " ) ;
87548771 }
87558772
@@ -9340,21 +9357,22 @@ mod hir_opt_tests {
93409357 v25:CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v24, Value(VALUE(0x1048))
93419358 v26:RubyValue = LoadField v23, :_ep_specval@0x1050
93429359 v27:FalseClass = GuardBitEquals v26, Value(false)
9343- v37 :CPtr = GetEP 0
9344- v38 :RubyValue = LoadField v37 , :_ep_method_entry@0x1040
9345- v39 :CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v38 , Value(VALUE(0x1048))
9346- v40 :RubyValue = LoadField v37 , :_ep_specval@0x1050
9347- v41 :FalseClass = GuardBitEquals v40 , Value(false)
9360+ v38 :CPtr = GetEP 0
9361+ v39 :RubyValue = LoadField v38 , :_ep_method_entry@0x1040
9362+ v40 :CallableMethodEntry[VALUE(0x1048)] = GuardBitEquals v39 , Value(VALUE(0x1048))
9363+ v41 :RubyValue = LoadField v38 , :_ep_specval@0x1050
9364+ v42 :FalseClass = GuardBitEquals v41 , Value(false)
93489365 v28:Array = GuardType v9, Array
93499366 v29:Fixnum = GuardType v10, Fixnum
93509367 v30:CInt64 = UnboxFixnum v29
93519368 v31:CInt64 = ArrayLength v28
93529369 v32:CInt64 = GuardLess v30, v31
9353- v33:CInt64[0] = Const CInt64(0)
9354- v34:CInt64 = GuardGreaterEq v32, v33
9355- v35:BasicObject = ArrayAref v28, v34
9370+ v33:CInt64 = AdjustBounds v32, v31
9371+ v34:CInt64[0] = Const CInt64(0)
9372+ v35:CInt64 = GuardGreaterEq v33, v34
9373+ v36:BasicObject = ArrayAref v28, v35
93569374 CheckInterrupts
9357- Return v35
9375+ Return v36
93589376 " ) ;
93599377 }
93609378
0 commit comments