<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi, Sam,</p>
<p>Our general design has been that TTI is for cost modeling, not
for providing semantic information. This piece of information can
go in DataLayout, and I think we should put it there. Especially
given that this affects our canonicalization process, or
preference should be to avoid TTI. The more than TTI affects our
canonical form, the more fragmented it becomes, and the harder it
is to understand. Putting it in DataLayout also prevents us from
having to propagate TTI into a bunch of ValueTracking functions
(and maximally retains our ability to process IR without backends
compiled in).<br>
</p>
Thanks again,<br>
Hal<br>
<br>
<div class="moz-cite-prefix">On 12/14/2017 02:32 PM, Liu, Yaxun
(Sam) via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:DM5PR1201MB02522B9C07CADD810F99C5EBF80A0@DM5PR1201MB0252.namprd12.prod.outlook.com"
type="cite">
<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:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@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:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* 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:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Some optimizations depend on whether alloca
instruction always has non-zero value. Currently, this
checking is done by
<span style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white">
isKnownNonZero() in ValueTracking, and it assumes alloca in
address space 0 always has non-zero value but alloca in
non-zero address spaces does not always have non-zero value.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white">However,
this assumption is incorrect for certain targets. For
example, amdgcn---amdgiz target has alloca in address space
5, and its alloca always has non-zero value. This assumption
causes some optimizations disabled for amdgcn---amdgiz
target.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal">After discussions at <a
moz-do-not-send="true"
href="https://reviews.llvm.org/D40670">
https://reviews.llvm.org/D40670</a>, I propose to introduce
TargetTransformInfo::isAllocaPtrValueNonZero for representing
whether alloca instruction always has non-zero value, and add
a TargetTransformInfo argument to ValueTracking functions e.g.
<span style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white">
isKnownNonZero().<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white">As a
result, passes using ValueTracking will require
TargetTransformInfo.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white">Comments
are welcome.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white">Thanks.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Segoe
UI",sans-serif;color:black;background:white">Sam</span><o:p></o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>