<div dir="ltr"><div dir="ltr">Hi Shengchen,<div><br></div><div>Thank you for the code review and your suggestions!</div><div>We've addressed some of them (see inline) but still in the process of addressing them all.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 4, 2022 at 7:56 PM Kan, Shengchen <<a href="mailto:shengchen.kan@intel.com" target="_blank">shengchen.kan@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div>
<p class="MsoNormal">Hi Amir<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I read the MC-related code and it looks fine to me in general. I’m also supportive for the merge. The following are some suggestions.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<ol style="margin-top:0in" start="1" type="1">
<li style="margin-left:0in"><a href="https://llvm.org/docs/CodingStandards.html#braced-initializer-lists" target="_blank">https://llvm.org/docs/CodingStandards.html#braced-initializer-lists</a>  If you use a braced initializer
 list when initializing a variable, use an equals before the open curly brace. e.g BinaryBasicBlock.h</li></ol></div></div></blockquote><div>Addressed, soon to be published.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><ol style="margin-top:0in" start="1" type="1"><li><a href="https://llvm.org/docs/ProgrammersManual.html#fine-grained-debug-info-with-debug-type-and-the-debug-only-option" target="_blank">https://llvm.org/docs/ProgrammersManual.html#fine-grained-debug-info-with-debug-type-and-the-debug-only-option</a>
 DEBUG_TYPE should not be target specific,</li></ol>
<p>e.g, the definition of DEBUG_TYPE should be same in X86MCPlusBuilder.cpp and AArch64MCPlusBuilder.cpp</p></div></blockquote><div>Addressed in <a href="https://github.com/facebookincubator/BOLT/commit/7ca0c5a26714754ec1dd72576ddecaa8b459842c" target="_blank">https://github.com/facebookincubator/BOLT/commit/7ca0c5a26714754ec1dd72576ddecaa8b459842c</a> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div><p>
<u></u><u></u></p>
<ol style="margin-top:0in" start="3" type="1">
<li style="margin-left:0in">Functions getShortArithOpcode, getShortBranchOpcode in X86MCPlusBuilder.cpp use reversed mappings as functions getRelaxedOpcodeBranch, getRelaxedOpcodeArith in X86AsmBackend.cpp. Writing
 twice in two places makes the code difficult to maintain, could we generate the table with tablgen? The memory folding and unfolding tables in X86InstrFoldTables.cpp give an example.</li></ol></div></div></blockquote><div>To make sure I get it right: the tables in X86InstrFoldTables.cpp were generated with tablegen at some point, but are checked in as source code? Is there a way to rebuild these tables, so I can use that as an example?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div><ol style="margin-top:0in" start="3" type="1"><li style="margin-left:0in">It would better if functions isADD, isAND, isCMP, isDEC, isINC, isSUB and isTEST can be generated with tablgen.</li></ol></div></div></blockquote><div>Removed our definitions of isINC/isDEC: <a href="https://github.com/facebookincubator/BOLT/commit/9fec2d58964d643a7436ba2804f8fb967f23881e" target="_blank">https://github.com/facebookincubator/BOLT/commit/9fec2d58964d643a7436ba2804f8fb967f23881e</a></div><div>How do we approach generating isADD/... with tablegen? There are appropriate definitions (`defm ADD`, etc) in llvm/lib/Target/X86/X86InstrArithmetic.td but I'm not sure how to get tablegen to generate the tables.</div><div><br></div><div>Thanks,</div><div>-Amir</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Best<u></u><u></u></p>
