-force-attribute adds an attribute to function via command-line.
However, there was no counter-part to remove an attribute.
This patch adds -force-remove-attribute that removes an attribute from function.
Details
- Reviewers
chandlerc plotfi lanza jmolloy - Commits
- rG7a028fe70295: Force Remove Attribute
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Kindly ping.. This patch is convenient to chase down an issue by adding as well as removing an attribute of the function.
Overall this change makes sense. I don't see why we shouldn't have this ability to remove attrs.
llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp | ||
---|---|---|
27 | Hmm, do we care that we are changing the command line flag? Should -force-attribute imply -force-add-attribute? | |
36 | "from a function" | |
82 | Spell: *takes precedence. | |
112 | Introduce hasForceAttributes as a separate NFC patch. |
llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp | ||
---|---|---|
27 | @chandlerc Do you think -force-attribute should be preserved for any existing scripts or automation that may assume this? |
llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp | ||
---|---|---|
27 | @chandlerc @plotfi I could preserve the original name. Then I think we can have these two - force-attribute and remove-attribute. | |
112 | Do you mean like this? Isn't it too simple without additional checks like this? static bool hasForceAttributes() { return !ForceAttributes.empty(); } |
llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp | ||
---|---|---|
112 | Yeah, just mention its to make this diff simpler. I'll approve it. |
Adding jmolloy, he seems to be the original author.
llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp | ||
---|---|---|
27 | I think the renaming isn't necessary -- it'll break any downstream users with no benefit. -force-attribute and -force-remove-attribute are a satisfactory pairing. |
- Preserve the original flag -force-attribute
- Factor out hasForceAttributes into D85793
I think this LGTM. @kyulee are there any other tests that use this flag? Can you add a test that both adds and also removes some different attributes. Also a test that adds and removes he same attribute too would be good.
Ok, LGTM. I will land for you, but in your name on git. Thanks for this patch @kyulee.
Hmm, do we care that we are changing the command line flag? Should -force-attribute imply -force-add-attribute?