[llvm] 6530bd3 - [BranchRelaxation] Correct JumpToFT value
Anshil Gandhi via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 12 22:21:39 PDT 2023
Author: Anshil Gandhi
Date: 2023-04-12T23:21:20-06:00
New Revision: 6530bd3030d3708fb5eeaecda352448912e6d647
URL: https://github.com/llvm/llvm-project/commit/6530bd3030d3708fb5eeaecda352448912e6d647
DIFF: https://github.com/llvm/llvm-project/commit/6530bd3030d3708fb5eeaecda352448912e6d647.diff
LOG: [BranchRelaxation] Correct JumpToFT value
Toggle true/false values of the JumpToFallThrough
parameter to simplify code and make it consistent
with the documentation for the `getFallThrough(..)`
method.
Reviewed By: bcahoon
Differential Revision: https://reviews.llvm.org/D148139
Added:
Modified:
llvm/include/llvm/CodeGen/MachineBasicBlock.h
llvm/lib/CodeGen/MachineBasicBlock.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index 127793c4bcc5..44ab3ba4784d 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -796,12 +796,12 @@ class MachineBasicBlock
/// it. If an explicit branch to the fallthrough block is not allowed,
/// set JumpToFallThrough to be false. Non-null return is a conservative
/// answer.
- MachineBasicBlock *getFallThrough(bool JumpToFallThrough = false);
+ MachineBasicBlock *getFallThrough(bool JumpToFallThrough = true);
/// Return the fallthrough block if the block can implicitly
/// transfer control to it's successor, whether by a branch or
/// a fallthrough. Non-null return is a conservative answer.
- MachineBasicBlock *getLogicalFallThrough() { return getFallThrough(true); }
+ MachineBasicBlock *getLogicalFallThrough() { return getFallThrough(false); }
/// Return true if the block can implicitly transfer control to the
/// block after it by falling off the end of it. This should return
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 5ef377f2a1c0..47a475a668af 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -975,8 +975,8 @@ MachineBasicBlock *MachineBasicBlock::getFallThrough(bool JumpToFallThrough) {
// If there is some explicit branch to the fallthrough block, it can obviously
// reach, even though the branch should get folded to fall through implicitly.
- if (!JumpToFallThrough && (MachineFunction::iterator(TBB) == Fallthrough ||
- MachineFunction::iterator(FBB) == Fallthrough))
+ if (JumpToFallThrough && (MachineFunction::iterator(TBB) == Fallthrough ||
+ MachineFunction::iterator(FBB) == Fallthrough))
return &*Fallthrough;
// If it's an unconditional branch to some block not the fall through, it
More information about the llvm-commits
mailing list