[PATCH] D126560: [analyzer][NFC] SimpleSValBuilder simplification: Remove superfluous workaround code

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 11:55:51 PDT 2022


martong created this revision.
martong added reviewers: NoQ, steakhal.
Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun.
Herald added a reviewer: Szelethus.
Herald added a project: All.
martong requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Since D113753 <https://reviews.llvm.org/D113753>, we simplify the symbols right at the beginning of
evalBinOpNN. Since D114938 <https://reviews.llvm.org/D114938>, we do the simplification until a fix-point
is reached.
These changes renders the two workarounds introduced in D47155 <https://reviews.llvm.org/D47155> and in
D51252 <https://reviews.llvm.org/D51252> superfluous.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126560

Files:
  clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp


Index: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -1190,7 +1190,6 @@
 
 const llvm::APSInt *SimpleSValBuilder::getKnownValue(ProgramStateRef state,
                                                    SVal V) {
-  V = simplifySVal(state, V);
   if (V.isUnknownOrUndef())
     return nullptr;
 
@@ -1376,14 +1375,6 @@
     SVal VisitSVal(SVal V) { return V; }
   };
 
-  // A crude way of preventing this function from calling itself from evalBinOp.
-  static bool isReentering = false;
-  if (isReentering)
-    return V;
-
-  isReentering = true;
   SVal SimplifiedV = Simplifier(State).Visit(V);
-  isReentering = false;
-
   return SimplifiedV;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126560.432611.patch
Type: text/x-patch
Size: 842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220527/cd102d67/attachment-0001.bin>


More information about the cfe-commits mailing list