<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">That code is probably mine originally, but it’s been a very long time since I touched the TBB/TBH stuff (4 years or so, IIRC), and I have no recollection of the specifics of that particular restriction. It’s entirely possible it is indeed too restrictive.<div><br></div><div>-Jim</div><div><br><div><div>On Jul 29, 2013, at 9:25 AM, Jakob Stoklund Olesen <<a href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><br class="Apple-interchange-newline">On Jul 29, 2013, at 6:50 AM, Chad Rosier <<a href="mailto:chad.rosier@gmail.com">chad.rosier@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Jakob,<br>You're the unfortunate soul who last touched the constant island pass, right?  Do you happen to have any insight for Daniel?<br></blockquote><div><br></div><div>Sorry, no. I don't remember working with that particular bit of code. You could try digging through the commit logs.</div><div><br></div><div>Thanks,</div><div>/jakob</div><div><br></div><div><br></div><br><blockquote type="cite"><div class="gmail_quote">On Tue, Jul 23, 2013 at 9:55 AM, Daniel Stewart<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:stewartd@codeaurora.org" target="_blank">stewartd@codeaurora.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-US"><p class="MsoNormal">In looking at the code in ARMConstantislandPass.cpp::optimizeThumb2JumpTables(), I see that there is the following condition for not creating tbb-based jump tables:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-family: 'Courier New'; color: rgb(79, 98, 40);">      // The instruction should be a tLEApcrel or t2LEApcrelJT; we want<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New'; color: rgb(79, 98, 40);">      // to delete it as well.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';">     <span class="Apple-converted-space"> </span><b><span style="color: rgb(152, 72, 7);">MachineInstr</span></b><span style="color: rgb(152, 72, 7);"><span class="Apple-converted-space"> </span></span>*LeaMI = PrevI;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';">     <span class="Apple-converted-space"> </span><b><span style="color: rgb(228, 108, 10);">if</span></b><span style="color: rgb(228, 108, 10);"><span class="Apple-converted-space"> </span></span>((LeaMI->getOpcode() !=<span class="Apple-converted-space"> </span><b><span style="color: rgb(152, 72, 7);">ARM</span></b>::tLEApcrelJT &&<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';">           LeaMI->getOpcode() !=<span class="Apple-converted-space"> </span><b><span style="color: rgb(152, 72, 7);">ARM</span></b>::t2LEApcrelJT) ||<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';">          LeaMI->getOperand(<span style="color: rgb(55, 96, 146);">0</span>).getReg() != BaseReg)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';">        OptOk =<span class="Apple-converted-space"> </span><b><span style="color: rgb(228, 108, 10);">false</span></b>;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';">     <span class="Apple-converted-space"> </span><b><span style="color: rgb(228, 108, 10);">if</span></b><span style="color: rgb(228, 108, 10);"><span class="Apple-converted-space"> </span></span>(!OptOk)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family: 'Courier New';">       <span class="Apple-converted-space"> </span><b><span style="color: rgb(228, 108, 10);">continue</span></b>;<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I am trying to figure out why the restriction of LeaMI->getOperand(0).getReg() != BaseReg is there. It seems this is overly restrictive. For example, here is a case where it succeeds:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">8944B   BB#53: derived from LLVM BB %172<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">            Live Ins: %R4 %R6 %D8 %Q5 %R9 %R7 %R8 %R10 %R5 %R11<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">            Predecessors according to CFG: BB#52<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">8976B           %R1<def> = t2LEApcrelJT <jt#2>, 2, pred:14, pred:%noreg<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">8992B           %R1<def> = t2ADDrs %R1<kill>, %R10, 18, pred:14, pred:%noreg, opt:%noreg<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">9004B           %LR<def> = t2MOVi 1, pred:14, pred:%noreg, opt:%noreg<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">9008B           t2BR_JT %R1<kill>, %R10<kill>, <jt#2>, 2<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';"><u></u> <u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">Shrink JT: t2BR_JT %R1<kill>, %R10<kill>, <jt#2>, 2<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">     addr: %R1<def> = t2ADDrs %R1<kill>, %R10, 18, pred:14, pred:%noreg, opt:%noreg<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">      lea: %R1<def> = t2LEApcrelJT <jt#2>, 2, pred:14, pred:%noreg<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">From this we see that the BaseReg = R1. R1 also happens to be the register used in the t2ADDrs calculation as well as defined by the t2LEApcrelJT operation. Because R1 is defined by t2LEApcrelJT, the restriction is met.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">However, in the next example, it fails:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">5808B   BB#30: derived from LLVM BB %105<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">            Live Ins: %R4 %R6 %D8 %Q5 %R9 %R7 %R8 %R10 %R5 %R11<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">            Predecessors according to CFG: BB#29<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">5840B           %R3<def> = t2LEApcrelJT <jt#1>, 1, pred:14, pred:%noreg<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">5856B           %R2<def> = t2ADDrs %R3<kill>, %R7, 18, pred:14, pred:%noreg, opt:%noreg<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">5872B           t2BR_JT %R2<kill>, %R7<kill>, <jt#1>, 1<u></u><u></u></span></p><p class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial;"><span style="font-size: 10pt; font-family: 'Courier New';">            Successors according to CFG: BB#90(17) BB#31(17) BB#32(17) BB#33(17) BB#34(17) BB#51(17)<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Here we see that the BaseReg = R2. But the t2LEApcrelJT instruction defines R3, not R2. But this is should be fine, because the t2ADDrs instruction takes R3 and defines R2, which is the real base address.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">So my question is why is the restriction<span class="Apple-converted-space"> </span><span style="font-family: 'Courier New';">LeaMI->getOperand(0).getReg() != BaseReg</span><span class="Apple-converted-space"> </span>there? Shouldn’t the restriction be trying to ensure that the register defined by t2LEApcrelJT also be the register used by the t2ADDrs instruction? It seems this test is being overly restrictive.<span><font color="#888888"><u></u><u></u></font></span></p><span><font color="#888888"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Daniel<u></u><u></u></p></font></span></div><br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>       <span class="Apple-converted-space"> </span><a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br><br></blockquote></div><br></blockquote></div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">LLVM Developers mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;"><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></span></blockquote></div><br></div></body></html>