This is an archive of the discontinued LLVM Phabricator instance.

Correctly report modified status for MemCpyOptimizer
ClosedPublic

Authored by serge-sans-paille on Jun 5 2020, 12:32 AM.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2020, 12:32 AM
foad accepted this revision.Jun 5 2020, 5:46 AM

Seems obviously correct - but slightly unfortunate that this will cause iterateOnFunction to go back and reprocess a prior instruction.

This revision is now accepted and ready to land.Jun 5 2020, 5:46 AM

Do you think it's worth passing the iterator as an extra argument?

Avoid re-processing the optimized call.

This revision was automatically updated to reflect the committed changes.
foad added a comment.Jun 9 2020, 6:12 AM

Sorry for the late review, but I think the code is getting really confusing now: processMemCpy returns a "repeat instruction" flag, but sometimes returns true, but also increments BI so that the instruction is not repeated at al???

How about changing all of processMemSet/Cpy/Move so that they return a simple "changed" flag, and set BI to the next instruction to be processed (i.e. either the current instruction if we want to repeat it, otherwise the next instruction).

Sorry for the late review, but I think the code is getting really confusing now: processMemCpy returns a "repeat instruction" flag, but sometimes returns true, but also increments BI so that the instruction is not repeated at al???

How about changing all of processMemSet/Cpy/Move so that they return a simple "changed" flag, and set BI to the next instruction to be processed (i.e. either the current instruction if we want to repeat it, otherwise the next instruction).

Well, I landed the patch... The extra iterator is also passed for other processMem* functions, in order to adjust current iterator, so I used it in processMemCpy. I agree it's non-ideal, but at least it's consistent ;-)

foad added a comment.Jun 10 2020, 1:32 AM

Well, I landed the patch...

Yeah but post-commit review is still a real thing! As for cleaning it up, how about D81540?