Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StackSlotColoring] Ignore non-spill objects in RemoveDeadStores. #80242

Merged
merged 3 commits into from
Feb 1, 2024

Commits on Feb 1, 2024

  1. Configuration menu
    Copy the full SHA
    19f1916 View commit details
    Browse the repository at this point in the history
  2. [StackSlotColoring] Ignore non-spill objects in RemoveDeadStores.

    The stack slot coloring pass is concerned with optimizing spill
    slots. If any change is a pass is made over the function to remove
    stack stores that use the same register and stack slot as an
    immediately preceding load.
    
    The register check is too simple for constant registers like AArch64
    and RISC-V's zero register. This register can be used as the result
    of a load if we want to discard the result, but still have the memory
    access performed. Like for a volatile or atomic load.
    
    If the code sees a load from the zero register followed by a store
    of the zero register at the same stack slot, the pass mistakenly
    believes the store isn't needed.
    
    Since the main stack coloring optimization is only concerned with
    spill slots, it seems reasonable that RemoveDeadStores should
    only be concerned with spills. Since we never generate a reload of
    x0, this avoids the issue seen by RISC-V.
    
    Test case concept is adapted from pr30821.mir from X86. That test
    had to be updated to mark the stack slot as a spill slot.
    
    Fixes llvm#80052.
    topperc committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    739901b View commit details
    Browse the repository at this point in the history
  3. fixup! remove IR from test.

    topperc committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    e42fccf View commit details
    Browse the repository at this point in the history