This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Fix infinite loop in reassociation combine
ClosedPublic

Authored by foad on Jul 14 2023, 3:40 AM.

Details

Reviewers
aemerson
Group Reviewers
Restricted Project
Commits
rGa1a9c53ae7f1: [GlobalISel] Fix infinite loop in reassociation combine
Summary

Don't reassociate (C1+C2)+Y -> C1+(C2+Y).

Fixes https://github.com/llvm/llvm-project/issues/63849

Diff Detail

Event Timeline

foad created this revision.Jul 14 2023, 3:40 AM
foad requested review of this revision.Jul 14 2023, 3:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 3:40 AM
foad edited the summary of this revision. (Show Details)Jul 14 2023, 3:42 AM
arsenm added a subscriber: arsenm.Jul 14 2023, 5:14 AM
arsenm added inline comments.
llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizer-combiner-reassoc.mir
3

don't need -global-isel

22

should run-pass=none to compact the register numbers, it's sometimes annoying when the register numbers actually tested don't match the ones in the file

foad updated this revision to Diff 540370.Jul 14 2023, 5:20 AM

Update test.

aemerson accepted this revision.Jul 14 2023, 12:19 PM
aemerson added inline comments.
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
4478–4484

Ca you add a comment here to explain why we do the second constant check.

llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizer-combiner-reassoc.mir
22

TIL

This revision is now accepted and ready to land.Jul 14 2023, 12:19 PM
This revision was landed with ongoing or failed builds.Jul 16 2023, 6:17 AM
This revision was automatically updated to reflect the committed changes.
foad added inline comments.Jul 16 2023, 6:18 AM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
4478–4484

I tried, but I'm not super confident about the explanation for why we are doing these reassociations in the first place.