diff options
| author | Nicolai Haehnle <nhaehnle@gmail.com> | 2019-04-23 13:12:52 +0000 |
|---|---|---|
| committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2019-04-23 13:12:52 +0000 |
| commit | 7edae4c403871a8e97878b8424f5a8f62905357b (patch) | |
| tree | c5d678595b8c0d37fad553e7eb622fec93e5cf14 /llvm/lib | |
| parent | 652168a99b5cdc1fb420b1224c8c2d42ad2b7465 (diff) | |
| download | bcm5719-llvm-7edae4c403871a8e97878b8424f5a8f62905357b.tar.gz bcm5719-llvm-7edae4c403871a8e97878b8424f5a8f62905357b.zip | |
AMDGPU: Fix LCSSA phi lowering in SILowerI1Copies
Summary:
When an LCSSA phi survives through instruction selection, the pass
ends up removing that phi entirely because it is dominated by the
logic that does the lanemask merging.
This then used to trigger an assertion when processing a dependent
phi instruction.
Change-Id: Id4949719f8298062fe476a25718acccc109113b6
Reviewers: llvm-commits
Subscribers: kzhuravl, jvesely, wdng, yaxunl, t-tye, tpr, dstuttard, rtaylor, arsenm
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60999
llvm-svn: 358983
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp index 823c9040c87..15ccef8ac83 100644 --- a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp +++ b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp @@ -504,6 +504,9 @@ void SILowerI1Copies::lowerPhis() { SmallVector<MachineBasicBlock *, 4> IncomingBlocks; SmallVector<unsigned, 4> IncomingRegs; SmallVector<unsigned, 4> IncomingUpdated; +#ifndef NDEBUG + DenseSet<unsigned> PhiRegisters; +#endif for (MachineBasicBlock &MBB : *MF) { LF.initialize(MBB); @@ -531,13 +534,17 @@ void SILowerI1Copies::lowerPhis() { } else if (IncomingDef->getOpcode() == AMDGPU::IMPLICIT_DEF) { continue; } else { - assert(IncomingDef->isPHI()); + assert(IncomingDef->isPHI() || PhiRegisters.count(IncomingReg)); } IncomingBlocks.push_back(IncomingMBB); IncomingRegs.push_back(IncomingReg); } +#ifndef NDEBUG + PhiRegisters.insert(DstReg); +#endif + // Phis in a loop that are observed outside the loop receive a simple but // conservatively correct treatment. MachineBasicBlock *PostDomBound = &MBB; |

