<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Arthur,</p>
<div class="moz-cite-prefix">On 4/10/21 11:39 PM, Arthur Eubanks
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPW48spBqoDKd9cPL0YCFSdxMDL+XLmALYKfNcaMEfYch+_4PA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">I think it makes more sense to do something like
that in a pass like InferFunctionAttrsPass. </div>
</blockquote>
InferFunctionAttrs is currently a module pass and appears to be
scheduled well before the CGSCC pass walk. I agree that we could
add this logic there and get consistent behavior between the two
pass managers. I'm a bit hesitant about having the logic for
inference in two different places, but thinking about it, this
doesn't seem too bad.<br>
<blockquote type="cite"
cite="mid:CAPW48spBqoDKd9cPL0YCFSdxMDL+XLmALYKfNcaMEfYch+_4PA@mail.gmail.com">
<div dir="ltr">We should decide to visit declarations consistently
with function pass managers, which currently don't visit
declarations. </div>
</blockquote>
I couldn't parse this statement, can you rephrase?<br>
<br>
<blockquote type="cite"
cite="mid:CAPW48spBqoDKd9cPL0YCFSdxMDL+XLmALYKfNcaMEfYch+_4PA@mail.gmail.com">
<div dir="ltr">Adding declarations to the new PM CGSCC infra would
add complexity and passes would have to check if they're working
with a declaration vs definition.<br>
</div>
</blockquote>
<p>Right, but wasn't that the behavior of the old pass manager?
This doesn't seem like a bad behavior tbh. I'm mostly curious to
know if it was a conscious decision to change behavior, or not. <br>
</p>
<p>Philip<br>
</p>
<blockquote type="cite"
cite="mid:CAPW48spBqoDKd9cPL0YCFSdxMDL+XLmALYKfNcaMEfYch+_4PA@mail.gmail.com"><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Apr 9, 2021 at 1:41 PM
Philip Reames <<a href="mailto:listmail@philipreames.com"
target="_blank" moz-do-not-send="true">listmail@philipreames.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I
ran across a dependency in the way the new and old pass
managers <br>
interact with function-attrs. I'm not sure whether this is
expected <br>
behavior or not, but with some digging, I couldn't find a
clear <br>
motivation. Anyone have context on this?<br>
<br>
Essentially, under the old pass manager, FunctionAttrs appears
to visit <br>
declarations, and under the new one, it doesn't. Here's an
example <br>
that shows how this can change the output of function-attrs:<br>
<br>
$ cat decl.ll<br>
<br>
declare void @readnone() readnone<br>
<br>
$ ./opt -S -function-attrs decl.ll -enable-new-pm=1<br>
; ModuleID = 'decl.ll'<br>
source_filename = "decl.ll"<br>
<br>
; Function Attrs: readnone<br>
declare void @readnone() #0<br>
<br>
attributes #0 = { readnone }<br>
<br>
$ ./opt -S -function-attrs decl.ll -enable-new-pm=0<br>
; ModuleID = 'decl.ll'<br>
source_filename = "decl.ll"<br>
<br>
; Function Attrs: nofree nosync readnone<br>
declare void @readnone() #0<br>
<br>
attributes #0 = { nofree nosync readnone }<br>
<br>
(The example uses nofree and nosync, but please don't focus on
the <br>
semantics of those attributes. That's a separate discussion.)<br>
<br>
To me, it seems odd to not have declarations be SCCs of their
own, and <br>
thus passed to function-attrs. Does anyone have a good
explanation for <br>
why we made this change? And in particular, what the "right"
way of <br>
inferring attributes for a partially annotated declaration
might be in <br>
our new world?<br>
<br>
Philip<br>
<br>
</blockquote>
</div>
</blockquote>
</body>
</html>