<div dir="ltr"><br><div>Please commit,</div><div><br></div><div>Thanks,</div><div>Manman</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 17, 2013 at 9:32 AM, David Peixotto <span dir="ltr"><<a href="mailto:dpeixott@codeaurora.org" target="_blank">dpeixott@codeaurora.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Manman,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for the tip on how to improve the test case. I’ve updated it with your suggestion to only produce the output once. I’ve attached the final patches.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Ok to commit?<u></u><u></u></span></p>
<div class="im"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-- </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Manman Ren [mailto:<a href="mailto:manman.ren@gmail.com" target="_blank">manman.ren@gmail.com</a>] <br>
<b>Sent:</b> Wednesday, October 16, 2013 4:39 PM<br><b>To:</b> David Peixotto<br><b>Cc:</b> </span><span style="font-size:10.0pt;font-family:"MS UI Gothic","sans-serif"">林作健</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">; llvm-commits</span></p>
<div><div class="h5"><br><b>Subject:</b> Re: review request Bug 16545 - COPY_STRUCT_BYVAL_I32 pseudo code generates unrecognized code<u></u><u></u></div></div><p></p></div></div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p>
<div><div><div><div><p class="MsoNormal">+;RUN: llc < %s -mtriple=thumbv5-none-linux-gnueabi -verify-machineinstrs -filetype=obj | llvm-objdump -triple thumbv5-none-linux-gnueabi -disassemble - | FileCheck %s --check-prefix=THUMB1<u></u><u></u></p>
</div><div><p class="MsoNormal">+;RUN: llc < %s -mtriple=thumbv5-none-linux-gnueabi -verify-machineinstrs -filetype=obj | llvm-objdump -triple thumbv5-none-linux-gnueabi -disassemble - | FileCheck %s --check-prefix=T1POST<u></u><u></u></p>
</div></div><div><div><p class="MsoNormal"><-- These two run lines are the same except the prefix, just wondering why?<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I was trying to have a test that checked for the presence of the correct load/store instructions and the absence of the post-increment version for thumb1. I want to pass on output like this:</span><u></u><u></u></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ldr r0, [r1]</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">add r0, #4</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">and fail on output like this:</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ldr r0, [r1], #4</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">It wasn’t clear to me how to combine those two checks into a single pass with FileCheck and so I used two passes. One to check for expected output and one to check for lack of bad output.</span><u></u><u></u></p>
</div></div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">About the testing case, I am not sure how to do it in a single pass, but you can save the objdump to a temp file and use the temp file to perform two checks:<u></u><u></u></p>
<div><p class="MsoNormal">cat %t | FileCheck %s --check-prefix=THUMB1<u></u><u></u></p></div><div><p class="MsoNormal">cat %t | FileCheck %s --check-prefix=T1POST<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p>
<div><p class="MsoNormal">LGTM otherwise,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Manman<u></u><u></u></p>
</div></div></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Oct 16, 2013 at 3:57 PM, David Peixotto <<a href="mailto:dpeixott@codeaurora.org" target="_blank">dpeixott@codeaurora.org</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Attached the updated patches based on the feedback so far. Please help review these changes. Thanks!</span><u></u><u></u></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Peixotto [mailto:<a href="mailto:dpeixott@codeaurora.org" target="_blank">dpeixott@codeaurora.org</a>] <br>
<b>Sent:</b> Wednesday, October 16, 2013 11:45 AM<br><b>To:</b> 'Manman Ren'<br><b>Cc:</b> '</span><span style="font-size:10.0pt;font-family:"MS UI Gothic","sans-serif"">林作健</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">'; 'llvm-commits'<br>
<b>Subject:</b> RE: review request Bug 16545 - COPY_STRUCT_BYVAL_I32 pseudo code generates unrecognized code</span><u></u><u></u></p></div></div><div><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for the feedback. I will make the changes you suggested and upload a new set of patches shortly. I responded below to your questions.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Manman Ren [<a href="mailto:manman.ren@gmail.com" target="_blank">mailto:manman.ren@gmail.com</a>] <br>
<b>Sent:</b> Wednesday, October 16, 2013 10:32 AM<br><b>To:</b> David Peixotto<br><b>Cc:</b> </span><span style="font-size:10.0pt;font-family:"MS UI Gothic","sans-serif"">林作健</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">; llvm-commits</span><u></u><u></u></p>
<div><p class="MsoNormal"><br><b>Subject:</b> Re: review request Bug 16545 - COPY_STRUCT_BYVAL_I32 pseudo code generates unrecognized code<u></u><u></u></p></div></div></div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">
<u></u><u></u></p><div><p class="MsoNormal">A few nitpicks on the refactoring patch:<u></u><u></u></p></div><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">+#include "llvm/Support/Debug.h"<u></u><u></u></p>
</div><div><p class="MsoNormal"> #include "llvm/Support/ErrorHandling.h"<u></u><u></u></p></div><div><p class="MsoNormal"> #include "llvm/Support/MathExtras.h"<u></u><u></u></p></div><div><p class="MsoNormal">
#include "llvm/Support/raw_ostream.h"<u></u><u></u></p></div><div><p class="MsoNormal"> #include "llvm/Target/TargetOptions.h"<u></u><u></u></p></div><div><p class="MsoNormal">+#include <utility><u></u><u></u></p>
</div></div><div><div><p class="MsoNormal"><-- I am not sure whether these two files are needed or you forgot to clean it up<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The <utility> include was added because I’m using std::pair. The Debug.h was leftover from debugging. I will remove it.</span><u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Could you add comments to each member function of TargetStructByvalEmitter and StructByvalEmitter?<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Sure, no problem</span><u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div>
<div><div><p class="MsoNormal">@@ -7286,26 +7603,19 @@ EmitStructByval(MachineInstr *MI, MachineBasicBlock *BB) const {<u></u><u></u></p></div><div><p class="MsoNormal"> Attribute::NoImplicitFloat) &&<u></u><u></u></p>
</div><div><p class="MsoNormal"> Subtarget->hasNEON()) {<u></u><u></u></p></div><div><p class="MsoNormal"> if ((Align % 16 == 0) && SizeVal >= 16) {<u></u><u></u></p></div><div><p class="MsoNormal">
- ldrOpc = ARM::VLD1q32wb_fixed;<u></u><u></u></p></div><div><p class="MsoNormal">- strOpc = ARM::VST1q32wb_fixed;<u></u><u></u></p></div><div><p class="MsoNormal"> UnitSize = 16;<u></u><u></u></p></div>
<div><p class="MsoNormal">- TRC_Vec = (const TargetRegisterClass*)&ARM::DPairRegClass;<u></u><u></u></p></div><div><p class="MsoNormal">- }<u></u><u></u></p></div><div><p class="MsoNormal">- else if ((Align % 8 == 0) && SizeVal >= 8) {<u></u><u></u></p>
</div><div><p class="MsoNormal">- ldrOpc = ARM::VLD1d32wb_fixed;<u></u><u></u></p></div><div><p class="MsoNormal">- strOpc = ARM::VST1d32wb_fixed;<u></u><u></u></p></div><div><p class="MsoNormal">+ } else if ((Align % 8 == 0) && SizeVal >= 8) {<u></u><u></u></p>
</div><div><p class="MsoNormal"> UnitSize = 8;<u></u><u></u></p></div><div><p class="MsoNormal">- TRC_Vec = (const TargetRegisterClass*)&ARM::DPRRegClass;<u></u><u></u></p></div><div><p class="MsoNormal">
}<u></u><u></u></p></div><div><p class="MsoNormal"> }<u></u><u></u></p></div><div><p class="MsoNormal"> // Can't use NEON instructions.<u></u><u></u></p></div><div><p class="MsoNormal"> if (UnitSize == 0) {<u></u><u></u></p>
</div><div><p class="MsoNormal">- ldrOpc = isThumb2 ? ARM::t2LDR_POST : ARM::LDR_POST_IMM;<u></u><u></u></p></div><div><p class="MsoNormal">- strOpc = isThumb2 ? ARM::t2STR_POST : ARM::STR_POST_IMM;<u></u><u></u></p>
</div><div><p class="MsoNormal"> UnitSize = 4;<u></u><u></u></p></div><div><p class="MsoNormal"> }<u></u><u></u></p></div><div><p class="MsoNormal"> }<u></u><u></u></p></div></div><div><div><p class="MsoNormal">
<-- Can you remove the parenthesis around the single statement?<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Will do.</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div></div><p class="MsoNormal">On the second patch:<u></u><u></u></p></div><div><div><div><p class="MsoNormal">+ unsigned emitConstantLoad(MachineBasicBlock *BB, MachineInstr *MI,<u></u><u></u></p></div><div><p class="MsoNormal">
+ DebugLoc &dl, unsigned Constant,<u></u><u></u></p></div><div><p class="MsoNormal">+ const DataLayout *DL) {<u></u><u></u></p></div><div><p class="MsoNormal">+ unsigned constReg = MRI.createVirtualRegister(TRC);<u></u><u></u></p>
</div><div><p class="MsoNormal">+ unsigned Idx = getConstantPoolIndex(BB->getParent(), DL, Constant);<u></u><u></u></p></div><div><p class="MsoNormal">+ AddDefaultPred(BuildMI(*BB, MI, dl, TII->get(ARM::tLDRpci)).addReg(<u></u><u></u></p>
</div><div><p class="MsoNormal">+ constReg, RegState::Define).addConstantPoolIndex(Idx));<u></u><u></u></p></div><div><p class="MsoNormal">+ return constReg;<u></u><u></u></p></div><div><p class="MsoNormal">+ return 0;<u></u><u></u></p>
</div><div><p class="MsoNormal">+ }<u></u><u></u></p></div><div><p class="MsoNormal">+<u></u><u></u></p></div></div><div><div><p class="MsoNormal"><-- Please remove the extra "return 0".<u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Will do.</span><u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><div><div><p class="MsoNormal">+;RUN: llc < %s -mtriple=thumbv5-none-linux-gnueabi -verify-machineinstrs -filetype=obj | llvm-objdump -triple thumbv5-none-linux-gnueabi -disassemble - | FileCheck %s --check-prefix=THUMB1<u></u><u></u></p>
</div><div><p class="MsoNormal">+;RUN: llc < %s -mtriple=thumbv5-none-linux-gnueabi -verify-machineinstrs -filetype=obj | llvm-objdump -triple thumbv5-none-linux-gnueabi -disassemble - | FileCheck %s --check-prefix=T1POST<u></u><u></u></p>
</div></div><div><div><p class="MsoNormal"><-- These two run lines are the same except the prefix, just wondering why?<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I was trying to have a test that checked for the presence of the correct load/store instructions and the absence of the post-increment version for thumb1. I want to pass on output like this:</span><u></u><u></u></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ldr r0, [r1]</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">add r0, #4</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">and fail on output like this:</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ldr r0, [r1], #4</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">It wasn’t clear to me how to combine those two checks into a single pass with FileCheck and so I used two passes. One to check for expected output and one to check for lack of bad output.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p></div></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">
Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Manman<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div></div><div><div><div><p class="MsoNormal">On Tue, Oct 15, 2013 at 3:27 PM, David Peixotto <<a href="mailto:dpeixott@codeaurora.org" target="_blank">dpeixott@codeaurora.org</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Manman,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I split the patch into two parts as requested. Most of the changes are in the refactoring patch. The thumb1 support is pretty straightforward after the refactoring is done.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for your help reviewing these patches.</span><u></u><u></u></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Manman Ren [mailto:<a href="mailto:manman.ren@gmail.com" target="_blank">manman.ren@gmail.com</a>] <br>
<b>Sent:</b> Tuesday, October 15, 2013 2:01 PM<br><b>To:</b> David Peixotto<br><b>Cc:</b> </span><span style="font-size:10.0pt;font-family:"MS UI Gothic","sans-serif"">林作健</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">; llvm-commits</span><u></u><u></u></p>
<div><div><p class="MsoNormal"><br><b>Subject:</b> Re: review request Bug 16545 - COPY_STRUCT_BYVAL_I32 pseudo code generates unrecognized code<u></u><u></u></p></div></div></div></div><div><div><p class="MsoNormal"> <u></u><u></u></p>
<div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">Hi David,<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Thanks for working on this.<u></u><u></u></p>
</div><div><p class="MsoNormal">Can you separate your patch to a refactoring patch and a patch for Thumb1?<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">It is easier to review and we should submit it as two commits.<u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Manman<u></u><u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"> <u></u><u></u></p><div><p class="MsoNormal">On Tue, Oct 15, 2013 at 1:16 PM, David Peixotto <<a href="mailto:dpeixott@codeaurora.org" target="_blank">dpeixott@codeaurora.org</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I’ve attached a patch that fixes the issue for thumb1 and thumb2. I refactored the code a bit to isolate all the target-specific to a helper class. It makes the code a bit longer, but it helped me to see where we need different operations for each subtarget and to implement them in isolation. I’m not opposed to doing it all inline, but I wasn’t sure I would be able to get all the details right that way.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This commit refactors the code so that we can easily support thumb1</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">targets and implements the thumb1 lowering.</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The original lowering algorithm is unchanged, but it now uses a</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">helper class to generate the machine instructions. The refactoring</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">introduces a StructByvalEmitter class that encapsulates the</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">operations needed to lower the COPY_STRUCT pseudo instruction. The</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">basic operations (e.g. emit load, emit store) are all wrappers to</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">the correct machine instruction for each target. The operations are</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">then defined for Arm, Thumb1, and Thumb2 targets.</span><u></u><u></u></p><div><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
</div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Manman Ren [mailto:<a href="mailto:manman.ren@gmail.com" target="_blank">manman.ren@gmail.com</a>] <br>
<b>Sent:</b> Tuesday, October 15, 2013 11:51 AM<br><b>To:</b> David Peixotto<br><b>Cc:</b> </span><span style="font-size:10.0pt;font-family:"MS UI Gothic","sans-serif"">林作健</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">; llvm-commits</span><u></u><u></u></p>
<div><div><p class="MsoNormal"><br><b>Subject:</b> Re: review request Bug 16545 - COPY_STRUCT_BYVAL_I32 pseudo code generates unrecognized code<u></u><u></u></p></div></div></div></div><div><div><p class="MsoNormal"> <u></u><u></u></p>
<div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal" style="margin-bottom:12.0pt"> <u></u><u></u></p><div><p class="MsoNormal">On Tue, Oct 15, 2013 at 10:13 AM, David Peixotto <<a href="mailto:dpeixott@codeaurora.org" target="_blank">dpeixott@codeaurora.org</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Why does this patch need to make a change to the ARMConstantIslandsPass? I think it may be because we are still using an arm instruction for the constant load instead of the equivalent thumb instruction (tLDRpci).</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I think your patch is incomplete for supporting thumb1. You need to modify the lowering for COPY_STRUCT_BYVAL_I32 in a few more places. We should be using the thumb1 opcodes for all the instructions generated by the lowering. You have handled the load/store case for the values, but you still need to take care of the constant pool load, the subtract (for the loop counter) and the branch. These instructions should use the tLDRpci (for constant pool load), tSubi8 (for the loop counter subtract), and tBcc (for the loop branch).</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I didn’t see your bug and had filed another bug for this same issue: <a href="http://llvm.org/bugs/show_bug.cgi?id=17309" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=17309</a>. Please also check that your patch works with the test case I uploaded to that bug (also attached to this email). In addition to checks for thumb1, this test case also exposes a bug in the current code with the thumb2 lowering. It will trigger an assertion because an operand is added to a full instruction. It looks like the thumb2 failure comes from a copy/paste error when building the machine instructions.</span><u></u><u></u></p>
</div></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Thanks for the testing case. Yes, the thumb2 failure is from a copy/pasto. I will fix that.<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u><u></u></p></div><div><p class="MsoNormal">Manman <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a>] <b>On Behalf Of </b>???<br>
<b>Sent:</b> Monday, October 14, 2013 6:29 PM<br><b>To:</b> Manman Ren<br><b>Cc:</b> llvm-commits<br><b>Subject:</b> Re: review request Bug 16545 - COPY_STRUCT_BYVAL_I32 pseudo code generates unrecognized code</span><u></u><u></u></p>
</div></div><div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">I didn't add THUMB1 lines for function h simple armv5te doesn't support vldr instr.<u></u><u></u></p><div><p class="MsoNormal">
And here is the patch for formatting.<u></u><u></u></p></div></div><div><p class="MsoNormal" style="margin-bottom:12.0pt"> <u></u><u></u></p><div><p class="MsoNormal">2013/10/15 Manman Ren <<a href="mailto:manman.ren@gmail.com" target="_blank">manman.ren@gmail.com</a>><u></u><u></u></p>
<div><p class="MsoNormal">Hi,<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">The changes to ARMISelLowering.cpp look good to me.<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u><u></u></p></div><div><div><p class="MsoNormal">--- lib/Target/ARM/ARMConstantIslandPass.cpp (<span lang="ZH-CN" style="font-family:"MS Gothic"">版本</span><span lang="ZH-CN"> </span>187190)<u></u><u></u></p>
</div><div><p class="MsoNormal">+++ lib/Target/ARM/ARMConstantIslandPass.cpp (<span lang="ZH-CN" style="font-family:"MS Gothic"">工作副本</span>)<u></u><u></u></p></div><div><p class="MsoNormal">@@ -634,6 +634,7 @@<u></u><u></u></p>
</div><div><p class="MsoNormal"> initializeFunctionInfo(const std::vector<MachineInstr*> &CPEMIs) {<u></u><u></u></p></div><div><p class="MsoNormal"> BBInfo.clear();<u></u><u></u></p></div><div><p class="MsoNormal">
BBInfo.resize(MF->getNumBlockIDs());<u></u><u></u></p></div><div><p class="MsoNormal">+ const ARMSubtarget * Subtarget = &MF->getTarget().getSubtarget<ARMSubtarget>();<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u><u></u></p></div><div><p class="MsoNormal"> // First thing, compute the size of all basic blocks, and see if the function<u></u><u></u></p></div><div><p class="MsoNormal"> // has any inline assembly in it. If so, we have to be conservative about<u></u><u></u></p>
</div><div><p class="MsoNormal">@@ -757,7 +758,12 @@<u></u><u></u></p></div><div><p class="MsoNormal"> case ARM::LDRi12:<u></u><u></u></p></div><div><p class="MsoNormal"> case ARM::LDRcp:<u></u><u></u></p>
</div><div><p class="MsoNormal"> case ARM::t2LDRpci:<u></u><u></u></p></div><div><p class="MsoNormal">- Bits = 12; // +-offset_12<u></u><u></u></p></div><div><p class="MsoNormal">+ if(Subtarget->hasV7Ops())<u></u><u></u></p>
</div><div><p class="MsoNormal">+ {<u></u><u></u></p></div><div><p class="MsoNormal">+ Bits = 12; // +-offset_12<u></u><u></u></p></div><div><p class="MsoNormal">+ } else {<u></u><u></u></p>
</div><div><p class="MsoNormal">+ Bits = 8; // +-offset_8<u></u><u></u></p></div><div><p class="MsoNormal">+ }<u></u><u></u></p></div></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div>
<p class="MsoNormal">Please simplify above by removing the parenthesis, or using "? 12 : 8".<u></u><u></u></p></div><div><p class="MsoNormal">I am not really familiar with the const island pass, so I cc'ed Bob for him to review it.<u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">The testing case looks good in general, is there any reason you didn't add THUMB1 lines for function h()?<u></u><u></u></p></div><div>
<p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Manman<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div></div><div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <u></u><u></u></p><div><p class="MsoNormal">On Sun, Oct 13, 2013 at 4:48 AM, <span lang="ZH-CN" style="font-family:"MS Gothic"">林作健</span> <<a href="mailto:manjian2006@gmail.com" target="_blank">manjian2006@gmail.com</a>> wrote:<u></u><u></u></p>
<div><p class="MsoNormal"> <u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><u></u><u></u></p></div><p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal">
<u></u><u></u></p></div></div></div></div></div></div></blockquote></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></div></div></div></div></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></div>
</div></div></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></div></div></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div></blockquote></div><br></div>