<div dir="ltr"><div><div><div><div><div>Hi Henry,<br><br></div>I have probably missed this mail earlier, sorry for the late answer.<br></div>1. The intention is to match as much "safe" cases as possible, and it *should* work for unsigned as well.<br></div>2. I guess this would solve it but not sure, however, I can check this tomorrow. (Or if you have a solution (if this works) feel free to send a patch about it, it would help a lot :) )<br><br></div>Cheers,<br></div>Peter<br></div><div class="gmail_extra"><br><div class="gmail_quote">2018-03-23 4:42 GMT+01:00 Henry Wong via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
Hi all,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
I have some confusion about LoopUnrolling.cpp.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
For the code given below, the loop does not unroll because the counter is unsigned. I read the code of LoopUnrolling.cpp and I think the relevant function is `forLoopMatcher()`, see <a href="https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Core/LoopUnrolling.cpp#L152" id="m_-7520465897462069865LPlnk517032" target="_blank">https://github.com/llvm-<wbr>mirror/clang/blob/master/lib/<wbr>StaticAnalyzer/Core/<wbr>LoopUnrolling.cpp#L152</a>.</div>
<div id="m_-7520465897462069865LPBorder_GTaHR0cHM6Ly9naXRodWIuY29tL2xsdm0tbWlycm9yL2NsYW5nL2Jsb2IvbWFzdGVyL2xpYi9TdGF0aWNBbmFseXplci9Db3JlL0xvb3BVbnJvbGxpbmcuY3BwI0wxNTI." class="m_-7520465897462069865LPBorder168579" style="width:100%;margin-top:16px;margin-bottom:16px;max-width:800px;min-width:424px">
<table id="m_-7520465897462069865LPContainer168579" style="padding:12px 36px 12px 12px;width:100%;border-width:1px;border-style:solid;border-color:rgb(200,200,200);border-radius:2px">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td>
<div id="m_-7520465897462069865LPImageContainer168579" style="margin-right:12px;height:160px;overflow:hidden">
<a id="m_-7520465897462069865LPImageAnchor168579" href="https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Core/LoopUnrolling.cpp#L152" target="_blank"><img id="m_-7520465897462069865LPThumbnailImageId168579" alt="" style="display:block" src="https://avatars2.githubusercontent.com/u/1386314?s=400&v=4" width="160" height="160"></a></div>
</td>
<td style="width:100%">
<div id="m_-7520465897462069865LPTitle168579" style="font-size:21px;font-weight:300;margin-right:8px;font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin-bottom:12px">
<a id="m_-7520465897462069865LPUrlAnchor168579" href="https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Core/LoopUnrolling.cpp#L152" style="text-decoration:none;color:rgb(0,75,139)" target="_blank">llvm-mirror/clang</a></div>
<div id="m_-7520465897462069865LPDescription168579" style="font-size:14px;max-height:100px;color:rgb(102,102,102);font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin-bottom:12px;margin-right:8px;overflow:hidden">
Mirror of official clang git repository located at <a href="http://llvm.org/git/clang" target="_blank">http://llvm.org/git/clang</a>. Updated every five minutes.</div>
<div id="m_-7520465897462069865LPMetadata168579" style="font-size:14px;font-weight:400;color:rgb(166,166,166);font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif">
<a href="http://github.com" target="_blank">github.com</a></div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
```</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<div>int func() {</div>
<div>  int sum = 0;</div>
<div>  unsigned i;</div>
<div>  for (i = 0; i < 10; ++i) {</div>
<div>    sum++;</div>
<div>  }</div>
<div>  return sum;</div>
<div>}</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
```</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
1.I want to known if loop-unrolling only considers the counter of type signed? </div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif;font-size:16px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400">2.Since the `IntegerLiteral` is of signed type,  when matching
 `IntegerLiteral`, does it need to add `ignoringParenImpCasts` to match the unsigned counter?</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_-7520465897462069865signature">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Henry Wong</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Qihoo 360 Codesafe Team</div>
</div>
</div>

<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>