[llvm] dc619f3 - [CodeGen][TargetPassConfig] Add unreachable-mbb-elimination pass explicitly

Evgeny Leviant via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 08:05:27 PDT 2020


Author: Evgeny Leviant
Date: 2020-07-23T18:05:11+03:00
New Revision: dc619f3d7a975c30d4e31ff94a59fe8cbb6e2e8e

URL: https://github.com/llvm/llvm-project/commit/dc619f3d7a975c30d4e31ff94a59fe8cbb6e2e8e
DIFF: https://github.com/llvm/llvm-project/commit/dc619f3d7a975c30d4e31ff94a59fe8cbb6e2e8e.diff

LOG: [CodeGen][TargetPassConfig] Add unreachable-mbb-elimination pass explicitly

Differential revision: https://reviews.llvm.org/D84228

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetPassConfig.cpp
    llvm/test/CodeGen/AArch64/partial-pipeline-execution.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 856e1200f436..64511940249c 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1183,6 +1183,11 @@ void TargetPassConfig::addOptimizedRegAlloc() {
   // LiveVariables can be removed completely, and LiveIntervals can be directly
   // computed. (We still either need to regenerate kill flags after regalloc, or
   // preferably fix the scavenger to not depend on them).
+  // FIXME: UnreachableMachineBlockElim is a dependant pass of LiveVariables.
+  // When LiveVariables is removed this has to be removed/moved either.
+  // Explicit addition of UnreachableMachineBlockElim allows stopping before or
+  // after it with -stop-before/-stop-after.
+  addPass(&UnreachableMachineBlockElimID, false);
   addPass(&LiveVariablesID, false);
 
   // Edge splitting is smarter with machine loop info.

diff  --git a/llvm/test/CodeGen/AArch64/partial-pipeline-execution.ll b/llvm/test/CodeGen/AArch64/partial-pipeline-execution.ll
index 82cb0a35f2a5..067da9123fab 100644
--- a/llvm/test/CodeGen/AArch64/partial-pipeline-execution.ll
+++ b/llvm/test/CodeGen/AArch64/partial-pipeline-execution.ll
@@ -7,6 +7,11 @@
 ; optimize the loop 
diff erently
 ; RUN: cmp %t.s %t2.s
 
+; Check that we can do the same with unreachable-mbb-elimination pass
+; RUN: llc -O3 -stop-after=unreachable-mbb-elimination %s -o %t-mbb-elim.mir
+; RUN: llc -O3 -start-after=unreachable-mbb-elimination %t-mbb-elim.mir -o %t3.s
+; RUN: cmp %t.s %t3.s
+
 ; ModuleID = 'loop.c'
 source_filename = "loop.c"
 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"


        


More information about the llvm-commits mailing list