aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/LiveVariables.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-10-13[analyzer] Remove superquadratic behaviour from DataflowWorklistAlexander Shaposhnikov1-18/+9
The class DataflowWorklist internally maintains a sorted list of pointers to CFGBlock and the method enqueuePredecessors has to call sortWorklist to maintain the invariant. The implementation based on vector + sort works well for small sizes but gets infeasible for relatively large sizes. In particular the issue takes place for some cryptographic libraries which use code generation. The diff replaces vector + sort with priority queue. For one of the implementations of AES this patch reduces the time for analysis from 204 seconds to 8 seconds. Test plan: make -j8 check-clang Differential revision: https://reviews.llvm.org/D25503 llvm-svn: 284166
2015-07-03Rewrite users of Stmt::child_begin/end into for-range loops.Benjamin Kramer1-5/+4
No functionality change intended. llvm-svn: 241355
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-4/+4
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-4/+4
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-02-06Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer1-5/+2
Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
2014-10-21Remove unused member variable.Craig Topper1-1/+0
llvm-svn: 220264
2014-09-23Reverting r214064 and r215650 while investigating a pesky performance regressionArtyom Skrobov1-8/+67
llvm-svn: 218296
2014-08-14Use the proper post-order traversal in LiveVariables analysis,Artyom Skrobov1-12/+7
to recover the performance after r214064. Also sorts out the naming for PostOrderCFGView, ReversePostOrderCFGView, BackwardDataflowWorklist and ForwardDataflowWorklist, to match the accepted terminology. Also unifies BackwardDataflowWorklist and ForwardDataflowWorklist to share the "worklist for prioritization, post-order traversal for fallback" logic, and to avoid repetitive sorting. Also cleans up comments in the affected area. llvm-svn: 215650
2014-07-28Factoring DataflowWorklist out of LiveVariables and UninitializedValues analysesArtyom Skrobov1-55/+1
llvm-svn: 214064
2014-05-20[C++11] Use 'nullptr'. Analysis edition.Craig Topper1-12/+12
llvm-svn: 209191
2014-03-23remove a bunch of unused private methodsNuno Lopes1-14/+0
found with a smarter version of -Wunused-member-function that I'm playwing with. Appologies in advance if I removed someone's WIP code. ARCMigrate/TransProperties.cpp | 8 ----- AST/MicrosoftMangle.cpp | 1 Analysis/AnalysisDeclContext.cpp | 5 --- Analysis/LiveVariables.cpp | 14 ---------- Index/USRGeneration.cpp | 10 ------- Sema/Sema.cpp | 33 +++++++++++++++++++++--- Sema/SemaChecking.cpp | 3 -- Sema/SemaDecl.cpp | 20 ++------------ StaticAnalyzer/Checkers/GenericTaintChecker.cpp | 1 9 files changed, 34 insertions(+), 61 deletions(-) llvm-svn: 204561
2014-03-14[C++11] Replacing DeclStmt iterators decl_begin() and decl_end() with ↵Aaron Ballman1-3/+2
iterator_range decls(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203947
2014-03-07[C++11] Convert sort predicates into lambdas.Benjamin Kramer1-14/+8
No functionality change. llvm-svn: 203289
2014-03-02[C++11] Replace llvm::tie with std::tie.Benjamin Kramer1-1/+1
llvm-svn: 202639
2013-12-06Revert "[analyzer] Refactor conditional expression evaluating code"Anna Zaks1-18/+0
This reverts commit r189090. The original patch introduced regressions (see the added live-variables.* tests). The patch depends on the correctness of live variable analyses, which are not computed correctly. I've opened PR18159 to track the proper resolution to this problem. The patch was a stepping block to r189746. This is why part of the patch reverts temporary destructor tests that started crashing. The temporary destructors feature is disabled by default. llvm-svn: 196593
2013-08-23Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm1-2/+1
No functionality change intended. llvm-svn: 189112
2013-08-23[analyzer] Refactor conditional expression evaluating codePavel Labath1-0/+18
Summary: Instead of digging through the ExplodedGraph, to figure out which edge brought us here, I compute the value of conditional expression by looking at the sub-expression values. To do this, I needed to change the liveness algorithm a bit -- now, the full conditional expression also depends on all atomic sub-expressions, not only the outermost ones. Reviewers: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1340 llvm-svn: 189090
2013-02-23Remove the CFGElement "Invalid" state.David Blaikie1-4/+6
Use Optional<CFG*> where invalid states were needed previously. In the one case where that's not possible (beginAutomaticObjDtorsInsert) just use a dummy CFGAutomaticObjDtor. Thanks for the help from Jordan Rose & discussion/feedback from Ted Kremenek and Doug Gregor. Post commit code review feedback on r175796 by Ted Kremenek. llvm-svn: 175938
2013-02-21Replace CFGElement llvm::cast support to be well-defined.David Blaikie1-6/+6
See r175462 for another example/more details. llvm-svn: 175796
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-3/+3
uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
2012-12-01Include pruning and general cleanup.Benjamin Kramer1-6/+16
llvm-svn: 169095
2012-08-14[analyzer] Teach live variable analyzes that super uses self pointer.Anna Zaks1-0/+8
llvm-svn: 161822
2012-07-26[analyzer] Variables with destructors are live until the destructor is run.Jordan Rose1-0/+6
Test case in the next commit, which enables destructors under certain circumstances. llvm-svn: 160805
2012-07-02Bail out the LiveVariables analysis when the CFG is very large, asTed Kremenek1-0/+5
we are encountering some scalability issues with memory usage. The appropriate long term fix is to make the analysis more scalable, but this will at least prevent the analyzer swapping when analyzing very large functions. llvm-svn: 159578
2011-12-22Enhance AnalysisDeclContext::getReferencedBlockVars() to understand ↵Ted Kremenek1-4/+5
PseudoObjExprs. It turns out that the information collected by this method is a super set of the captured variables in BlockDecl. llvm-svn: 147122
2011-12-22Fix regression in LiveVariables when reasoning about variables captured by ↵Ted Kremenek1-5/+4
blocks. llvm-svn: 147116
2011-12-20Unweaken vtables as per ↵David Blaikie1-0/+2
http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
2011-11-09We don't add ExprWithCleanups to the CFG, and getSVal looksJohn McCall1-0/+4
through it, so we should look through it for the live-values analysis as well. llvm-svn: 144190
2011-11-06Change the AST representation of operations on Objective-CJohn McCall1-0/+12
property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
2011-11-05Tweak LookThroughStmt() in LiveVariables to properly look through ↵Ted Kremenek1-4/+9
alternativing ParenExprs and OpaqueValueExprs. Thanks to Anna and Argiris for iterating on this function. My original patch embarssingly didn't even pass the Clang tests. llvm-svn: 143797
2011-11-05LookThroughStmt GM release.Argyrios Kyrtzidis1-2/+2
llvm-svn: 143796
2011-11-05LookThroughStmt v4.6.3Argyrios Kyrtzidis1-1/+1
llvm-svn: 143795
2011-11-05Simplify LookThroughStmt in LiveVariables.cppArgyrios Kyrtzidis1-12/+4
llvm-svn: 143794
2011-11-05Another correction to the LiveVariables commit (r143767, r143780).Anna Zaks1-3/+7
Make test/Analysis/misc-ps.c test pass. llvm-svn: 143790
2011-11-05Fix infinite loop in LiveVariables due to a misplaced 'break' (it would ↵Argyrios Kyrtzidis1-12/+6
break out of switch statement, not the while loop). llvm-svn: 143780
2011-11-05Teach LiveVariables to look through OpaqueValueExprs for extending Stmt ↵Ted Kremenek1-10/+28
liveness. llvm-svn: 143767
2011-10-24Rename AnalysisContext to AnalysisDeclContext. Not only is this name more ↵Ted Kremenek1-5/+5
accurate, but it frees up the name AnalysisContext for other uses. llvm-svn: 142782
2011-10-22Pull TopologicallySortedCFG out of LiveVariables into its own analysis: ↵Ted Kremenek1-105/+7
PostOrderCFGView. llvm-svn: 142713
2011-10-07Remove AnalysisContext::getLiveVariables(), and introduce a templatized ↵Ted Kremenek1-0/+2
mechanism to lazily create analyses that are attached to AnalysisContext objects. llvm-svn: 141425
2011-10-06[static analyzer] Fix crash in LiveVariables and Environment::getSVal() when ↵Ted Kremenek1-3/+4
analyzing C++ pointer-to-member calls. Fixes <rdar://problem/10243398>. llvm-svn: 141312
2011-10-02Fix another major performance regression in LiveVariables by not ↵Ted Kremenek1-1/+6
canonicalizing the underlying ImmutableSets on every analyzed statement (just at merges). Fixes <rdar://problem/10087538>. llvm-svn: 140958
2011-10-02Fix LiveVariables analysis bug with MaterializeTemporaryExpr and fix ↵Ted Kremenek1-4/+0
handling in ExprEngine. Fixes <rdar://problem/10201666>. llvm-svn: 140956
2011-09-16Fix massive LiveVariables regression (due to LiveVariables rewrite) by ↵Ted Kremenek1-62/+222
addressing two performance problems: - Speed of "merge()", which merged data flow facts. This was doing a set canonicalization on every insertion, which was super slow. To fix this, we use ImmutableSetRef. - Visit CFGBlocks in reverse postorder. This is a huge speedup, as on some test cases the algorithm would take many iterations to converge. This contains a bunch of copy-paste from UninitializedValues.cpp and ThreadSafety.cpp. The idea was to get something working first, and then refactor the common logic for all three files into a separate analysis/library entry point. llvm-svn: 139968
2011-08-23Constify the result of CFGStmt::getStmt().Ted Kremenek1-1/+1
llvm-svn: 138408
2011-08-12Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer ↵Ted Kremenek1-3/+3
and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at. llvm-svn: 137537
2011-08-06[analyzer] Simplify logic for ExprEngine::VisitUnaryExprOrTypeTraitExpr to ↵Ted Kremenek1-10/+33
avoid recursion to subexpression. This exposed bugs in the live variables analysis, and a latent analyzer bug in the SymbolReaper. llvm-svn: 137006
2011-08-02Make helper functions static.Benjamin Kramer1-2/+3
llvm-svn: 136679
2011-07-28[analyzer] Overhaul how the static analyzer expects CFGs by forcing CFGs to ↵Ted Kremenek1-307/+401
be linearized only when used by the static analyzer. This required a rewrite of LiveVariables, and exposed a ton of subtle bugs. The motivation of this large change is to drastically simplify the logic in ExprEngine going forward. Some fallout is that the output of some BugReporterVisitors is not as accurate as before; those will need to be fixed over time. There is also some possible performance regression as RemoveDeadBindings will be called frequently; this can also be improved over time. llvm-svn: 136419
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner1-1/+1
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-06-10[analyzer] PR8962 again. Ban ParenExprs (and friends) from block-level ↵Jordy Rose1-13/+3
expressions (by calling IgnoreParens before adding expressions to blocks). Undo 132769 (LiveVariables' local IgnoreParens), since it's no longer necessary. Also, have Environment stop looking through NoOp casts; it didn't match the behavior of LiveVariables. And once that's gone, the whole cast block of that switch is unnecessary. llvm-svn: 132840