This is an archive of the discontinued LLVM Phabricator instance.

Support optnone in SCCP
AbandonedPublic

Authored by dblaikie on Apr 12 2021, 5:15 PM.

Details

Reviewers
fhahn
jdoerfert
Summary

Looks like any place this code checks for declarations it should also
check for the optnone attribute to avoid doing any inter-functional
optimizations based on the contents of a optnone function.

Diff Detail

Event Timeline

dblaikie created this revision.Apr 12 2021, 5:15 PM
dblaikie requested review of this revision.Apr 12 2021, 5:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2021, 5:15 PM
dblaikie updated this revision to Diff 337250.Apr 13 2021, 1:38 PM

Fix think-o, this is about optnone, not about nodebug

dblaikie retitled this revision from Support nodebug in SCCP to Support optnone in SCCP.Apr 13 2021, 1:39 PM
dblaikie edited the summary of this revision. (Show Details)
dblaikie updated this revision to Diff 337273.Apr 13 2021, 3:38 PM

Fix misclassification of optnone function as not executed

fhahn added a comment.Apr 14 2021, 6:22 AM

I think this makes sense , but I don't think this behavior is clear for the current definition of optnone, which says .... with the exception of interprocedural optimization passes.. Do you think it would be worth to spell this out in a clearer way? Should all IPOs ignore optnone functions?

IIRC, the exception for IPOs was because we hadn't thought too much about what optnone ought to mean in that context--specifically, when two functions would interact in an IPO-ish way, but one function has optnone and the other doesn't.

I think it's fine to respecify optnone in a way that lets it factor into IPO decisions while preserving the intent of optnone (which is that we should leave them alone as much as possible). But, we should actually respecify it that way; then IPOs that don't conform become bugs/TODOs that need taking care of.

dblaikie updated this revision to Diff 337925.Apr 15 2021, 3:54 PM

Update LangRef to clarify/improve the optnone guarantee for interprocedural optimizations.

I think this makes sense , but I don't think this behavior is clear for the current definition of optnone, which says .... with the exception of interprocedural optimization passes.. Do you think it would be worth to spell this out in a clearer way? Should all IPOs ignore optnone functions?

IIRC, the exception for IPOs was because we hadn't thought too much about what optnone ought to mean in that context--specifically, when two functions would interact in an IPO-ish way, but one function has optnone and the other doesn't.

I think it's fine to respecify optnone in a way that lets it factor into IPO decisions while preserving the intent of optnone (which is that we should leave them alone as much as possible). But, we should actually respecify it that way; then IPOs that don't conform become bugs/TODOs that need taking care of.

Yep, makes sense to me - added LangRef update to this patch (can split it out if folks think that'd be best).

Probably should drop a note to llvm-dev, as the title of this review doesn't suggest it's redefining optnone.

lebedev.ri added a subscriber: lebedev.ri.

I don't like this redefinition.
I would suggest to introduce noipa attribute, like i thought this patch does.

Probably should drop a note to llvm-dev, as the title of this review doesn't suggest it's redefining optnone.

Fair point

I don't like this redefinition.
I would suggest to introduce noipa attribute, like i thought this patch does.

Hrm - wasn't expecting much disagreement here, based on my understanding of optnone. My mistake - posted an llvm-dev thread to further the discussion here: https://lists.llvm.org/pipermail/llvm-dev/2021-April/149960.html

Probably should drop a note to llvm-dev, as the title of this review doesn't suggest it's redefining optnone.

Fair point

I don't like this redefinition.
I would suggest to introduce noipa attribute, like i thought this patch does.

Hrm - wasn't expecting much disagreement here, based on my understanding of optnone. My mistake - posted an llvm-dev thread to further the discussion here: https://lists.llvm.org/pipermail/llvm-dev/2021-April/149960.html

Thanks, replied there.

dblaikie abandoned this revision.May 25 2022, 2:50 PM

Abandoning this since the discussion ended up pointing towards a preference for a distinct noipa attribute. Then that stalled out in discussions about whether that could be implemented via isInterposable or would need a separate proprety and then revisiting/restesting every check for interposability to instead test "interposable or noipa", basically... which made me a bit exhausted to think about visiting/changing/retesting all those cases and so I haven't picked this up again. It's over in D101011 if anyone wants to weigh in there/pick it up/poke it with a stick, etc.

All rather unfortunate, I think - there's a bunch of evidence that noipa was in a bunch of ways what some people expected from optnone. Pity we didn't get that from the start/weren't willing to accept that as a bugfix, of sorts, but ah well.

Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 2:50 PM