[PATCH] D148139: [BranchRelaxation] Correct JumpToFT value

Anshil Gandhi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 22:21:44 PDT 2023

This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6530bd3030d3: [BranchRelaxation] Correct JumpToFT value (authored by gandhi21299).

  rG LLVM Github Monorepo




Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
--- llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -975,8 +975,8 @@
   // 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
Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
--- llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -796,12 +796,12 @@
   /// 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148139.513063.patch
Type: text/x-patch
Size: 1849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/10bdb0ea/attachment.bin>

More information about the llvm-commits mailing list