[llvm] r252643 - less indent; NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 10 12:09:02 PST 2015
Author: spatel
Date: Tue Nov 10 14:09:02 2015
New Revision: 252643
URL: http://llvm.org/viewvc/llvm-project?rev=252643&view=rev
Log:
less indent; NFCI
Modified:
llvm/trunk/lib/CodeGen/MachineCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/MachineCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCombiner.cpp?rev=252643&r1=252642&r2=252643&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineCombiner.cpp Tue Nov 10 14:09:02 2015
@@ -386,54 +386,55 @@ bool MachineCombiner::combineInstruction
// mostly one pattern, and getMachineCombinerPatterns() can order patterns
// based on an internal cost heuristic.
- if (TII->getMachineCombinerPatterns(MI, Patterns)) {
- for (auto P : Patterns) {
- SmallVector<MachineInstr *, 16> InsInstrs;
- SmallVector<MachineInstr *, 16> DelInstrs;
- DenseMap<unsigned, unsigned> InstrIdxForVirtReg;
- if (!MinInstr)
- MinInstr = Traces->getEnsemble(MachineTraceMetrics::TS_MinInstrCount);
- MachineTraceMetrics::Trace BlockTrace = MinInstr->getTrace(MBB);
+ if (!TII->getMachineCombinerPatterns(MI, Patterns))
+ continue;
+
+ for (auto P : Patterns) {
+ SmallVector<MachineInstr *, 16> InsInstrs;
+ SmallVector<MachineInstr *, 16> DelInstrs;
+ DenseMap<unsigned, unsigned> InstrIdxForVirtReg;
+ if (!MinInstr)
+ MinInstr = Traces->getEnsemble(MachineTraceMetrics::TS_MinInstrCount);
+ MachineTraceMetrics::Trace BlockTrace = MinInstr->getTrace(MBB);
+ Traces->verifyAnalysis();
+ TII->genAlternativeCodeSequence(MI, P, InsInstrs, DelInstrs,
+ InstrIdxForVirtReg);
+ unsigned NewInstCount = InsInstrs.size();
+ unsigned OldInstCount = DelInstrs.size();
+ // Found pattern, but did not generate alternative sequence.
+ // This can happen e.g. when an immediate could not be materialized
+ // in a single instruction.
+ if (!NewInstCount)
+ continue;
+
+ // Substitute when we optimize for codesize and the new sequence has
+ // fewer instructions OR
+ // the new sequence neither lengthens the critical path nor increases
+ // resource pressure.
+ if (doSubstitute(NewInstCount, OldInstCount) ||
+ (improvesCriticalPathLen(MBB, &MI, BlockTrace, InsInstrs,
+ InstrIdxForVirtReg, P) &&
+ preservesResourceLen(MBB, BlockTrace, InsInstrs, DelInstrs))) {
+ for (auto *InstrPtr : InsInstrs)
+ MBB->insert((MachineBasicBlock::iterator) &MI, InstrPtr);
+ for (auto *InstrPtr : DelInstrs)
+ InstrPtr->eraseFromParentAndMarkDBGValuesForRemoval();
+
+ Changed = true;
+ ++NumInstCombined;
+
+ Traces->invalidate(MBB);
Traces->verifyAnalysis();
- TII->genAlternativeCodeSequence(MI, P, InsInstrs, DelInstrs,
- InstrIdxForVirtReg);
- unsigned NewInstCount = InsInstrs.size();
- unsigned OldInstCount = DelInstrs.size();
- // Found pattern, but did not generate alternative sequence.
- // This can happen e.g. when an immediate could not be materialized
- // in a single instruction.
- if (!NewInstCount)
- continue;
-
- // Substitute when we optimize for codesize and the new sequence has
- // fewer instructions OR
- // the new sequence neither lengthens the critical path nor increases
- // resource pressure.
- if (doSubstitute(NewInstCount, OldInstCount) ||
- (improvesCriticalPathLen(MBB, &MI, BlockTrace, InsInstrs,
- InstrIdxForVirtReg, P) &&
- preservesResourceLen(MBB, BlockTrace, InsInstrs, DelInstrs))) {
- for (auto *InstrPtr : InsInstrs)
- MBB->insert((MachineBasicBlock::iterator) &MI, InstrPtr);
- for (auto *InstrPtr : DelInstrs)
- InstrPtr->eraseFromParentAndMarkDBGValuesForRemoval();
-
- Changed = true;
- ++NumInstCombined;
-
- Traces->invalidate(MBB);
- Traces->verifyAnalysis();
- // Eagerly stop after the first pattern fires.
- break;
- } else {
- // Cleanup instructions of the alternative code sequence. There is no
- // use for them.
- MachineFunction *MF = MBB->getParent();
- for (auto *InstrPtr : InsInstrs)
- MF->DeleteMachineInstr(InstrPtr);
- }
- InstrIdxForVirtReg.clear();
+ // Eagerly stop after the first pattern fires.
+ break;
+ } else {
+ // Cleanup instructions of the alternative code sequence. There is no
+ // use for them.
+ MachineFunction *MF = MBB->getParent();
+ for (auto *InstrPtr : InsInstrs)
+ MF->DeleteMachineInstr(InstrPtr);
}
+ InstrIdxForVirtReg.clear();
}
}
More information about the llvm-commits
mailing list