[PATCH] D48457: [LoopUnswitch]Fix comparison for DomTree updates.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 10:19:17 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL335369: [LoopUnswitch]Fix comparison for DomTree updates. (authored by asbirlea, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D48457

Files:
  llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp


Index: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -910,6 +910,7 @@
                                                   BranchInst *OldBranch,
                                                   TerminatorInst *TI) {
   assert(OldBranch->isUnconditional() && "Preheader is not split correctly");
+  assert(TrueDest != FalseDest && "Branch targets should be different");
   // Insert a conditional branch on LIC to the two preheaders.  The original
   // code is the true version and the new code is the false version.
   Value *BranchVal = LIC;
@@ -942,9 +943,9 @@
   if (DT) {
     // First, add both successors.
     SmallVector<DominatorTree::UpdateType, 3> Updates;
-    if (TrueDest != OldBranchParent)
+    if (TrueDest != OldBranchSucc)
       Updates.push_back({DominatorTree::Insert, OldBranchParent, TrueDest});
-    if (FalseDest != OldBranchParent)
+    if (FalseDest != OldBranchSucc)
       Updates.push_back({DominatorTree::Insert, OldBranchParent, FalseDest});
     // If both of the new successors are different from the old one, inform the
     // DT that the edge was deleted.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48457.152506.patch
Type: text/x-patch
Size: 1279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180622/129b6780/attachment.bin>


More information about the llvm-commits mailing list