[PATCH] D31185: [MBP] Only run the BranchFolder after RA

Joey Gouly via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 05:36:37 PDT 2017


joey created this revision.

The Branch Folder can only run after RA. According to the comment at the top of the file:

  // Note that this pass must be run after register allocation, it cannot handle
  // SSA form.


Repository:
  rL LLVM

https://reviews.llvm.org/D31185

Files:
  CodeGen/MachineBlockPlacement.cpp


Index: CodeGen/MachineBlockPlacement.cpp
===================================================================
--- CodeGen/MachineBlockPlacement.cpp
+++ CodeGen/MachineBlockPlacement.cpp
@@ -41,6 +41,7 @@
 #include "llvm/CodeGen/MachineLoopInfo.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/MachinePostDominators.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/TailDuplicator.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/CommandLine.h"
@@ -2651,8 +2652,9 @@
   bool EnableTailMerge = !MF.getTarget().requiresStructuredCFG() &&
                          PassConfig->getEnableTailMerge() &&
                          BranchFoldPlacement;
+  bool isPreRegAlloc = MF.getRegInfo().isSSA();
   // No tail merging opportunities if the block number is less than four.
-  if (MF.size() > 3 && EnableTailMerge) {
+  if (MF.size() > 3 && EnableTailMerge && !isPreRegAlloc) {
     unsigned TailMergeSize = TailDupPlacementThreshold + 1;
     BranchFolder BF(/*EnableTailMerge=*/true, /*CommonHoist=*/false, *MBFI,
                     *MBPI, TailMergeSize);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31185.92468.patch
Type: text/x-patch
Size: 1115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170321/154922c0/attachment.bin>


More information about the llvm-commits mailing list