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

[DAGCombine] Fix multi-use miscompile in load combine #81492

Closed
wants to merge 1 commit into from

Commits on Feb 12, 2024

  1. [DAGCombine] Fix multi-use miscompile in load combine

    The load combine replaces a number of original loads with one
    new loads and also replaces the output chains of the original loads
    with the output chain of the new load. This is only correct if
    the old loads actually get removed, otherwise they may get
    incorrectly reordered.
    
    The code did enforce that all involved operations are one-use
    (which also guarantees that the loads will be removed), with one
    exceptions: For vector loads, multi-use was allowed to support
    multiple extract elements from one load.
    
    This patch collects these extract elements, and then validates
    that the loads are only used inside them.
    
    I think an alternative fix would be to replace the uses of the old
    output chains with TokenFactors that include both the old output
    chains and the new output chain. However, I think the proposed
    patch is preferable, as the profitability of the transform in the
    general multi-use case is unclear, as it may increase the overall
    number of loads.
    
    Fixes llvm#80911.
    nikic committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    f122182 View commit details
    Browse the repository at this point in the history