This is an archive of the discontinued LLVM Phabricator instance.

[SIFoldOperands] Move `isFoldableCopy` into a separate helper, NFC.
ClosedPublic

Authored by Pierre-vh on Nov 7 2022, 3:36 AM.

Details

Summary

There was quite a bit of logic there that was just in the middle of core loop. I think it makes it easier to follow when it's split off in a separate helper like the others.

Diff Detail

Event Timeline

Pierre-vh created this revision.Nov 7 2022, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 3:36 AM
Pierre-vh requested review of this revision.Nov 7 2022, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 3:36 AM
foad added a comment.Nov 7 2022, 6:08 AM

+1 for the idea.

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
1819

Personally I would prefer to make CurrentKnownM0Val a field of SIFoldOperands, rather than pass in a reference to a local variable. But perhaps that is overkill.

arsenm accepted this revision.Nov 7 2022, 7:54 AM
This revision is now accepted and ready to land.Nov 7 2022, 7:54 AM
Pierre-vh added inline comments.Nov 7 2022, 11:39 PM
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
1819

It may be a good idea but then it should be done as a separate patch IMO