diff options
| author | Valery Pykhtin <Valery.Pykhtin@amd.com> | 2019-02-08 11:59:48 +0000 |
|---|---|---|
| committer | Valery Pykhtin <Valery.Pykhtin@amd.com> | 2019-02-08 11:59:48 +0000 |
| commit | 7fe97f8c7ca1c6dc380d7499b008808590450efb (patch) | |
| tree | ba7440a5af933f6142e607993f082d0e71e65384 /llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | |
| parent | 08dc50f2fb824dbfb909e9a9babb0f5cdbfe69c2 (diff) | |
| download | bcm5719-llvm-7fe97f8c7ca1c6dc380d7499b008808590450efb.tar.gz bcm5719-llvm-7fe97f8c7ca1c6dc380d7499b008808590450efb.zip | |
[AMDGPU] Fix DPP combiner
Differential revision: https://reviews.llvm.org/D55444
dpp move with uses and old reg initializer should be in the same BB.
bound_ctrl:0 is only considered when bank_mask and row_mask are fully enabled (0xF). Otherwise the old register value is checked for identity.
Added add, subrev, and, or instructions to the old folding function.
Kill flag is cleared for the src0 (DPP register) as it may be copied into more than one user.
The pass is still disabled by default.
llvm-svn: 353513
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIInstrInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp index 06c080c8af8..c6cd7a1a4a6 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -5646,3 +5646,29 @@ MachineInstr *llvm::getVRegSubRegDef(const TargetInstrInfo::RegSubRegPair &P, } return nullptr; } + +bool llvm::isEXECMaskConstantBetweenDefAndUses(unsigned VReg, + MachineRegisterInfo &MRI) { + assert(MRI.isSSA() && "Must be run on SSA"); + auto *TRI = MRI.getTargetRegisterInfo(); + + auto *DefI = MRI.getVRegDef(VReg); + auto *BB = DefI->getParent(); + + DenseSet<MachineInstr*> Uses; + for (auto &Use : MRI.use_nodbg_operands(VReg)) { + auto *I = Use.getParent(); + if (I->getParent() != BB) + return false; + Uses.insert(I); + } + + auto E = BB->end(); + for (auto I = std::next(DefI->getIterator()); I != E; ++I) { + Uses.erase(&*I); + // don't check the last use + if (Uses.empty() || I->modifiesRegister(AMDGPU::EXEC, TRI)) + break; + } + return Uses.empty(); +} |

