This is an archive of the discontinued LLVM Phabricator instance.

[PeepholeOptimizer] Refactor optimizeUncoalescable logic. NFC
ClosedPublic

Authored by bruno on Jul 14 2015, 1:25 PM.

Details

Summary

The PeepholeOptimizer misses some rewrite opportunities since it can't look through PHI instructions.
This patch cleans the current logic a bit while preparing for another patch that can handle PHIs. Changes include:

  • Create a new CopyRewriter for Uncoalescable copy-like instructions.
  • Change the ValueTracker to return a ValueTrackerResult.

This makes optimizeUncoalescable looks more like optimizeCoalescable and use the CopyRewritter infrastructure.

Diff Detail

Repository
rL LLVM

Event Timeline

bruno updated this revision to Diff 29705.Jul 14 2015, 1:25 PM
bruno retitled this revision from to [PeepholeOptimizer] Refactor optimizeUncoalescable logic. NFC.
bruno updated this object.
bruno added reviewers: qcolombet, MatzeB.
bruno set the repository for this revision to rL LLVM.
bruno added a subscriber: llvm-commits.
qcolombet edited edge metadata.Jul 14 2015, 2:29 PM

Hi Bruno,

Nice refactoring!

LGTM with one nit.
Please commit with that updated.

Cheers,
-Quentin

lib/CodeGen/PeepholeOptimizer.cpp
339 ↗(On Diff #29705)

The comment here needs further update as SrcReg and SrcSubReg are not parameters anymore.

qcolombet accepted this revision.Jul 14 2015, 2:29 PM
qcolombet edited edge metadata.
This revision is now accepted and ready to land.Jul 14 2015, 2:29 PM
bruno added a comment.Jul 14 2015, 2:34 PM

Good catch, thanks Quentin!

This revision was automatically updated to reflect the committed changes.