Fix pasto in optimize_agr_copyprop_1
Corrects EH edge purging logic in copy propagation.
This commit fixes an error in the optimize_agr_copyprop_1 function within the copy propagation pass. Previously, it incorrectly used the basic block index of the statement being processed (stmt) to purge exception handling (EH) edges. The fix changes this to use the basic block index of the USE_STMT, which is the correct operand for this operation, resolving failures in several ACATS tests.
In Details
In tree-ssa-forwprop.cc, the function optimize_agr_copyprop_1 had an incorrect use of gimple_bb(stmt)->index when calling maybe_clean_or_replace_eh_stmt. The STMT parameter is primarily used for dumping, and its basic block index is not the correct one for purging EH edges. The EH edge purging logic should operate on the basic block associated with USE_STMT, as USE_STMT represents the current statement being processed for copy propagation.
- EH edges
- Exception Handling edges in a control flow graph, representing paths taken when an exception is thrown and caught.
- copy propagation
- An optimization that replaces occurrences of a variable with the value of a copy statement that assigned to it, potentially enabling further optimizations.
- basic block
- A contiguous sequence of basic instructions in a program with exactly one entry point and one exit point. Control flow graphs are built from basic blocks.