<html><head><base href="x-msg://90/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 20, 2011, at 10:09 AM, Jonas Paulsson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; 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; ">If I write<br><br>%reg16506<def> = INSERT_SUBREG %reg16506, %reg16445, hi16;   #1<br>%reg16506<def> = INSERT_SUBREG %reg16506, %reg16468, lo16;   #2<br>store %reg16506                                                                                    #3<br></div></span></blockquote><div><br></div><div>This is still not SSA, you need something like:</div><div><br></div><div>a = IMPLICIT_DEF</div><div>b = INSERT_SUBREG a, foo, hi16</div><div>c = INSERT_SUBREG c, bar, lo16</div><div><br></div>But as you correctly observe:</div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; 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; ">it will not coalesce, as <span class="Apple-converted-space"> </span><br></div></span></blockquote><div><br></div><div>Which is why we added REG_SEQUENCE:</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; 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; ">But if I write<br><br>%reg16507<def> = COPY %reg16445;<br>%reg16508<def> = COPY %reg16468;<br>%reg16506<def> = REG_SEQUENCE %reg16507, hi16, %reg16508, lo16;<br>%reg16509<def> = st_2_1_postMod %reg16506, %reg16441, %reg16454, pred:20, pred:%CCReg;<br><br>then, there is not an erroneous live-range that interferes, so it coalesces.<br></div></span></blockquote><div><br></div><div>Yes, this is correct.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; 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; ">I suppose this means that the first version with INSERT_SUBREG's is breaking the SSA-form? Or am I doing it wrong?<br></div></span></blockquote><div><br></div><div>You were doing it wrong, but even when done correctly, chained INSERT_SUBREGs don't coalesce. That is really a coalescer bug.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; 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; "><br>In a similar case, the coalescer will not join the %reg16478 into %reg16511, although it makes perfect sense [after SimpleRegisterCoalescer]:<br><br>836L    %reg16511:hi16<def> = COPY %reg16473:lo16<kill>, %reg16511<imp-def>;<span class="Apple-converted-space"> </span><br>844L    %reg16511:lo16<def> = COPY %reg16478:lo16<kill>;<span class="Apple-converted-space"> </span><br>852L    %r4<def,dead> = st_postMod %reg16511<kill>, %r4<br>...<br>844L    %reg16511:lo16<def> = COPY %reg16478:lo16<kill>; Accum:%reg16511,16478<br>        Considering merging %reg16478 with reg%16511 to Accum<br>        RHS = %reg16478,0.000000e+00 = [804d,844d:0)  0@804d<br>        LHS = %reg16511,0.000000e+00 = [836d,844d:1)[844d,852d:0)  0@844d 1@836d<br> <b>   Interference!</b><br><br>It seems that there is a Live range from the first COPY  to the store, which interferes with the second COPY, which should have been coalesced. I find it worrisome that LLVM is not recognizing sub-registers apart from the super register. I would like to work with subregisters so as to define subregister liveness, but I find that LLVM is only keeping live information for the super-register, regardless of which subreg was defined. How could I overcome this?<br></div></span></blockquote><div><br></div><div>I am planning to fix this, but it is not an easy problem. The REG_SEQUENCE instruction provides a workaround.</div><div><br></div><div>/jakob</div><div><br></div></div></body></html>