代码拉取完成,页面将自动刷新
df-problems.c df_note_compute
244 /* We might have gone past the start bit, so reinitialize it. */
(start_bit == 0)
245 if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
246 start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS; <===== BITMAP_ELEMENT_ALL_BITS == 128
247
248 /* Initialize for what is now start_bit. */
249 bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS; <===== it's always 0
<===== BITMAP_WORD_BITS == 64 BITMAP_ELEMENT_WORDS == 2
regassign u32 %74 (constval u32 0) <===== start_bit 初始值为0
regassign u32 %63 (iread u32 <* <$bitmap_element_def>> 3 (regread ptr %267)) <===== bi->elt1->indx
....
brfalse @@65 (ne i32 u32 (regread u32 %63, constval u32 0))
regassign u32 %74 (mul u32 (regread u32 %63, constval u32 128))
@@65 regassign u32 %20 (div u32 (regread u32 %74, constval u32 64))
regassign u32 %21 (rem u32 (regread u32 %20, constval u32 2)) <====== 从哪条分支走,这里都能被折叠成0
预期
245~246 分支合并,简化cfg (原来的if判断无论哪条分支都是在保证 start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS )
regassign u32 %74 (mul u32 (regread u32 %63, constval u32 128))
@@65 regassign u32 %20 (div u32 (regread u32 %74, constval u32 64))
regassign u32 %21 (rem u32 (regread u32 %20, constval u32 2))
然后由prop/constantfold等折叠为 regassign u32 %21 (constval u32 0)