summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2015-12-22 17:05:00 -0500
committerNicolai Hähnle <nicolai.haehnle@amd.com>2015-12-22 17:05:00 -0500
commit3769335ed9d02ae1dfcf2027c39a0dbce5a5d696 (patch)
treeb9e44bf7b7faca6a375795462b510ffff6ff062f
parent9fec958f7075e22a58d9741435a7b2c3683390fc (diff)
EXPERIMENT only fold subreg operands when they aren't used often
-rw-r--r--lib/Target/AMDGPU/SIFoldOperands.cpp15
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