diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2015-12-22 17:05:00 -0500 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2015-12-22 17:05:00 -0500 |
commit | 3769335ed9d02ae1dfcf2027c39a0dbce5a5d696 (patch) | |
tree | b9e44bf7b7faca6a375795462b510ffff6ff062f | |
parent | 9fec958f7075e22a58d9741435a7b2c3683390fc (diff) |
EXPERIMENT only fold subreg operands when they aren't used often
-rw-r--r-- | lib/Target/AMDGPU/SIFoldOperands.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Target/AMDGPU/SIFoldOperands.cpp b/lib/Target/AMDGPU/SIFoldOperands.cpp index ccbf7c80f2a..68eb3ccd36b 100644 --- a/lib/Target/AMDGPU/SIFoldOperands.cpp +++ b/lib/Target/AMDGPU/SIFoldOperands.cpp @@ -334,9 +334,18 @@ bool SIFoldOperands::runOnMachineFunction(MachineFunction &MF) { !MRI.hasOneUse(MI.getOperand(0).getReg())) continue; - if (OpToFold.isReg() && - !TargetRegisterInfo::isVirtualRegister(OpToFold.getReg())) - continue; + if (OpToFold.isReg()) { + if (!TargetRegisterInfo::isVirtualRegister(OpToFold.getReg())) + continue; + + if (OpToFold.getSubReg()) { + unsigned Uses = 0; + for (auto UI = MRI.use_begin(MI.getOperand(0).getReg()); UI != MRI.use_end() && Uses <= 2; ++UI) + ++Uses; + if (Uses > 2) + continue; + } + } // We need mutate the operands of new mov instructions to add implicit // uses of EXEC, but adding them invalidates the use_iterator, so defer |