We still have to fix the PHI if there is at least one VGPR operand.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
| lib/Target/AMDGPU/SIFixSGPRCopies.cpp | ||
|---|---|---|
| 608 ↗ | (On Diff #104312) | I think you should move the below phiHasVGPROperands check first rather than adding a second one | 
| test/CodeGen/AMDGPU/vgpr-to-sgpr-phi.ll | ||
| 3 ↗ | (On Diff #104312) | GCN check prefix | 
| 7 ↗ | (On Diff #104312) | It may be better to reformulate as a kernel for now, which will require a non-argument source for the VGPR | 
| 7–9 ↗ | (On Diff #104312) | Run instnamer on test. Also can be merged | 
| 30 ↗ | (On Diff #104312) | Drop extra string attributes | 
| 34 ↗ | (On Diff #104312) | Drop all metadata | 
Update based on Matt's review.
For the test:
- need details on how to change to a kernel, especially what the argument should be.- I tried a few options, but it seems we could not reproduce the issue with the kernel version, possibly because code is optimized away.
 
- not clear what to merge!
| test/CodeGen/AMDGPU/vgpr-to-sgpr-phi.ll | ||
|---|---|---|
| 7 ↗ | (On Diff #104503) | The issue is not reproducible if I make it a kernel. | 
| 7–9 ↗ | (On Diff #104312) | Can you be more specific which test should I merge to? It is not clear to me which tests are for this pass (simply guess from the names). Which test is for the following piece of code? // We don't need to fix the PHI if the common dominator of the
// two incoming blocks terminates with a uniform branch.
if (MI.getNumExplicitOperands() == 5) {
  MachineBasicBlock *MBB0 = MI.getOperand(2).getMBB();
  MachineBasicBlock *MBB1 = MI.getOperand(4).getMBB();
  if (!predsHasDivergentTerminator(MBB0, TRI) &&
      !predsHasDivergentTerminator(MBB1, TRI)) {
    DEBUG(dbgs() << "Not fixing PHI for uniform branch: " << MI << '\n');
    break;
  }
} | 
Merge the test into uniform-cfg.ll.
I can not find an approach to change the test to a kernel and yet still be able to reproduce the issue.
So I think it is OK to use a function here.