Middle-end: Don't disable optimizations for assume bodies
Assumed functions now inherit optimization attributes, enabling IPA.
This change enables Interprocedural Analysis (IPA) for assumed function bodies by ensuring they inherit optimization attributes from their parent function. Previously, assumed bodies were created with attributes that prevented IPA optimizations. This patch modifies create_assumption_fn to omit these optimization-disabling attributes unless the originating function also possesses them. It also corrects a bug where the assume_function field was not copied during cloning.
In Details
Previously, gimple_low.cc:create_assumption_fn unconditionally added attributes that disable IPA optimizations to newly created assumption functions. This commit removes those attributes, allowing assumption functions to inherit optimization attributes from the function they were outlined from. This is crucial for enabling IPA passes to analyze and optimize code within these assumed bodies. A bug in tree-inline.cc:initialize_cfun where assume_function was not copied during cloning is also fixed.
- IPA
- Interprocedural Analysis. A suite of compiler passes that analyze and optimize code across function boundaries, rather than within a single function.
- assume bodies
- Code blocks generated by GCC, often from outlining or simplifying assumptions, which might have specific attributes affecting optimization.
- optimization attributes
- Compiler flags or pragmas that control or influence the optimization passes applied to a function or code block.
- outlining
- A compiler optimization technique where frequently repeated code blocks are extracted into a separate function and replaced with a call to that function.