[clang] 17e9ea6 - [analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl

Gabor Marton via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 03:49:07 PDT 2022


Author: Gabor Marton
Date: 2022-06-07T12:48:48+02:00
New Revision: 17e9ea61389411f3142b1a34989d3a1a42a5f1fb

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

LOG: [analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl

Aligned with the measures we had in D124674, this condition seems to be
unlikely.

Nevertheless, I've made some new measurments with stats just for this,
and data confirms this is indeed unlikely.

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

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
index bfda9672909bf..9ef3455a110a8 100644
--- a/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
@@ -47,7 +47,7 @@ template <typename AssumeFunction>
 ConstraintManager::ProgramStatePair
 ConstraintManager::assumeDualImpl(ProgramStateRef &State,
                                   AssumeFunction &Assume) {
-  if (State->isPosteriorlyOverconstrained())
+  if (LLVM_UNLIKELY(State->isPosteriorlyOverconstrained()))
     return {State, State};
 
   // Assume functions might recurse (see `reAssume` or `tryRearrange`). During


        


More information about the cfe-commits mailing list