[llvm] 85a5865 - [BasicBlockUtils] Fixup of an assumed typo in MergeBlockIntoPredecessor

Bjorn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 04:04:07 PDT 2021


Author: Bjorn Pettersson
Date: 2021-09-23T13:03:26+02:00
New Revision: 85a586501bcc5b556d34a566b9d256d56d6fc5ba

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

LOG: [BasicBlockUtils] Fixup of an assumed typo in MergeBlockIntoPredecessor

The NFC commit e5692a564a73ef63b7b changed the logic for
DomTreeUpdates to use the range [succ_begin, succ_begin) when
looking for SuccsOfPredBB rather than using [succ_begin, succ_end).

As the commit was NFC this is identified as a typo (it has been
discussed briefly in phabricator).

The typo was found when inspecting the code, so I've got no idea if
changing back to the old range has any significant impact (such as
solving any PR:s or causing some new problems). But at least this
restores the code to the originally indented behavior.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index ee933b638a230..1a07697009eaa 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -230,7 +230,7 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU,
   if (DTU) {
     SmallPtrSet<BasicBlock *, 2> SuccsOfBB(succ_begin(BB), succ_end(BB));
     SmallPtrSet<BasicBlock *, 2> SuccsOfPredBB(succ_begin(PredBB),
-                                               succ_begin(PredBB));
+                                               succ_end(PredBB));
     Updates.reserve(Updates.size() + 2 * SuccsOfBB.size() + 1);
     // Add insert edges first. Experimentally, for the particular case of two
     // blocks that can be merged, with a single successor and single predecessor


        


More information about the llvm-commits mailing list