This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Track physical registers in SIWholeQuadMode
ClosedPublic

Authored by nhaehnle on Jul 22 2016, 5:40 AM.

Details

Summary

There are cases where uniform branch conditions are computed in VGPRs, and
we didn't correctly mark those as WQM.

The stray change in basic-branch.ll is because invoking the LiveIntervals
analysis leads to the detection of a dead register that would otherwise not
be seen at -O0.

This is a candidate for the 3.9 branch, as it fixes a possible hang.

Diff Detail

Repository
rL LLVM

Event Timeline

nhaehnle updated this revision to Diff 65059.Jul 22 2016, 5:40 AM
nhaehnle retitled this revision from to AMDGPU: Track physical registers in SIWholeQuadMode.
nhaehnle updated this object.
nhaehnle added a subscriber: llvm-commits.
arsenm added inline comments.Jul 26 2016, 4:43 PM
lib/Target/AMDGPU/SIWholeQuadMode.cpp
132 ↗(On Diff #65059)

Should this also preserve it? Recomputing it if not used is quite expensive. I've also seen crashes when not preserving it (although I'm not 100% sure if that counts as a bug somewhere else)

nhaehnle added inline comments.Jul 26 2016, 11:33 PM
lib/Target/AMDGPU/SIWholeQuadMode.cpp
132 ↗(On Diff #65059)

As-is, this runs in SSA before Phi elimination, and other passes don't preserve LiveIntervals anyway.

I did it this way because I wanted to have a fix that uses the same logic in the 3.9 release branch as well as after my series of changes that moves SIWholeQuadMode to after machine scheduling.

If you're worried about the recomputation, we have two options, both of them a bit riskier:
(1) pull the entire WQM series into the 3.9 release branch
(2) replace the use of LiveIntervals in this patch by a manual backwards scan through MachineInstrs (or are there some helper functions to do this for us? I'm not aware, since the passes that need this info usually rely on LiveIntervals or similar).

Honestly, I'd prefer to accept the recomputation and have a conservative fix for the 3.9 release branch. On trunk, the recomputation will soon be gone anyway.

arsenm accepted this revision.Aug 2 2016, 10:45 AM
arsenm edited edge metadata.

LGTM

This revision is now accepted and ready to land.Aug 2 2016, 10:45 AM
This revision was automatically updated to reflect the committed changes.