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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
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.
Update LangRef to clarify/improve the optnone guarantee for interprocedural optimizations.
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.
I don't like this redefinition.
I would suggest to introduce noipa attribute, like i thought this patch does.
Fair point
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
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.