Go: Improve bad join order in guardingCall#18831
Conversation
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
|
This seems very brittle and even though the result works as intended, I don't see much reason for that - I'm actually somewhat confused about why this even works - it seems that the added pragma ought to prohibit the good order. It would seem safer to use |
|
I'm also confused about why that binding hint doesn't actually cue it to go the other way around, via the output/input first and only then getting to a call node. I note that the old order shows Property.checkOn magic'd in from the use-site, whereas the new one doesn't. I don't know off-hand if the magic is a good thing or not here. |
|
My intention was to make it evaluate |
smowton
left a comment
There was a problem hiding this comment.
I made a quick check to convince myself I wasn't going nuts, and surrounding any of f and c with bind-in or bind-out annotations has no effect. I would expect some to serve as a cue to go inp -> c -> f or f -> c -> inp, but apparently not. Since the annotations don't seem to be doing anything, I suggest simply dropping them.
| ) { | ||
| guardingFunction(g, f, inp, outp, p) and | ||
| c = f.getACall() and | ||
| c = pragma[only_bind_into](f).getACall() and |
There was a problem hiding this comment.
| c = pragma[only_bind_into](f).getACall() and | |
| c = f.getACall() and |
|
New RA looks good: DCA looks good. Thought: |
aschackmull
left a comment
There was a problem hiding this comment.
LGTM. This makes the join-order very clear and stable.
Old code:
Old join order (note that
FunctionOutput.getExitNodecomes from ``outp.getNode`, which is just a wrapper for it):It is finding the exit node corresponding to
inpof all callsc, and only afterwards restrictingcto be a call tof. This doesn't seem to be taking a long time, but it seems worth fixing the join order in case it takes a long time on some other database.New code:
New join order: