Fix typo in phiprop's can_handle_load function.
This patch corrects a typo in the phiprop optimization pass, ensuring that load operations are handled correctly during propagation.
A typo in the can_handle_load function within the phiprop optimization pass has been corrected. The bug caused incorrect handling of load operations during propagation, potentially leading to suboptimal or incorrect code generation. The fix ensures that the basic block containing the virtual operand definition is properly dominated by the current basic block.
In Details
This patch fixes a bug in tree-ssa-phiprop.cc, specifically in the can_handle_load function. The condition for dominance check (dominated_by_p) was flawed due to a copy/paste error, causing incorrect analysis of load operations. This could prevent certain phi-propagation optimizations from occurring, impacting performance. The fix ensures the correct dominance relationship is established before proceeding with the optimization.
For Context
The SSA (Static Single Assignment) form is an intermediate representation used by compilers to facilitate various optimizations. The phi-propagation (phiprop) pass is an optimization that attempts to replace uses of variables defined by phi-nodes (which merge values from different control flow paths) with the original values themselves, potentially simplifying the code and improving performance. This commit addresses a bug in a helper function of that pass, preventing it from properly analyzing memory loads in some cases, and thus potentially missing optimization opportunities.