Backpropagation for abnormal PHI nodes is no longer prematurely terminated.
A bug in the backpropagation pass that caused an early return for abnormal PHI nodes has been corrected.
This commit fixes a bug in GCC’s backpropagation pass (gimple-ssa-backprop.cc) where an early return prevented the reprocessing of arguments for abnormal PHI nodes. This premature termination bypassed critical logic designed to refine initial optimistic assumptions made by the pass, potentially leading to incorrect analysis or missed optimization opportunities. The correction ensures that all necessary reprocessing occurs, improving the accuracy and effectiveness of the backpropagation pass.
In Details
This patch addresses a regression in backprop::process_var within gimple-ssa-backprop.cc. An earlier change introduced an early return for SSA names associated with 'abnormal' PHI nodes, inadvertently skipping the reprocess_inputs call for these PHIs. The reprocess_inputs step is crucial for undoing optimistic assumptions made during the initial phase of backpropagation regarding backedges. By preventing this early return, the pass correctly re-evaluates the inputs to these PHIs, thereby ensuring the accuracy of data flow analysis required for subsequent optimizations.
For Context
In compilers, when optimizing code, a process called "backpropagation" helps trace where values come from. Sometimes, in a program's control flow graph, there are special points called "PHI nodes" that merge different paths a value could take. An "abnormal PHI" node is a specific type of merge point that the compiler needs to handle carefully. This update fixes a bug in GCC where, for these abnormal PHI nodes, the backpropagation process would stop too early. This meant the compiler wasn't fully re-evaluating where the values at these merge points came from, which could lead to incorrect assumptions about the data. The fix ensures that the compiler thoroughly examines all paths, making the optimization process more accurate and reliable, and potentially leading to better-optimized code.