[llvm] 4c19b89 - [NFC][ARM] Comments and lambdas
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 00:43:31 PDT 2020
Author: Sam Parker
Date: 2020-09-29T08:41:53+01:00
New Revision: 4c19b89b2587f321e1014a9855973c08a822b908
URL: https://github.com/llvm/llvm-project/commit/4c19b89b2587f321e1014a9855973c08a822b908
DIFF: https://github.com/llvm/llvm-project/commit/4c19b89b2587f321e1014a9855973c08a822b908.diff
LOG: [NFC][ARM] Comments and lambdas
Add some comments in LowOverheadLoops and make some lambda variables
explicit arguments instead of capturing.
Added:
Modified:
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
index 945c7152157c..636359d801d9 100644
--- a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
+++ b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
@@ -921,14 +921,17 @@ void LowOverheadLoop::Validate(ARMBasicBlockUtils *BBUtils) {
if (Revert)
return;
- auto ValidateRanges = [this, &BBUtils]() {
+ // Check branch target ranges: WLS[TP] can only branch forwards and LE[TP]
+ // can only jump back.
+ auto ValidateRanges = [](MachineInstr *Start, MachineInstr *End,
+ ARMBasicBlockUtils *BBUtils, MachineLoop &ML) {
if (!End->getOperand(1).isMBB())
report_fatal_error("Expected LoopEnd to target basic block");
// TODO Maybe there's cases where the target doesn't have to be the header,
// but for now be safe and revert.
if (End->getOperand(1).getMBB() != ML.getHeader()) {
- LLVM_DEBUG(dbgs() << "ARM Loops: LoopEnd is not targetting header.\n");
+ LLVM_DEBUG(dbgs() << "ARM Loops: LoopEnd is not targeting header.\n");
return false;
}
@@ -950,7 +953,10 @@ void LowOverheadLoop::Validate(ARMBasicBlockUtils *BBUtils) {
return true;
};
- auto FindStartInsertionPoint = [this]() -> MachineInstr* {
+ // Find a suitable position to insert the loop start instruction. It needs to
+ // be able to safely define LR.
+ auto FindStartInsertionPoint = [](MachineInstr *Start,
+ ReachingDefAnalysis &RDA) -> MachineInstr* {
// We can define LR because LR already contains the same value.
if (Start->getOperand(0).getReg() == ARM::LR)
return Start;
@@ -983,8 +989,8 @@ void LowOverheadLoop::Validate(ARMBasicBlockUtils *BBUtils) {
return RDA.isSafeToDefRegAt(Start, ARM::LR) ? Start : nullptr;
};
- InsertPt = FindStartInsertionPoint();
- Revert = !ValidateRanges() || !InsertPt;
+ InsertPt = FindStartInsertionPoint(Start, RDA);
+ Revert = !ValidateRanges(Start, End, BBUtils, ML) || !InsertPt;
CannotTailPredicate = !ValidateTailPredicate(InsertPt);
LLVM_DEBUG(if (!InsertPt)
More information about the llvm-commits
mailing list