• Josh Bleecher Snyder's avatar
    cmd/gc: don't give credit for NOPs during register allocation · 1848d714
    Josh Bleecher Snyder authored
    The register allocator decides which variables should be placed into registers by charging for each load/store and crediting for each use, and then selecting an allocation with minimal cost. NOPs will be eliminated, however, so using a variable in a NOP should not generate credit.
    
    Issue 7867 arises from attempted registerization of multi-word variables because they are used in NOPs. By not crediting for that use, they will no longer be considered for registerization.
    
    This fix could theoretically lead to better register allocation, but NOPs are rare relative to other instructions.
    
    Fixes #7867.
    
    LGTM=rsc
    R=rsc
    CC=golang-codereviews
    https://golang.org/cl/94810044
    1848d714
reg.c 28.2 KB