diff options
author | Thomas Raoux <thomasraoux@google.com> | 2020-05-07 08:30:00 -0700 |
---|---|---|
committer | Thomas Raoux <thomasraoux@google.com> | 2020-05-07 10:04:05 -0700 |
commit | dc26dec331b85751324e4e19ae318d03229b1d1f (patch) | |
tree | 51de04225004acf16d7f2037887c9df703570bbf /llvm/lib/CodeGen/ModuloSchedule.cpp | |
parent | 8615ce246d1c3424cd5958592ba2779aa7d37535 (diff) | |
download | llvm-dc26dec331b85751324e4e19ae318d03229b1d1f.zip llvm-dc26dec331b85751324e4e19ae318d03229b1d1f.tar.gz llvm-dc26dec331b85751324e4e19ae318d03229b1d1f.tar.bz2 |
[ModuloSchedule] Fix epilogue peeling with illegal phi.
When peeling out the epilogue we need to ignore illegal phis coming from stages
greater than the producer stage. Otherwise we end up with circular phi
dependencies.
Differential Revision: https://reviews.llvm.org/D79581
Diffstat (limited to 'llvm/lib/CodeGen/ModuloSchedule.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ModuloSchedule.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index 3fa2285..65dc11e 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -1440,11 +1440,15 @@ Register KernelRewriter::remapUse(Register Reg, MachineInstr &MI) { // immediately prior to pruning. auto RC = MRI.getRegClass(Reg); Register R = MRI.createVirtualRegister(RC); - BuildMI(*BB, MI, DebugLoc(), TII->get(TargetOpcode::PHI), R) - .addReg(IllegalPhiDefault.getValue()) - .addMBB(PreheaderBB) // Block choice is arbitrary and has no effect. - .addReg(LoopReg) - .addMBB(BB); // Block choice is arbitrary and has no effect. + MachineInstr *IllegalPhi = + BuildMI(*BB, MI, DebugLoc(), TII->get(TargetOpcode::PHI), R) + .addReg(IllegalPhiDefault.getValue()) + .addMBB(PreheaderBB) // Block choice is arbitrary and has no effect. + .addReg(LoopReg) + .addMBB(BB); // Block choice is arbitrary and has no effect. + // Illegal phi should belong to the producer stage so that it can be + // filtered correctly during peeling. + S.setStage(IllegalPhi, LoopProducerStage); return R; } |