llvm-project
3108485f - [RegAllocFast] Order partial defs before other defs (#222882)

Commit
27 days ago
[RegAllocFast] Order partial defs before other defs (#222882) ``` %0:gr64_with_sub_8bit = COPY $rax %0.sub_32bit, %1:gr32 = MULX32rr $ecx, implicit $edx ``` The partial def of %0 is live-through: it reads the rest of %0, so it must avoid the registers the instruction reads ($ecx, $edx) and is meant to be allocated before an ordinary def like %1, which may share a register with a use. The comparator in findAndSortDefOperandIndexes, from the 2020 rewrite c8757ff3aa7d ("RegAllocFast: Rewrite and improve"), tests `getSubReg() == 0`, the inverse of the allocation sites, so %1 is allocated first and takes $eax; %0 then misses its hint $rax, lands in $rsi, and the copy from $rax stays. Share one isLiveThroughDef predicate between the ordering and the allocation. %0 now takes $rax, the copy is deleted, and %1 takes $ecx. Aided by Opus 5
Author
Parents
Loading