aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-08-24[TableGen] Rename ResourceCycles and StartAtCycle to clarify semanticsMichael Maitland1-6/+6
D150312 added a TODO: TODO: consider renaming the field `StartAtCycle` and `Cycles` to `AcquireAtCycle` and `ReleaseAtCycle` respectively, to stress the fact that resource allocation is now represented as an interval, relatively to the issue cycle of the instruction. This patch implements that TODO. This naming clarifies how to use these fields in the scheduler. In addition it was confusing that `StartAtCycle` was singular but `Cycles` was plural. This renaming fixes this inconsistency. This commit as previously reverted since it missed renaming that came down after rebasing. This version of the commit fixes those problems. Differential Revision: https://reviews.llvm.org/D158568
2023-08-24Revert "[TableGen] Rename ResourceCycles and StartAtCycle to clarify semantics"Michael Maitland1-6/+6
This reverts commit 5b854f2c23ea1b000cb4cac4c0fea77326c03d43. Build still failing.
2023-08-24[TableGen] Rename ResourceCycles and StartAtCycle to clarify semanticsMichael Maitland1-6/+6
D150312 added a TODO: TODO: consider renaming the field `StartAtCycle` and `Cycles` to `AcquireAtCycle` and `ReleaseAtCycle` respectively, to stress the fact that resource allocation is now represented as an interval, relatively to the issue cycle of the instruction. This patch implements that TODO. This naming clarifies how to use these fields in the scheduler. In addition it was confusing that `StartAtCycle` was singular but `Cycles` was plural. This renaming fixes this inconsistency. This commit as previously reverted since it missed renaming that came down after rebasing. This version of the commit fixes those problems. Differential Revision: https://reviews.llvm.org/D158568
2023-08-24Revert "[TableGen] Rename ResourceCycles and StartAtCycle to clarify semantics"Michael Maitland1-6/+6
This reverts commit 030d33409568b2f0ea61116e83fd40ca27ba33ac. This commit is causing build failures
2023-08-24[TableGen] Rename ResourceCycles and StartAtCycle to clarify semanticsMichael Maitland1-6/+6
D150312 added a TODO: TODO: consider renaming the field `StartAtCycle` and `Cycles` to `AcquireAtCycle` and `ReleaseAtCycle` respectively, to stress the fact that resource allocation is now represented as an interval, relatively to the issue cycle of the instruction. This patch implements that TODO. This naming clarifies how to use these fields in the scheduler. In addition it was confusing that `StartAtCycle` was singular but `Cycles` was plural. This renaming fixes this inconsistency. Differential Revision: https://reviews.llvm.org/D158568
2023-06-16[MC] Add MCRegisterInfo::regunits for iteration over register unitsSergei Barannikov1-8/+6
Reviewed By: foad Differential Revision: https://reviews.llvm.org/D152098
2023-06-01[CodeGen] Make use of MachineInstr::all_defs and all_uses. NFCI.Jay Foad1-15/+12
Differential Revision: https://reviews.llvm.org/D151424
2023-04-08[CodeGen] Use range-based for loops (NFC)Kazu Hirata1-2/+1
2023-03-30[MachineScheduler] Rename postprocessDAG to postProcessDAG. NFCjacquesguan1-2/+2
Rename postprocessDAG to camel case. Reviewed By: foad Differential Revision: https://reviews.llvm.org/D146795
2023-02-07[CodeGen] Define and use MachineOperand::getOperandNoJay Foad1-8/+6
This is a helper function to very slightly simplify many calls to MachineInstruction::getOperandNo. Differential Revision: https://reviews.llvm.org/D143250
2023-01-22Use llvm::popcount instead of llvm::countPopulation(NFC)Kazu Hirata1-2/+2
2023-01-13[CodeGen] Remove uses of Register::isPhysicalRegister/isVirtualRegister. NFCCraig Topper1-3/+3
Use isPhysical/isVirtual methods. Reviewed By: foad Differential Revision: https://reviews.llvm.org/D141715
2022-11-07[SWP] Recognize mem carried dep with different baseThomas Preud'homme1-9/+17
The loop-carried dependency detection logic in isLoopCarriedDep relies on the load and store using the same definition for the base register. This misses the case of post-increment loads and stores whose base register are different PHI initialized from the same initial value. This commit extends the logic to accept the load and store having different PHI base address provided that they had the same initial value when entering the loop and are incremented by the same amount in each loop. Reviewed By: bcahoon Differential Revision: https://reviews.llvm.org/D136463
2022-09-16[MachinePipeliner] Fix the interpretation of the scheduling modelYuta Mukai1-140/+251
The method of counting resource consumption is modified to be based on "Cycles" value when DFA is not used. The calculation of ResMII is modified to total "Cycles" and divide it by the number of units for each resource. Previously, ResMII was excessive because it was assumed that resources were consumed for the cycles of "Latency" value. The method of resource reservation is modified similarly. When a value of "Cycles" is larger than 1, the resource is considered to be consumed by 1 for cycles of its length from the scheduled cycle. To realize this, ResourceManager maintains a resource table for all slots. Previously, resource consumption was always 1 for 1 cycle regardless of the value of "Cycles" or "Latency". In addition, the number of micro operations per cycle is modified to be constrained by "IssueWidth". To disable the constraint, --pipeliner-force-issue-width=100 can be used. For the case of using DFA, the scheduling results are unchanged. Reviewed By: dpenry Differential Revision: https://reviews.llvm.org/D133572
2022-08-30[ModuloScheduler] Fix missing LLVM_DEBUGDavid Penry1-1/+1
Guard a debug message with LLVM_DEBUG Differential Revision: https://reviews.llvm.org/D132895
2022-08-22[ModuloSchedule] Add interface call to accept/reject SMS schedulesDavid Penry1-0/+6
This interface allows a target to reject a proposed SMS schedule. For Hexagon/PowerPC, all schedules are accepted, leaving behavior unchanged. For ARM, schedules which exceed register pressure limits are rejected. Also, two RegisterPressureTracker methods now need to be public so that register pressure can be computed by more callers. Reapplication of D128941/(reversion:D132037) with small fix. Differential Revision: https://reviews.llvm.org/D132170
2022-08-17Revert "[ModuloSchedule] Add interface call to accept/reject SMS schedules"David Penry1-6/+0
This reverts commit 8c4aea438c310816bb4e4f9a32d783381ef3182e. Needed because buildbot failures (warnings) gave a clue that there was a functional bug in the ARM rejection logic. Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D132037
2022-08-17[ModuloSchedule] Add interface call to accept/reject SMS schedulesDavid Penry1-0/+6
This interface allows a target to reject a proposed SMS schedule. For Hexagon/PowerPC, all schedules are accepted, leaving behavior unchanged. For ARM, schedules which exceed register pressure limits are rejected. Also, two RegisterPressureTracker methods now need to be public so that register pressure can be computed by more callers. Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D128941
2022-07-18CodeGen: Remove AliasAnalysis from regallocMatt Arsenault1-3/+3
This was stored in LiveIntervals, but not actually used for anything related to LiveIntervals. It was only used in one check for if a load instruction is rematerializable. I also don't think this was entirely correct, since it was implicitly assuming constant loads are also dereferenceable. Remove this and rely only on the invariant+dereferenceable flags in the memory operand. Set the flag based on the AA query upfront. This should have the same net benefit, but has the possible disadvantage of making this AA query nonlazy. Preserve the behavior of assuming pointsToConstantMemory implying dereferenceable for now, but maybe this should be changed.
2022-07-17[CodeGen] Qualify auto variables in for loops (NFC)Kazu Hirata1-9/+9
2022-06-18[llvm] Call *set::insert without checking membership first (NFC)Kazu Hirata1-2/+1
2022-06-10[CodeGen] Use llvm::erase_value (NFC)Kazu Hirata1-1/+1
2022-06-07[NFC] Fix spelling/newlines in comments/debug messagesDavid Penry1-2/+2
Just a few spelling mistakes and missing newlines Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D127162
2022-06-05Remove unneeded cl::ZeroOrMore for cl::opt/cl::list optionsFangrui Song1-2/+2
2022-06-05Remove unneeded cl::ZeroOrMore for cl::opt/cl::list optionsFangrui Song1-1/+0
2022-06-04[CodeGen] Use a range-based for loop (NFC)Kazu Hirata1-2/+1
2022-06-04Remove unneeded cl::ZeroOrMore for cl::opt optionsFangrui Song1-4/+3
Similar to 557efc9a8b68628c2c944678c6471dac30ed9e8e. This commit handles options where cl::ZeroOrMore is more than one line below cl::opt.
2022-05-05[MachinePipeliner] Fix unscheduled instructionThomas Preud'homme1-1/+3
Prior to ordering instructions to be scheduled, the machine pipeliner update recurrence node sets in groupRemainingNodes() by adding in a given node set any node on the dependency path from a node set with higher priority to the given node set. The function computePath() that determine what constitutes a path follows artificial dependencies. However, when ordering the nodes in the resulting node sets, computeNodeOrder() calls ignoreDependence when looking at dependencies which ignores artificial dependencies. This can cause a node not to be scheduled which then causes wrong code generation and in the case of a debug build will lead to an assert failure in generatePhis() in ModuloScheduler.cpp. This commit adds calls to ignoreDependence() in computePath() to not add any node in groupRemainingNodes() that would not be ordered by computeNodeOrder(). Reviewed By: sgundapa Differential Revision: https://reviews.llvm.org/D124267
2022-04-29Reapply [CodeGen][ARM] Enable Swing Module Scheduling for ARMDavid Penry1-8/+89
Fixed "private field is not used" warning when compiled with clang. original commit: 28d09bbbc3d09c912b54a4d5edb32cab7de32a6f reverted in: fa49021c68ef7a7adcdf7b8a44b9006506523191 ------ This patch permits Swing Modulo Scheduling for ARM targets turns it on by default for the Cortex-M7. The t2Bcc instruction is recognized as a loop-ending branch. MachinePipeliner is extended by adding support for "unpipelineable" instructions. These instructions are those which contribute to the loop exit test; in the SMS papers they are removed before creating the dependence graph and then inserted into the final schedule of the kernel and prologues. Support for these instructions was not previously necessary because current targets supporting SMS have only supported it for hardware loop branches, which have no loop-exit-contributing instructions in the loop body. The current structure of the MachinePipeliner makes it difficult to remove/exclude these instructions from the dependence graph. Therefore, this patch leaves them in the graph, but adds a "normalization" method which moves them in the schedule to stage 0, which causes them to appear properly in kernel and prologues. It was also necessary to be more careful about boundary nodes when iterating across successors in the dependence graph because the loop exit branch is now a non-artificial successor to instructions in the graph. In additional, schedules with physical use/def pairs in the same cycle should be treated as creating an invalid schedule because the scheduling logic doesn't respect physical register dependence once scheduled to the same cycle. Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D122672
2022-04-28Revert "[CodeGen][ARM] Enable Swing Module Scheduling for ARM"David Penry1-89/+8
This reverts commit 28d09bbbc3d09c912b54a4d5edb32cab7de32a6f while I investigate a buildbot failure.
2022-04-28[CodeGen][ARM] Enable Swing Module Scheduling for ARMDavid Penry1-8/+89
This patch permits Swing Modulo Scheduling for ARM targets turns it on by default for the Cortex-M7. The t2Bcc instruction is recognized as a loop-ending branch. MachinePipeliner is extended by adding support for "unpipelineable" instructions. These instructions are those which contribute to the loop exit test; in the SMS papers they are removed before creating the dependence graph and then inserted into the final schedule of the kernel and prologues. Support for these instructions was not previously necessary because current targets supporting SMS have only supported it for hardware loop branches, which have no loop-exit-contributing instructions in the loop body. The current structure of the MachinePipeliner makes it difficult to remove/exclude these instructions from the dependence graph. Therefore, this patch leaves them in the graph, but adds a "normalization" method which moves them in the schedule to stage 0, which causes them to appear properly in kernel and prologues. It was also necessary to be more careful about boundary nodes when iterating across successors in the dependence graph because the loop exit branch is now a non-artificial successor to instructions in the graph. In additional, schedules with physical use/def pairs in the same cycle should be treated as creating an invalid schedule because the scheduling logic doesn't respect physical register dependence once scheduled to the same cycle. Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D122672
2022-04-04[Pipeliner] Fix comment typoThomas Preud'homme1-1/+1
2022-03-16Cleanup codegen includesserge-sans-paille1-2/+2
This is a (fixed) recommit of https://reviews.llvm.org/D121169 after: 1061034926 before: 1063332844 Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D121681
2022-03-10Revert "Cleanup codegen includes"Nico Weber1-2/+2
This reverts commit 7f230feeeac8a67b335f52bd2e900a05c6098f20. Breaks CodeGenCUDA/link-device-bitcode.cu in check-clang, and many LLVM tests, see comments on https://reviews.llvm.org/D121169
2022-03-10Cleanup codegen includesserge-sans-paille1-2/+2
after: 1061034926 before: 1063332844 Differential Revision: https://reviews.llvm.org/D121169
2022-03-09[MachinePipeliner] Fix isPseduo typo.Thomas Preud'homme1-2/+2
2021-12-12[llvm] Use llvm::reverse (NFC)Kazu Hirata1-4/+2
2021-12-08[NFC] Rename MachineFunction::deleteMachineInstr (coding style)Mircea Trofin1-2/+2
2021-12-06[CodeGen] Use range-based for loops (NFC)Kazu Hirata1-8/+6
2021-12-04[CodeGen] Use range-based for loops (NFC)Kazu Hirata1-30/+19
2021-11-29[llvm] Use range-based for loops (NFC)Kazu Hirata1-4/+3
2021-11-28[llvm] Use range-based for loops (NFC)Kazu Hirata1-8/+6
2021-11-28[llvm] Use range-based for loops (NFC)Kazu Hirata1-2/+1
2021-10-26[CodeGen, Hexagon] Use MachineBasicBlock::phis (NFC)Kazu Hirata1-1/+1
2021-08-13[NFC] Clean up users of AttributeList::hasAttribute()Arthur Eubanks1-2/+1
AttributeList::hasAttribute() is confusing, use clearer methods like hasParamAttr()/hasRetAttr(). Add hasRetAttr() since it was missing from AttributeList.
2021-04-09[NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset.dfukalov1-5/+4
Main reason is preparation to transform AliasResult to class that contains offset for PartialAlias case. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D98027
2021-02-28[llvm] Use set_is_subset (NFC)Kazu Hirata1-11/+4
2021-02-17[Pipeliner] Fixed optimization remarks and debug dumps InitiationMarianne Mailhot-Sarrasin1-4/+5
Interval value The II value was incremented before exiting the loop, and therefor when used in the optimization remarks and debug dumps it did not reflect the initiation interval actually used in Schedule. Differential Revision: https://reviews.llvm.org/D95692
2021-02-16[CodeGen] Use range-based for loops (NFC)Kazu Hirata1-64/+44
2021-01-14[llvm] Remove redundant return and continue statements (NFC)Kazu Hirata1-1/+0
Identified with readability-redundant-control-flow.