This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Avoid moving PHIs to VALU when phi values are defined in scalar branches
ClosedPublic

Authored by tstellarAMD on Aug 11 2016, 12:45 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

tstellarAMD retitled this revision from to AMDGPU/SI: Avoid moving PHIs to VALU when phi values are defined in scalar branches.
tstellarAMD updated this object.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
arsenm added inline comments.Aug 11 2016, 1:19 PM
lib/Target/AMDGPU/SIFixSGPRCopies.cpp
101 ↗(On Diff #67729)

Should also preserve it (it might be redundant with preserves CFG but I'm not sure if you actually use it)

248 ↗(On Diff #67729)

Reference

249–266 ↗(On Diff #67729)

This is also missing s_cbranch_exec[n]z, s_endpgm, si_return.

This function seems generally wrong to me. What exactly are you looking for by uniform terminator? The way I've been thinking about it, any branch terminator is uniform.

This only looks at a single terminator, so it won't correctly handle something like:

s_cbranch_scc0 BB1
s_branch BB2

I think what you really want is to look for is si_mask_branch (or at this early point one of the pseudo terminators that modify exec, none of which should be branches).

But you can also have something like:
si_mask_branch BB1
s_cbranch_vccz BB1
s_branch BB2

Coming directly out of isel I think this is the most likely scenario since BranchFolding is supposed to cleanup unneeded unconditional branches. I think what you probably want to be looking for is really a terminator that modifiers exec.

307 ↗(On Diff #67729)

s/denominator/dominator

tstellarAMD marked 3 inline comments as done.

Address review comments.

arsenm accepted this revision.Nov 28 2016, 8:07 AM
arsenm edited edge metadata.

LGTM

This revision is now accepted and ready to land.Nov 28 2016, 8:07 AM
This revision was automatically updated to reflect the committed changes.