<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=ks_c_5601-1987">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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:"Malgun Gothic";
        panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
        {font-family:"Malgun Gothic";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-autospace:none;
        word-break:break-hangul;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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:"Malgun Gothic";
        panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
        {font-family:"Malgun Gothic";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-autospace:none;
        word-break:break-hangul;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal">Let me answer to my own question. As far as I searched for, there is no option that forces the front-end not to change the branch way, but you can guess it (i.e., which IR branch way is equivalent to the source code level if statement way)
 by looking at the basic block labels. These basic block labels are discarded by default, so one may need to specify the ¡®-fno-discard-value-names¡¯ compiler option to prevent them discarded. The basic block followed by the taken branches are usually named as
 ¡®%if.then¡¯ in the IR level.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Note that this solution assumes no preliminary optimizations (O0).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hope this would help anybody.</p>
<p class="MsoNormal">Regards.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<b><span style="font-size:11.0pt">Gwangmu Lee</span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<span style="font-size:11.0pt">Ph.D. Student<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
+82) 10 4114 7441<o:p></o:p></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
Room 615, Bldg 301, Seoul National University, <br>
Gwanak-ro 1, Gwanak-gu, Seoul, South Korea.<o:p></o:p></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<a href="http://compsec.snu.ac.kr/~gwangmu">http://compsec.snu.ac.kr/~gwangmu</a><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>º¸³½ »ç¶÷:</b> À̱¤¹«<br>
<b>º¸³½ ³¯Â¥:</b> Monday, September 9, 2019 1:00:06 PM<br>
<b>¹Þ´Â »ç¶÷:</b> via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Á¦¸ñ:</b> Correspondence between IR and AST branch ways</font>
<div> </div>
</div>
<div>
<div class="WordSection1">
<p class="MsoNormal">Hi all,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I¡¯m currently writing an IR pass that¡¯s required to match a ¡®br¡¯ instruction (in IR) with a specific AST if statement. Matching itself can be done quite easily through DebugLoc, but I realized that the ¡®way¡¯ (as in where the control flow
 continues after it¡¯s been (not-)taken) of a branch can be changed in the course of IR optimizations. For example, a branch ¡®if (x == 0)¡¯ can be semantically transformed to ¡®if (x != 0)¡¯ in the resulting IR.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My question is, <i>how can I know such way-changing transformation has been done on which branches?</i> Or, is there any way I can prevent such way-changes during optimization?</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal">Gwangmu Lee.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<b><span style="font-size:11.0pt">Gwangmu Lee</span></b><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<span style="font-size:11.0pt">Ph.D. Student<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
+82) 10 4114 7441<o:p></o:p></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
Room 615, Bldg 301, Seoul National University, <br>
Gwanak-ro 1, Gwanak-gu, Seoul, South Korea.<o:p></o:p></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<a href="http://compsec.snu.ac.kr/~gwangmu">http://compsec.snu.ac.kr/~gwangmu</a><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:ideograph-numeric ideograph-other;word-break:keep-all">
<span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</div>
</body>
</html>