[llvm] b4130e6 - Correctly report Changed status in FoldBranchToCommonDest

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 09:13:56 PDT 2020


Author: serge-sans-paille
Date: 2020-06-29T18:13:42+02:00
New Revision: b4130e6e99640046b60452272264823bf0f8813f

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

LOG: Correctly report Changed status in FoldBranchToCommonDest

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

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 3d72556b2aed..d899ba7a2690 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -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;
           }
         }


        


More information about the llvm-commits mailing list