summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorChangpeng Fang <changpeng.fang@gmail.com>2017-08-03 16:37:02 +0000
committerChangpeng Fang <changpeng.fang@gmail.com>2017-08-03 16:37:02 +0000
commitef4dbb46daf007bd1357ef3bc1ae95a40956a360 (patch)
tree5e4f57f193b470d15f74eac06bdb899f6c78d5da /llvm/lib/Target
parent6c2ded879d0f8e33743213696330b086969106eb (diff)
downloadbcm5719-llvm-ef4dbb46daf007bd1357ef3bc1ae95a40956a360.tar.gz
bcm5719-llvm-ef4dbb46daf007bd1357ef3bc1ae95a40956a360.zip
AMDGPU/SI: Don't fix a PHI under uniform branch in SIFixSGPRCopies only when sources and destination are all sgprs
Summary: If a PHI has at lease one VGPR operand, we have to fix the PHI in SIFixSGPRCopies. Reviewer: Matt Differential Revision: http://reviews.llvm.org/D34727 llvm-svn: 309959
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp b/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
index 0a795c99f94..32e83cb385f 100644
--- a/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
@@ -604,7 +604,8 @@ bool SIFixSGPRCopies::runOnMachineFunction(MachineFunction &MF) {
// 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) {
+ bool HasVGPROperand = phiHasVGPROperands(MI, MRI, TRI, TII);
+ if (MI.getNumExplicitOperands() == 5 && !HasVGPROperand) {
MachineBasicBlock *MBB0 = MI.getOperand(2).getMBB();
MachineBasicBlock *MBB1 = MI.getOperand(4).getMBB();
@@ -649,8 +650,7 @@ bool SIFixSGPRCopies::runOnMachineFunction(MachineFunction &MF) {
// is no chance for values to be over-written.
SmallSet<unsigned, 8> Visited;
- if (phiHasVGPROperands(MI, MRI, TRI, TII) ||
- !phiHasBreakDef(MI, MRI, Visited)) {
+ if (HasVGPROperand || !phiHasBreakDef(MI, MRI, Visited)) {
DEBUG(dbgs() << "Fixing PHI: " << MI);
TII->moveToVALU(MI);
}
OpenPOWER on IntegriCloud