This is an archive of the discontinued LLVM Phabricator instance.

Improve collectEphemeralValues and use it in CodeGenPrepare
Needs ReviewPublic

Authored by skatkov on Jul 6 2023, 2:16 AM.

Details

Summary

Improve collectEphemeralValues to find ephemeral induction variable
and be based on wouldInstructionBeTriviallyDead utility function.

Also use this function in CodeGenPrepare to collect and erase the same
set of ephemeral values.

Diff Detail

Event Timeline

skatkov created this revision.Jul 6 2023, 2:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2023, 2:16 AM
skatkov requested review of this revision.Jul 6 2023, 2:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2023, 2:16 AM
Herald added a subscriber: wdng. · View Herald Transcript
skatkov added inline comments.Jul 6 2023, 5:35 AM
llvm/lib/CodeGen/CodeGenPrepare.cpp
729

will be removed after https://reviews.llvm.org/D154601 landed.

skatkov updated this revision to Diff 537979.Jul 6 2023, 9:31 PM

ping, any feedback?

ping.

I wonder whether it will easier to review if I split this patch into three one:

  1. Use wouldInstructionBeTriviallyDead instead of checking side-effect and terminator only to extend the scope of collecting ephemeral values
  2. Use CodeMetrics utility in CodeGenPrepare
  3. Extend the algorithm for collecting ephemeral values by checking cycles (induction variable case)

I'd like to make a progress on this, so I need feedback.

I wonder whether it will easier to review if I split this patch into three one:

  1. Use wouldInstructionBeTriviallyDead instead of checking side-effect and terminator only to extend the scope of collecting ephemeral values
  2. Use CodeMetrics utility in CodeGenPrepare
  3. Extend the algorithm for collecting ephemeral values by checking cycles (induction variable case)

Each of these steps is a reasonable improvement to what we have today. Given these improvements are independent (e.g. we would benefit from the more accurate collection of ephemeral values even without the CGP piece), I think it makes sense to split up and review them separately.