1.4K Star 7.6K Fork 1.4K

GVP方舟编译器 / OpenArkCompiler

 / 详情

【spec502性能分析】--分支合并

待办的
成员
创建于  
2021-08-05 11:30

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)

评论 (0)

Leo Young 创建了任务
Leo Young 修改了描述
Leo Young 修改了标题
fredchow 添加协作者fredchow
展开全部操作日志

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
C++
1
https://gitee.com/openarkcompiler/OpenArkCompiler.git
git@gitee.com:openarkcompiler/OpenArkCompiler.git
openarkcompiler
OpenArkCompiler
OpenArkCompiler

搜索帮助