[PATCH] D37034: Insert IMPLICIT_DEFS for undef uses in tail merging

Chuan-Yue, Yuan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 02:26:28 PDT 2022


circYuan added a comment.

Hi @MatzeB, thank you for replying for this very the long yeras ago commit!!
AFAIK, this patch computes the live-ins of the common tail block, and compute the live-out of the common tail predecessor block.
If any of the predecessor live-outs mismatches the common tail live-ins, we insert IMPLICIT_DEF before the first terminator instruction,
so the predecessor can have that register as a live-out, is it correct?
One thing I'm confuse is that in function `mergeCommonTails`,  `LiveRegs` doesn't call `stepBackward`, it would only be called in `computeLiveIns` which is used
to compute the live-ins of the common tail block. The predecessor block only calls `addLiveOuts` which add the pristine registers and all successors old live-ins to `LiveRegs`,
but function `replaceTailWithBranchTo` reverse-iterates the MI and call `stepBackward`. Does `mergeCommonTails` also need to call `stepBackward` to update register to `LiveRegs`?
Since the IMPLICIT_DEF is inserted from the function `mergeCommonTails` in my case.
Many Thanks!!!


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D37034/new/

https://reviews.llvm.org/D37034



More information about the llvm-commits mailing list