@@ -1094,61 +1094,6 @@ impl Insn {
10941094 let writes_allocator = Effect :: from_bits ( effect_sets:: Any , effect_sets:: Allocator ) ;
10951095 writes_allocator. includes ( self . get_effects ( ) )
10961096 }
1097-
1098- /// Return true if the instruction needs to be kept around. For example, if the instruction
1099- /// might have a side effect, or if the instruction may raise an exception.
1100- fn has_effects ( & self ) -> bool {
1101- match self {
1102- Insn :: Const { .. } => false ,
1103- Insn :: Param => false ,
1104- Insn :: StringCopy { .. } => false ,
1105- Insn :: NewArray { .. } => false ,
1106- // NewHash's operands may be hashed and compared for equality, which could have
1107- // side-effects.
1108- Insn :: NewHash { elements, .. } => !elements. is_empty ( ) ,
1109- Insn :: ArrayDup { .. } => false ,
1110- Insn :: HashDup { .. } => false ,
1111- Insn :: Test { .. } => false ,
1112- Insn :: Snapshot { .. } => false ,
1113- Insn :: FixnumAdd { .. } => false ,
1114- Insn :: FixnumSub { .. } => false ,
1115- Insn :: FixnumMult { .. } => false ,
1116- // TODO(max): Consider adding a Guard that the rhs is non-zero before Div and Mod
1117- // Div *is* critical unless we can prove the right hand side != 0
1118- // Mod *is* critical unless we can prove the right hand side != 0
1119- Insn :: FixnumEq { .. } => false ,
1120- Insn :: FixnumNeq { .. } => false ,
1121- Insn :: FixnumLt { .. } => false ,
1122- Insn :: FixnumLe { .. } => false ,
1123- Insn :: FixnumGt { .. } => false ,
1124- Insn :: FixnumGe { .. } => false ,
1125- Insn :: FixnumAnd { .. } => false ,
1126- Insn :: FixnumOr { .. } => false ,
1127- Insn :: FixnumXor { .. } => false ,
1128- Insn :: FixnumLShift { .. } => false ,
1129- Insn :: FixnumRShift { .. } => false ,
1130- Insn :: GetLocal { .. } => false ,
1131- Insn :: IsNil { .. } => false ,
1132- Insn :: LoadPC => false ,
1133- Insn :: LoadEC => false ,
1134- Insn :: LoadSelf => false ,
1135- Insn :: LoadField { .. } => false ,
1136- Insn :: CCall { elidable, .. } => !elidable,
1137- Insn :: CCallWithFrame { elidable, .. } => !elidable,
1138- Insn :: ObjectAllocClass { .. } => false ,
1139- // TODO: NewRange is effects free if we can prove the two ends to be Fixnum,
1140- // but we don't have type information here in `impl Insn`. See rb_range_new().
1141- Insn :: NewRange { .. } => true ,
1142- Insn :: NewRangeFixnum { .. } => false ,
1143- Insn :: StringGetbyte { .. } => false ,
1144- Insn :: IsBlockGiven => false ,
1145- Insn :: BoxFixnum { .. } => false ,
1146- Insn :: BoxBool { .. } => false ,
1147- Insn :: IsBitEqual { .. } => false ,
1148- Insn :: IsA { .. } => false ,
1149- _ => true ,
1150- }
1151- }
11521097}
11531098
11541099/// Print adaptor for [`Insn`]. See [`PtrPrintMap`].
@@ -4190,8 +4135,6 @@ impl Function {
41904135 for insn_id in & self . blocks [ block_id. 0 ] . insns {
41914136 let insn = & self . insns [ insn_id. 0 ] ;
41924137 if !insn. is_elidable ( ) {
4193- // TODO(Jacob): Remove this comment
4194- // if insn.has_effects() {
41954138 worklist. push_back ( * insn_id) ;
41964139 }
41974140 }
0 commit comments