<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi All,<div class=""><br class=""></div><div class="">The following code :</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">void</span> hexagon2( <span style="color: #ba2da2" class="">int</span> *a, <span style="color: #ba2da2" class="">int</span> *res )</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">  <span style="color: #ba2da2" class="">int</span> i = <span style="color: #272ad8" class="">100</span>; </div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">  <span style="color: #ba2da2" class="">while</span> ( i-- ) {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">    *res++ = *a++;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">  }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">}</div></div><div class=""><br class=""></div><div class="">gets compiled as a sub-optimal Software loop on LLVM 9.0 instead of a Hardware loop, whereas it was compiled as a Hardware Loop in LLVM 7.0. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">This is the final assembly code generated by LLVM 9.0 :</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>.text</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(209, 47, 27); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>.file<span class="Apple-tab-span" style="white-space:pre">       </span></span>"main.c"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>.globl<span class="Apple-tab-span" style="white-space:pre">      </span>hexagon2                <span style="color: #008400" class="">// -- Begin function hexagon2</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>.p2align<span class="Apple-tab-span" style="white-space:pre">    </span><span style="color: #272ad8" class="">2</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>.type<span class="Apple-tab-span" style="white-space:pre">       </span>hexagon2,@function</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">hexagon2:                               <span style="color: #008400" class="">// @hexagon2</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// %bb.0:                               // %entry.old</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>p0 = cmp.gtu(r0,r1); if (p0.new) jump:nt .LBB0_<span style="color: #272ad8" class="">5</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>r2 = r0</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">           </span>allocframe(<span style="color: #008400" class="">#0)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}                               </span>// encoding: [A,0x41'A',A,0x15'A',0x00,0x3c,0x02,0x70]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: .LBB0_5, kind: fixup_Hexagon_B9_PCREL</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// %bb.1:                               // %entry.old</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>r0 = sub(r1,r0)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>}                               </span>// encoding: [0x00,0xc1,0x20,0xf3]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>if (p0.new) jump:nt .LBB0_<span style="color: #272ad8" class="">5</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">          </span>p0 = cmp.gt(r0,<span style="color: #008400" class="">#399)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>}                               </span>// encoding: [A,0x48'A',A,0x5c'A',0xe0,0xf1,0x40,0x75]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: .LBB0_5, kind: fixup_Hexagon_B15_PCREL</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// %bb.2:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>r0 = <span style="color: #008400" class="">#-100</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>}                               </span>// encoding: [0x80,0xf3,0xdf,0x78]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">.LBB0_<span style="color: #272ad8" class="">3</span>:                                <span style="color: #008400" class="">// %while.body</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">                                        <span style="color: #008400" class="">// =>This Inner Loop Header: Depth=1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>r3 = add(r0,<span style="color: #008400" class="">#1)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">              </span>r4 = memw(r2++<span style="color: #008400" class="">#4)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>memw(r1++</span>#4) = r4.new</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>}                               </span>// encoding: [0x23,0x40,0x00,0xb0,0x24,0x40,0x82,0x9b,0x08,0xd2,0xa1,0xab]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>p0 = cmp.gtu(r0,r3); if (!p0.new) jump:t .LBB0_<span style="color: #272ad8" class="">3</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>r0 = r3</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>}                               </span>// encoding: [A,0x63'A',0x40'A',0x15'A',0x00,0xc0,0x63,0x70]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: .LBB0_3, kind: fixup_Hexagon_B9_PCREL</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// %bb.4:                               // %while.end</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>r31:<span style="color: #272ad8" class="">30</span> = dealloc_return(r30):raw</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>}                               </span>// encoding: [0x1e,0xc0,0x1e,0x96]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">.LBB0_<span style="color: #272ad8" class="">5</span>:                                <span style="color: #008400" class="">// %while.body.rtli</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>call memmove</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">              </span>r1:<span style="color: #272ad8" class="">0</span> = combine(r2,r1)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>r2 = <span style="color: #008400" class="">#400</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>}                               </span>// encoding: [A,0x40'A',A,0x5a'A',0x00,0x41,0x02,0xf5,0x02,0xf2,0x00,0x78]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: memmove, kind: fixup_Hexagon_B22_PCREL</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>r31:<span style="color: #272ad8" class="">30</span> = dealloc_return(r30):raw</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>}                               </span>// encoding: [0x1e,0xc0,0x1e,0x96]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">.Lfunc_end0:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>.size<span class="Apple-tab-span" style="white-space:pre">       </span>hexagon2, .Lfunc_end0-hexagon2</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class="">                                        <span style="color: #008400" class="">// -- End function</span></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="color: #008400" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">This is the assembly code generated by LLVM 7.0 :</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>.text</div><div style="margin: 0px; line-height: normal; color: rgb(209, 47, 27);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>.file<span class="Apple-tab-span" style="white-space:pre">       </span></span>"main.c"</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>.globl<span class="Apple-tab-span" style="white-space:pre">      </span>hexagon2                <span style="color: #008400" class="">// -- Begin function hexagon2</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>.p2align<span class="Apple-tab-span" style="white-space:pre">    </span><span style="color: #272ad8" class="">2</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>.type<span class="Apple-tab-span" style="white-space:pre">       </span>hexagon2,@function</div><div style="margin: 0px; line-height: normal;" class="">hexagon2:                               <span style="color: #008400" class="">// @hexagon2</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class="">// %bb.0:                               // %entry.old</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>p0 = cmp.gtu(r0,r1); if (p0.new) jump:nt .LBB0_<span style="color: #272ad8" class="">5</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>r2 = r0</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">               </span>allocframe(<span style="color: #008400" class="">#0)</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>}                               </span>// encoding: [A,0x41'A',A,0x15'A',0x00,0x3c,0x02,0x70]</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: .LBB0_5, kind: fixup_Hexagon_B9_PCREL</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class="">// %bb.1:                               // %entry.old</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>r0 = sub(r1,r0)</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}                               </span>// encoding: [0x00,0xc1,0x20,0xf3]</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>if (p0.new) jump:nt .LBB0_<span style="color: #272ad8" class="">5</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">              </span>p0 = cmp.gt(r0,<span style="color: #008400" class="">#399)</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>}                               </span>// encoding: [A,0x48'A',A,0x5c'A',0xe0,0xf1,0x40,0x75]</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: .LBB0_5, kind: fixup_Hexagon_B15_PCREL</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class="">// %bb.2:                               // %while.body.preheader</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>loop0(.LBB0_<span style="color: #272ad8" class="">3</span>,<span style="color: #008400" class="">#100)</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>}                               </span>// encoding: [0x20'A',0xc0'A',0x03'A',0x69'A']</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: .LBB0_3, kind: fixup_Hexagon_B7_PCREL</div><div style="margin: 0px; line-height: normal;" class="">.Ltmp0:                                 <span style="color: #008400" class="">// Block address taken</span></div><div style="margin: 0px; line-height: normal;" class="">.LBB0_<span style="color: #272ad8" class="">3</span>:                                <span style="color: #008400" class="">// %while.body</span></div><div style="margin: 0px; line-height: normal;" class="">                                        <span style="color: #008400" class="">// =>This Inner Loop Header: Depth=1</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>r0 = memw(r2++<span style="color: #008400" class="">#4)</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">         </span>memw(r1++</span>#4) = r0.new</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>} :endloop0                     </span>// encoding: [0x20,0x80,0x82,0x9b,0x08,0xd2,0xa1,0xab]</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class="">// %bb.4:                               // %while.end</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>r31:<span style="color: #272ad8" class="">30</span> = dealloc_return(r30):raw</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>}                               </span>// encoding: [0x1e,0xc0,0x1e,0x96]</div><div style="margin: 0px; line-height: normal;" class="">.LBB0_<span style="color: #272ad8" class="">5</span>:                                <span style="color: #008400" class="">// %while.body.rtli</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>call memmove</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">          </span>r1:<span style="color: #272ad8" class="">0</span> = combine(r2,r1)</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">            </span>r2 = <span style="color: #008400" class="">#400</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>}                               </span>// encoding: [A,0x40'A',A,0x5a'A',0x00,0x41,0x02,0xf5,0x02,0xf2,0x00,0x78]</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class="">                                        </span>//   fixup A - offset: 0, value: memmove, kind: fixup_Hexagon_B22_PCREL</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>{</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">             </span>r31:<span style="color: #272ad8" class="">30</span> = dealloc_return(r30):raw</div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>}                               </span>// encoding: [0x1e,0xc0,0x1e,0x96]</div><div style="margin: 0px; line-height: normal;" class="">.Lfunc_end0:</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>.size<span class="Apple-tab-span" style="white-space:pre">       </span>hexagon2, .Lfunc_end0-hexagon2</div><div style="margin: 0px; line-height: normal;" class="">                                        <span style="color: #008400" class="">// -- End function</span></div><div class=""><span style="color: #008400" class=""><br class=""></span></div><div class=""><span style="color: #008400" class=""><br class=""></span></div><div class=""><div style="font-family: Helvetica; font-size: 12px;" class="">The code generated by LLVM 7.0 is better than LLVM 9.0 because 9.0 did not made use of Hardware loops.  This is in my opinion a bad regression from some earlier version. This is not an isolated case, more cases of the same LLVM 9 ‘defect’ are easy to find.</div></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">I have investigated the issue and I identified the root cause of it, which is related with the initial use of the “llvm.uadd" intrinsic in LLVM 9.0 to increment the loop Induction Variable, instead of an “add” instruction like LLVM 7.0. </div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">This is the while.body excerpt after "CodeGen Prepare” in LLVM 9.0</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">while.body:                                       ; preds = %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">entry.old</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %while.body</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %lsr.iv = phi i32 [ </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">%math</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">while.body</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ], [ </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">-100</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">entry.old</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %res.addr.04 = phi i32* [ %cgep1, %while.body ], [ %res, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">entry.old</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %a.addr.03 = phi i32* [ %cgep, %while.body ], [ %a, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">entry.old</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ]</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %6 = load i32, i32* %a.addr.03, align 4, !tbaa !2</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  store i32 %6, i32* %res.addr.04, align 4, !tbaa !2</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">7</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">call</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">{</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i32</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">,</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">i1 } @llvm.uadd.with.overflow.i32(i32 </span><span style="font-variant-ligatures: no-common-ligatures" class="">%lsr.iv, </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">i32 </span><span style="font-variant-ligatures: no-common-ligatures" class="">1</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">math</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">extractvalue</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">{</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i32</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">,</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">i1 } </span><span style="font-variant-ligatures: no-common-ligatures" class="">%</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">7</span><span style="font-variant-ligatures: no-common-ligatures" class="">, 0</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(212, 237, 244);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %ov = extractvalue { i32, i1 } %7, 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %cgep = getelementptr inbounds i32, i32* %a.addr.03, i32 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %cgep1 = getelementptr inbounds i32, i32* %res.addr.04, i32 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  br i1 %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">ov</span><span style="font-variant-ligatures: no-common-ligatures" class="">, label %while.end, label %while.body</span></div></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">And this is the same excerpt on  LLVM 7.0</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">while.body:                                       ; preds = %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">while.body.preheader</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %while.body</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %lsr.iv = phi i32 [ </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">-100</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">while.body.preheader</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ], [ </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">%lsr.iv.next</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">while.body</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ]</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %res.addr.04 = phi i32* [ %cgep1, %while.body ], [ %res, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">while.body.preheader</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ]</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %a.addr.03 = phi i32* [ %cgep, %while.body ], [ %a, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">while.body.preheader</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ]</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %6 = load i32, i32* %a.addr.03, align 4, !tbaa !2</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  store i32 %6, i32* %res.addr.04, align 4, !tbaa !2</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">lsr.iv.next</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">add</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">nsw</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i32 %lsr.iv, 1</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">tobool</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">icmp</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">eq</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i32 %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">lsr.iv.next</span><span style="font-variant-ligatures: no-common-ligatures" class="">, 0</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %cgep = getelementptr inbounds i32, i32* %a.addr.03, i32 1</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %cgep1 = getelementptr inbounds i32, i32* %res.addr.04, i32 1</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  br i1 %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">tobool</span><span style="font-variant-ligatures: no-common-ligatures" class="">, label %while.end, label %while.body</span></div><div class=""><br class=""></div></div></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">LLVM 9 uses “llvm.uadd”. This finally prevents the “Hexagon Hardware Loops” pass to recognise a hardware loop pattern, resulting in sub-optimal code, specially compared with what LLVM 7.0 produces.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">The code (excerpt) just before the Hexagon Hardware Loops pass on LLVM 9 is this:</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">; predecessors: %bb.1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  successors: %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">(0x80000000); %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">100.00</span><span style="font-variant-ligatures: no-common-ligatures" class="">%)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">8</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs = A2_tfrsi -100</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  J2_jump %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">, implicit-def $pc</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div style="font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">.while.body:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">; predecessors: %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  successors: %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">(0x04000000), %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">(0x7c000000); %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">(3.12%), %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">(96.88%)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %0:intregs = PHI %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">8</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %3:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %1:intregs = PHI %7:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %5:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %2:intregs = PHI %6:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %4:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">13</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs, %4:intregs = L2_loadri_pi %2:intregs</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">(tied-def 1)</span><span style="font-variant-ligatures: no-common-ligatures" class="">, 4 :: (load 4 from %ir.a.addr.03, !tbaa !2)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %5:intregs = S2_storeri_pi %1:intregs</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">(tied-def 0)</span><span style="font-variant-ligatures: no-common-ligatures" class="">, 4, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">13</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs :: (store 4 into %ir.res.addr.04, !tbaa !2)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %3:intregs = A2_addi %0:intregs, 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">14</span><span style="font-variant-ligatures: no-common-ligatures" class="">:predregs = </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">C2_cmpgtu</span><span style="font-variant-ligatures: no-common-ligatures" class=""> %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs, </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">%3:intregs</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  J2_jumpf %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">14</span><span style="font-variant-ligatures: no-common-ligatures" class="">:predregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">, implicit-def dead $pc</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  J2_jump %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">, implicit-def dead $pc</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">The same code on LLVM 7 is this:</div><div style="font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">2.while.body.preheader</span><span style="font-variant-ligatures: no-common-ligatures" class="">:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">; predecessors: %bb.1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  successors: %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">(0x80000000); %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">200.00</span><span style="font-variant-ligatures: no-common-ligatures" class="">%)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">11</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs = A2_tfrsi -100</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  J2_jump %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">, implicit-def </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">dead </span><span style="font-variant-ligatures: no-common-ligatures" class="">$pc</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div style="font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">.while.body:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">; predecessors: %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  successors: %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">(0x04000000), %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">(0x7c000000); %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">(3.12%), %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">(96.88%)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %0:intregs = PHI %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">11</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %3:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %1:intregs = PHI %7:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %5:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %2:intregs = PHI %6:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">, %4:intregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">12</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs, %4:intregs = L2_loadri_pi %2:intregs, 4 :: (load 4 from %ir.a.addr.03, !tbaa !2)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %5:intregs = S2_storeri_pi %1:intregs, 4, %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">12</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs :: (store 4 into %ir.res.addr.04, !tbaa !2)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %3:intregs = A2_addi %0:intregs, 1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">13</span><span style="font-variant-ligatures: no-common-ligatures" class="">:predregs = </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">C2_cmpeqi</span><span style="font-variant-ligatures: no-common-ligatures" class=""> %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">:intregs, </span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">0</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  J2_jumpf %</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">13</span><span style="font-variant-ligatures: no-common-ligatures" class="">:predregs, %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">, implicit-def dead $pc</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  J2_jump %bb.</span><span style="font-variant-ligatures: no-common-ligatures; background-color: #d4edf4" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">, implicit-def dead $pc</span></div></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">The differences above allow LLVM 7 to turn %13, %3, %11 into a hardware Loop as shown in the assembly code earlier in this message. However, LLVM 9 can’t identify a Hardware loop pattern due to the odd C2_cmpgtu instruction that gets generated. This instruction is a consequence of the introduction of the “llvm.addu” intrinsic that I showed earlier.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">I am presenting here the case of Hexagon, but I suspect the same sub-optimal code may happen for the PowerPC (not checked yet).</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">All the code excerpts were obtained with -Os flags</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">I’m highly interested in getting in contact with someone familiar with the Hexagon/PowerPC targets regarding this subject. Any pointers to the right persons would be appreciated. My interest comes from the fact that I am proposing an improvement on the LSR pass that affects all targets and I need hardware loops to be properly generated in LLVM 9 like they used to be in LLVM 7. </div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">Thanks</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">John.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></body></html>