<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 1 6 1 0 1 1 1 1 1;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">This is better suited to llvm-dev, so I'm directing it there.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">llvm-commits <llvm-commits-bounces@lists.llvm.org> on behalf of Qing Shan Zhang via llvm-commits <llvm-commits@lists.llvm.org><br>
<b>Reply-To: </b>Qing Shan Zhang <qshanz@cn.ibm.com><br>
<b>Date: </b>Sunday, August 19, 2018 at 10:10 PM<br>
<b>To: </b>"llvm-commits@lists.llvm.org" <llvm-commits@lists.llvm.org><br>
<b>Subject: </b>A question about the widely used "xxx | true" inside llvm<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Verdana",serif">Hi, guys,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Verdana",serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Verdana",serif">I notice that, we are widely using the statement "xxx | true" in llvm, such as "return SimplifyCFG(BB) | true;".  I have no idea if there is any downside
 to use the logic operator "||" here. Instead, I indeed see the potential problem to use bitwise operator "|". Because the bitwise operator do not short-circuit and the language std didn't specify the evaluation order for its lhs and rhs expression. That means,
 compiler is free to optimize this statement to "return true". <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Verdana",serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Verdana",serif">In shorts, IMO, it is legal to do the following optimization:<br>
bool bar() {<br>
  return foo() | true;<br>
}<br>
--><br>
bool bar() {<br>
  return true;  // the call to foo() is missing.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Verdana",serif">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Verdana",serif"> <br>
Best regards<br>
<br>
steven.zhang(</span><span style="font-size:10.0pt;font-family:"PMingLiU",serif">张</span><span style="font-size:10.0pt;font-family:"MS Mincho"">青山</span><span style="font-size:10.0pt;font-family:"Verdana",serif">)<br>
XLC++ Compiler Frontend Developer<br>
<br>
IBM China Development Lab, Shanghai <br>
Tel: (8621)609-28454 Mobile: +8615900986116<br>
E-mail: <a href="mailto:qshanz@cn.ibm.com">qshanz@cn.ibm.com</a><br>
</span><span style="font-size:10.0pt;font-family:"MS Mincho"">关注</span><span style="font-size:10.0pt;font-family:"Verdana",serif">IBM</span><span style="font-size:10.0pt;font-family:"MS Mincho"">中国</span><span style="font-size:10.0pt;font-family:"PMingLiU",serif">编译</span><span style="font-size:10.0pt;font-family:"MS Mincho"">器开</span><span style="font-size:10.0pt;font-family:"PMingLiU",serif">发团队</span><span style="font-size:10.0pt;font-family:"Verdana",serif">
 - </span><span style="font-size:10.0pt;font-family:"MS Mincho"">新浪微博</span><span style="font-size:10.0pt;font-family:"Verdana",serif">:
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.weibo.com_ibmcompiler&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=Pq-hk0wEUZUsW1TCR5WSeKCTC9p-kFZHFQXEwhAc7-k&s=A_Y7Fzz24WHgMcnZjkQNCxix8GiaTORg0B7J-WtGp9c&e=">
http://www.weibo.com/ibmcompiler</a> | developerWorks: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__t.cn_SPHWF4&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=Pq-hk0wEUZUsW1TCR5WSeKCTC9p-kFZHFQXEwhAc7-k&s=EJ9ZnKu_kAhWtR9SgL-C_ooRh7TCL-EGc0wAotg4wb4&e=">
http://t.cn/SPHWF4</a><br>
<br>
"All things are difficult before they are easy."<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-left:.5in"><br>
<br>
<o:p></o:p></p>
</div>
</body>
</html>