<p class="MsoNormal">Shengchen<u></u><u></u></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> <b>On Behalf Of
</b>Wang, Phoebe via llvm-dev<br>
<b>Sent:</b> Thursday, December 30, 2021 5:33 PM<br>
<b>To:</b> Amir Aupov <<a href="mailto:amir.aupov@gmail.com" target="_blank">amir.aupov@gmail.com</a>><br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Preparing BOLT for LLVM monorepo<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)">Hi Amir,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)">Amazing job! Thanks for the quick and perfect changes. I don’t have any other problems now. Hoping seeing the code in main trunk soon.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)">Thanks<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)">Phoebe<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)"><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> Amir Aupov <<a href="mailto:amir.aupov@gmail.com" target="_blank">amir.aupov@gmail.com</a>>
<br>
<b>Sent:</b> Thursday, December 30, 2021 4:32 PM<br>
<b>To:</b> Wang, Phoebe <<a href="mailto:phoebe.wang@intel.com" target="_blank">phoebe.wang@intel.com</a>><br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Preparing BOLT for LLVM monorepo<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi Phoebe,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thank you again for reviewing the codebase and for your feedback. We've addressed it in recent commits:<u></u><u></u></p>
</div>
<div>
<pre style="white-space:pre-wrap"><span style="color:black">>  1.  Use the monorepo of LLVM in the example for convenience in <a href="https://github.com/facebookincubator/BOLT/blob/main/bolt/docs/OptimizingClang.md#getting-clang-7-sources" target="_blank">https://github.com/facebookincubator/BOLT/blob/main/bolt/docs/OptimizingClang.md#getting-clang-7-sources</a><u></u><u></u></span></pre>
<pre><span style="color:black">E.g, git clone --branch=release/7.x <a href="https://github.com/llvm/llvm-project.git" target="_blank">https://github.com/llvm/llvm-project.git</a><u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black"><a href="https://github.com/facebookincubator/BOLT/commit/c4ed6a11eb264660f5cfe7f5165df35b63d52608" target="_blank">https://github.com/facebookincubator/BOLT/commit/c4ed6a11eb264660f5cfe7f5165df35b63d52608</a><u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">>  1.  I found there are 142 code with “not implemented”, most of which are in Core/MCPlusBuilder.h.<u></u><u></u></span></pre>
<pre><span style="color:black">     *   Do they affect the functionality of BOLT?<u></u><u></u></span></pre>
<pre><span style="color:black">     *   Do you have plan to implement them recently or can they be removed instead?<u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black">Explained above.<u></u><u></u></span></pre>
<pre><span style="color:black">>  2.  I noticed some inconsistent use of braces in the code. Maybe better to follow with LLVM coding standard<<a href="https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements" target="_blank">https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements</a>>.<u></u><u></u></span></pre>
<pre><span style="color:black">     *   <a href="https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/BinaryBasicBlock.cpp#L241," target="_blank">https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/BinaryBasicBlock.cpp#L241,</a> L289<<a href="https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/BinaryBasicBlock.cpp#L289" target="_blank">https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/BinaryBasicBlock.cpp#L289</a>>, etc.<u></u><u></u></span></pre>
<pre><span style="color:black">     *   <a href="https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/DebugData.cpp#L193" target="_blank">https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/DebugData.cpp#L193</a><u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black"><a href="https://github.com/facebookincubator/BOLT/commit/fe3fcf094e320af4da4a98a5387820cd0ca826b9" target="_blank">https://github.com/facebookincubator/BOLT/commit/fe3fcf094e320af4da4a98a5387820cd0ca826b9</a><u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black"><a href="https://github.com/facebookincubator/BOLT/commit/b40699ed90882465e49ec46e4d3ad28623e54c69" target="_blank">https://github.com/facebookincubator/BOLT/commit/b40699ed90882465e49ec46e4d3ad28623e54c69</a><u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black"><a href="https://github.com/facebookincubator/BOLT/commit/c21ee425083276a7af700e232df15e2a3d31dacb" target="_blank">https://github.com/facebookincubator/BOLT/commit/c21ee425083276a7af700e232df15e2a3d31dacb</a><u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black"><a href="https://github.com/facebookincubator/BOLT/commit/ebc06afcfc35fbb4360b3788adeb6228c27ad830" target="_blank">https://github.com/facebookincubator/BOLT/commit/ebc06afcfc35fbb4360b3788adeb6228c27ad830</a><u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black"><a href="https://github.com/facebookincubator/BOLT/commit/dca3003fce711daee387bbbf66bf4ecbe1b9ab9b" target="_blank">https://github.com/facebookincubator/BOLT/commit/dca3003fce711daee387bbbf66bf4ecbe1b9ab9b</a><u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black"><a href="https://github.com/facebookincubator/BOLT/commit/cd526a4550455b0f203771088cef6e512b0dd1a2" target="_blank">https://github.com/facebookincubator/BOLT/commit/cd526a4550455b0f203771088cef6e512b0dd1a2</a><u></u><u></u></span></pre>
<pre><span style="color:black">>  3.  Some files don’t have a descriptions in the first line, e.g.  DynoStats.cpp<<a href="https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/DynoStats.cpp#L1" target="_blank">https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/DynoStats.cpp#L1</a>>, ParallelUtilities.cpp<<a href="https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/ParallelUtilities.cpp#L1" target="_blank">https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/ParallelUtilities.cpp#L1</a>>, etc.<u></u><u></u></span></pre>
<pre style="white-space:pre-wrap"><span style="color:black">>  4.  Leaving without descriptions might be fine, but the format should be consistent. Leaving with spaces like in BinaryFunctionProfile.cpp<<a href="https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/BinaryFunctionProfile.cpp#L1" target="_blank">https://github.com/facebookincubator/BOLT/blob/main/bolt/lib/Core/BinaryFunctionProfile.cpp#L1</a>> doesn’t make sense.<u></u><u></u></span></pre>
<p class="MsoNormal"><a href="https://github.com/facebookincubator/BOLT/commit/349c8abc696919e989418895f4ade24a4c910617" target="_blank">https://github.com/facebookincubator/BOLT/commit/349c8abc696919e989418895f4ade24a4c910617</a><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 21, 2021 at 4:22 AM Wang, Phoebe <<a href="mailto:phoebe.wang@intel.com" target="_blank">phoebe.wang@intel.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt">
<div>
<div>
<p class="MsoNormal"><span style="color:rgb(31,73,125)">Hi Amir,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)">It makes sense to me. Thanks!</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(31,73,125)"> </span><u></u><u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Amir Aupov via llvm-dev<br>
<b>Sent:</b> Tuesday, December 21, 2021 8:57 AM<br>
<b>To:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Preparing BOLT for LLVM monorepo<u></u><u></u></p>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">Hi Phoebe,<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks again for taking the time to look at the codebase. We've added your feedback to our upstreaming tracking issue on github: <a href="https://github.com/facebookincubator/BOLT/issues/248" target="_blank">https://github.com/facebookincubator/BOLT/issues/248</a>.
 We've started addressing the issues.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Regarding "not implemented” in Core/MCPlusBuilder.h: it's a design decision to prevent the use of non-implemented target-specific methods (these are virtual methods). Target-specific
 implementation goes to X86MCPlusBuilder and AArch64MCPlusBuilder. Some methods only make sense for specific targets, so we intend to keep llvm_unreachable statements in MCPlusBuilder.h.<u></u><u></u></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>

</blockquote></div></div>