If we hit the limit, we do expand the outstanding tokenfactors.
Otherwise, we might drop nodes with users in the unexpanded
tokenfactors. This fixes the crashes reported by Jordan Rupprecht.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 32659 Build 32658: arc lint + arc unit
Event Timeline
Can you get away with just adding all remaining TFs (not their operands) to Ops? That way we keep the TF smaller and the pruning search still happens. That seems sufficient to fix the dropped operator issue.
If my intuition is wrong and we do need to CompletelyExpanded you should disable the pruning search itself when it's not being used.
Yes we can, kind of. If we just add all remaining TFs, we might get stuck in a loop, because in some cases the simplified TokenFactor == N and N gets added to the worklist, because it is the single user of another tokenfactor. I changed it to expand the first outstanding tokenfactor and add the remaining ones unexpanded. THat way, we should not get stuck in a loop, while keeping the size small.
What do you think?
The problem with doing an small change is that we will definitely revisit the node again because it's changed and will then are likely to do another minor change inlining the next possible token factor. I suspect we're better off deferring updating the Changed predicate for TF operands until we've actually inlined its operands.
Agreed. I went for the current version to avoid a combine cycle which seemed to be caused by the manual AddToWorklist call earlier on. I'll dig some more.
Only add tokenfactors instead of inlining the first TF. Adjust logic for adding
TFs to the worklist accordingly.
Add option to adjust inline limit, for testing and added test that crashes with
the original patch.
LGTM modulo typo nit. Thanks!
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
1852 | nit: s/tokenfacto/Token Factor/g |
nit: s/tokenfacto/Token Factor/g