[llvm] 85628ce - [SimplifyCFG] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 15:11:28 PST 2022


Author: Fangrui Song
Date: 2022-02-02T15:11:22-08:00
New Revision: 85628ce75b3084dc0f185a320152baf85b59aba7

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

LOG: [SimplifyCFG] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 8e1fdad8ac5b..46dffa6c16f9 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2772,7 +2772,6 @@ static bool SpeculativelyExecuteThenElseCode(BranchInst *BI,
   assert(BI->isConditional() && !isa<ConstantInt>(BI->getCondition()) &&
          BI->getSuccessor(0) != BI->getSuccessor(1) &&
          "Only for truly conditional branches.");
-  BasicBlock *BB = BI->getParent();
 
   // Which ones of our successors end up with an unconditional branch?
   SmallVector<BasicBlock *, 2> UncondSuccessors;
@@ -2828,7 +2827,7 @@ static bool SpeculativelyExecuteThenElseCode(BranchInst *BI,
                 }) &&
          "All unconditional successors must be predecessors of merge block.");
   assert((UncondSuccessors.size() != 1 ||
-          is_contained(predecessors(MergeBB), BB)) &&
+          is_contained(predecessors(MergeBB), BI->getParent())) &&
          "If there is only a single unconditional successor, then the dispatch "
          "block must also be merge block's predecessor.");
 


        


More information about the llvm-commits mailing list