Correctly report Changed status in FoldBranchToCommonDest
authorserge-sans-paille <sguelton@redhat.com>
Mon, 29 Jun 2020 10:07:26 +0000 (12:07 +0200)
committerserge-sans-paille <sguelton@redhat.com>
Mon, 29 Jun 2020 16:13:42 +0000 (18:13 +0200)
It's possible for the first loop trip(s) to set the `Changed` Status, and to a
later one to early exit, in which case `Changed` must be return.

Differential Revision: https://reviews.llvm.org/D82753

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

index 3d72556..d899ba7 100644 (file)
@@ -2645,7 +2645,7 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, MemorySSAUpdater *MSSAU,
             }
             // Quit if we can't remove this instruction.
             if (!tryCSEWithPredecessor(Curr, PB))
-              return false;
+              return Changed;
             Changed = true;
           }
         }