https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109351
Bug ID: 109351 Summary: RA uses lowest cost for the mode of different reg_classes w/o considering hard_regno_mode_ok. Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com Target Milestone: --- 575 for (cl = (int) N_REG_CLASSES - 1; cl >= 0; cl--) 576 { 577 if (cl != (int) NO_REGS) 578 for (mode = 0; mode < MAX_MACHINE_MODE; mode++) 579 { 580 ira_max_memory_move_cost[mode][cl][0] 581 = ira_memory_move_cost[mode][cl][0] 582 = memory_move_cost ((machine_mode) mode, 583 (reg_class_t) cl, false); 584 ira_max_memory_move_cost[mode][cl][1] 585 = ira_memory_move_cost[mode][cl][1] 586 = memory_move_cost ((machine_mode) mode, 587 (reg_class_t) cl, true); 588 /* Costs for NO_REGS are used in cost calculation on the 589 1st pass when the preferred register classes are not 590 known yet. In this case we take the best scenario. */ 591 if (ira_memory_move_cost[mode][NO_REGS][0] 592 > ira_memory_move_cost[mode][cl][0]) 593 ira_max_memory_move_cost[mode][NO_REGS][0] 594 = ira_memory_move_cost[mode][NO_REGS][0] 595 = ira_memory_move_cost[mode][cl][0]; 596 if (ira_memory_move_cost[mode][NO_REGS][1] 597 > ira_memory_move_cost[mode][cl][1]) 598 ira_max_memory_move_cost[mode][NO_REGS][1] 599 = ira_memory_move_cost[mode][NO_REGS][1] 600 = ira_memory_move_cost[mode][cl][1]; 601 } 602 } It could be a potential performance issue. It's from PR108707.