genattrtab: Isolate attribute simplification per instruction
Prevents stale simplification marks from affecting unrelated attribute evaluations, improving correctness and performance.
This commit modifies genattrtab to ensure attribute simplification is performed independently for each instruction code. It introduces a mechanism to clear all simplification marks before processing each instruction, removing the need for a previous clear_struct_flag call. This change prevents simplifications from one instruction from incorrectly influencing others, potentially leading to more optimized attribute values and a faster genattrtab execution.
In Details
The optimize_attrs pass in genattrtab.cc previously suffered from simplification marks (ATTR_CURR_SIMPLIFIED_P) persisting across instruction code evaluations. This commit replaces the per-instruction clear_struct_flag with a new clear_curr_simplified mechanism that ensures marks are cleared before each instruction's evaluation. This isolates simplification contexts, guaranteeing correctness and removing overhead associated with stale marks, while also providing performance gains.
- genattrtab
- A GCC internal tool that generates attribute tables used by various backends for instruction selection and scheduling.
- optimize_attrs
- A function within genattrtab that simplifies attribute values based on other attributes for a given instruction code.
- simplification marks
- Internal flags used during the attribute simplification process to track which expressions have already been processed for a given context.