@@ -188,14 +188,14 @@ Index getMaxBits(Expression* curr, LocalInfoProvider* localInfoProvider) {
188188 case OrInt32: case XorInt32: return std::max (getMaxBits (binary->left , localInfoProvider), getMaxBits (binary->right , localInfoProvider));
189189 case ShlInt32: {
190190 if (auto * shifts = binary->right ->dynCast <Const>()) {
191- return std::min (Index (32 ), getMaxBits (binary->left , localInfoProvider) + (shifts-> value . geti32 () & 31 ));
191+ return std::min (Index (32 ), getMaxBits (binary->left , localInfoProvider) + Bits::getEffectiveShifts (shifts));
192192 }
193193 return 32 ;
194194 }
195195 case ShrUInt32: {
196196 if (auto * shift = binary->right ->dynCast <Const>()) {
197197 auto maxBits = getMaxBits (binary->left , localInfoProvider);
198- auto shifts = std::min (Index (shift-> value . geti32 () & 31 ), maxBits); // can ignore more shifts than zero us out
198+ auto shifts = std::min (Index (Bits::getEffectiveShifts (shift) ), maxBits); // can ignore more shifts than zero us out
199199 return std::max (Index (0 ), maxBits - shifts);
200200 }
201201 return 32 ;
@@ -204,7 +204,7 @@ Index getMaxBits(Expression* curr, LocalInfoProvider* localInfoProvider) {
204204 if (auto * shift = binary->right ->dynCast <Const>()) {
205205 auto maxBits = getMaxBits (binary->left , localInfoProvider);
206206 if (maxBits == 32 ) return 32 ;
207- auto shifts = std::min (Index (shift-> value . geti32 () & 31 ), maxBits); // can ignore more shifts than zero us out
207+ auto shifts = std::min (Index (Bits::getEffectiveShifts (shift) ), maxBits); // can ignore more shifts than zero us out
208208 return std::max (Index (0 ), maxBits - shifts);
209209 }
210210 return 32 ;
0 commit comments