<html><head><base href="x-msg://281/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 25, 2011, at 7:18 AM, Jonas Paulsson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; "><div dir="ltr">I'm working on live intervals and I'm curious about how LLVM typically would represent live info. Take the following case (after SimpleRegisterCoalescer):<br><br>BB#3: derived from LLVM BB %bb.nph<br>    Live Ins: %a0_h<br>    Predecessors according to CFG: BB#2<br>    %reg16500<def> = COPY %reg16499<br>    Successors according to CFG: BB#4<br><br>BB#4: derived from LLVM BB %for.body21<br>    Live Ins: %a0_h<br>    Predecessors according to CFG: BB#3 BB#4<br>    %reg16500<def> = add_twoAddr %reg16500, 1<br><br>    cmp_branch <BB#4>, %reg16500, %a0_h<br>    Successors according to CFG: BB#4 BB#5<br><br>BB#4 is a loop.<br><br>%reg16500 is first defined by a COPY, then updated at each iteration and used at the end as well of BB#4.<span class="Apple-converted-space"> </span><br><br>Live ins(BB#4) should include %reg16500 (Simple register coalescer did not care for this)<br>LiveRanges should be from the def in BB#3 to end of BB#3, from start of BB#4 to the add MI, from the add MI to the compare&branch MI.<br><br>Am I correct?<br></div></div></span></blockquote><div><br></div><div>The live-in lists on basic blocks are only used for physical registers. The are filled in after register allocation is complete by RegAllocBase::addMBBLiveIns.</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; "><div dir="ltr">I am trying to recompute live-info after the coalescer, so I also wonder if any or both of the add and cmp_branch MI's should have kill-flags for %reg16500?<br></div></div></span></blockquote><div><br></div><div>Kill flags are very difficult to keep updated when coalescing and allocating registers, so they are simply cleared by the coalescer and reinserted afterwards by LiveIntervalAnalysis::addKillFlags.</div><div><br></div><div>Thinking about it, it may make sense to also use kill flags for physical registers only.</div><div><br></div><div>/jakob</div><div><br></div></div></body></html>