]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Check hard_regno_mode_ok before setting lowest memory move cost for the mode with...
authorliuhongt <hongtao.liu@intel.com>
Mon, 3 Apr 2023 02:54:55 +0000 (10:54 +0800)
committerliuhongt <hongtao.liu@intel.com>
Wed, 19 Apr 2023 05:23:29 +0000 (13:23 +0800)
There's a potential performance issue when backend returns some
unreasonable value for the mode which can be never be allocate with
reg class.

gcc/ChangeLog:

PR rtl-optimization/109351
* ira.cc (setup_class_subset_and_memory_move_costs): Check
hard_regno_mode_ok before setting lowest memory move cost for
the mode with different reg classes.

gcc/ira.cc

index 6c7f4901e4cceb985f8d91087cd4da4a611d22b3..02dea5d49ee7b11f4f7ee9232a0ebee5c645518e 100644 (file)
@@ -588,6 +588,10 @@ setup_class_subset_and_memory_move_costs (void)
            /* Costs for NO_REGS are used in cost calculation on the
               1st pass when the preferred register classes are not
               known yet.  In this case we take the best scenario.  */
+           if (!targetm.hard_regno_mode_ok (ira_class_hard_regs[cl][0],
+                                            (machine_mode) mode))
+             continue;
+
            if (ira_memory_move_cost[mode][NO_REGS][0]
                > ira_memory_move_cost[mode][cl][0])
              ira_max_memory_move_cost[mode][NO_REGS][0]