You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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.
Fixesllvm#80911.
0 commit comments