[llvm-bugs] [Bug 24505] New: [AArch64][PeepholeOptimizer] Look through PHIs to find additional register sources

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 19 11:37:38 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24505

            Bug ID: 24505
           Summary: [AArch64][PeepholeOptimizer] Look through PHIs to find
                    additional register sources
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: mcrosier at codeaurora.org
                CC: bmakam at codeaurora.org, bruno.cardoso at gmail.com,
                    gberry at codeaurora.org, junbuml at codeaurora.org,
                    llvm-bugs at lists.llvm.org, mssimpso at codeaurora.org
    Classification: Unclassified

Bruno recently committed a change to improve the peephole optimizer.  He was
specifically targeting x86, but this can be easily extended to other
architectures by marking target-specific instructions in the form "one source +
one destination bitcast" with "isBitcast."

The specific commit is r245442
http://llvm.org/viewvc/llvm-project?view=revision&revision=245442

[PeepholeOptimizer] Look through PHIs to find additional register sources

Reapply r243486.

- Teaches the ValueTracker in the PeepholeOptimizer to look through PHI
instructions.
- Add findNextSourceAndRewritePHI method to lookup into multiple sources
returnted by the ValueTracker and rewrite PHIs with new sources.

With these changes we can find more register sources and rewrite more
copies to allow coaslescing of bitcast instructions. Hence, we eliminate
unnecessary VR64 <-> GR64 copies in x86, but it could be extended to
other archs by marking "isBitcast" on target specific instructions. The
x86 example follows:

A:
  psllq %mm1, %mm0
  movd  %mm0, %r9
  jmp C

B:
  por %mm1, %mm0
  movd  %mm0, %r9
  jmp C

C:
  movd  %r9, %mm0
  pshufw  $238, %mm0, %mm0

Becomes:

A:
  psllq %mm1, %mm0
  jmp C

B:
  por %mm1, %mm0
  jmp C

C:
  pshufw  $238, %mm0, %mm0

Differential Revision: http://reviews.llvm.org/D11197
rdar://problem/20404526

Bruno did later revert the commit in r245446.  Regardless, once the final patch
lands we should consider investigating.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150819/00506390/attachment.html>


More information about the llvm-bugs mailing list