These changes expand the FunctionAttr logic in order to mark functions as WriteOnly when appropriate. This is done through an additional bool variable and extended logic. Any feedback would be appreciated!
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
This patch looks fine to me.
I inlined some minor comments. Also, you should add a dedicated test case or explain in the commit message why that isn't possible yet.
lib/Transforms/IPO/FunctionAttrs.cpp | ||
---|---|---|
177 ↗ | (On Diff #152130) | [Style] I'm not a fan of comment lines in a conditional without braces but I can see that you only copied the style already used here. |
208 ↗ | (On Diff #152130) | [Typo] Two dots. |
276 ↗ | (On Diff #152130) | Maybe you want to place an assertion here (or prior to the loop) that ensures ReadsMemory and WritesMemory are never both set. After this point, it is implicitly assumed anyway (Writes && Reads would otherwise lead to a ReadOnly attribute). Another benefit of an explicit assumption would be that it allows you to simplify the two conditions later on. |
283 ↗ | (On Diff #152130) | [Typo] Leading space |