ira-costs.c
73.7 KB
-
Short-circuit alt_fail case in record_reg_classes · 3d8e4920
record_reg_classes is often the hottest function when generating unoptimised output. It seems typical for over 60% of the instructions it handles to be moves, and of course moves tend to be the instructions with the longest constraint strings. Maybe we should avoid using move constraints to set costs in unoptimised output and instead use the "natural" class for the mode being moved. That's too invasive for stage 3 though. However, seeing so many moves means that we see many "failing" alternatives, usually because of '*' or because of hard registers in function call sequences. The frequency of alternatives that are detected as failures after the first operand tends again to be more than 60%. Previously we would continue to process the other operands of the alternative regardless. This patch instead adds a short-cut. As well as avoiding unnecessary work, it means that the alt_fail variable can be jump-threaded away. Tested on aach64-linux-gnu and x86_64-linux-gnu. It reduces compile time by about 1% on some tests with "-g -O0". gcc/ * ira-costs.c (record_reg_classes): Break from the inner loop early once alt_fail is known to be true. Update outer loop handling accordingly. From-SVN: r244446
Richard Sandiford committed