summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/Lint.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-8/+8
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Move the InstVisitor utility into VMCore where it belongs. It heavilyChandler Carruth2012-11-301-1/+1
| | | | | | | | | | | | depends on the IR infrastructure, there is no sense in it being off in Support land. This is in preparation to start working to expand InstVisitor into more special-purpose visitors that are still generic and can be re-used across different passes. The expansion will go into the Analylis tree though as nothing in VMCore needs it. llvm-svn: 168972
* Revert the series of commits starting with r166578 which introduced theChandler Carruth2012-11-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getIntPtrType support for multiple address spaces via a pointer type, and also introduced a crasher bug in the constant folder reported in PR14233. These commits also contained several problems that should really be addressed before they are re-committed. I have avoided reverting various cleanups to the DataLayout APIs that are reasonable to have moving forward in order to reduce the amount of churn, and minimize the number of commits that were reverted. I've also manually updated merge conflicts and manually arranged for the getIntPtrType function to stay in DataLayout and to be defined in a plausible way after this revert. Thanks to Duncan for working through this exact strategy with me, and Nick Lewycky for tracking down the really annoying crasher this triggered. (Test case to follow in its own commit.) After discussing with Duncan extensively, and based on a note from Micah, I'm going to continue to back out some more of the more problematic patches in this series in order to ensure we go into the LLVM 3.2 branch with a reasonable story here. I'll send a note to llvmdev explaining what's going on and why. Summary of reverted revisions: r166634: Fix a compiler warning with an unused variable. r166607: Add some cleanup to the DataLayout changes requested by Chandler. r166596: Revert "Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this! r166591: Delete a directory that wasn't supposed to be checked in yet. r166578: Add in support for getIntPtrType to get the pointer type based on the address space. llvm-svn: 167221
* Add in support for getIntPtrType to get the pointer type based on the ↵Micah Villmow2012-10-241-3/+2
| | | | | | | | | address space. This checkin also adds in some tests that utilize these paths and updates some of the clients. llvm-svn: 166578
* Move TargetData to DataLayout.Micah Villmow2012-10-081-4/+4
| | | | llvm-svn: 165402
* Ignore apparent buffer overruns on external or weak globals. This is a majorDuncan Sands2012-09-301-7/+11
| | | | | | | source of false positives due to globals being declared in a header with some kind of incomplete (small) type, but the actual definition being bigger. llvm-svn: 164912
* Teach the 'lint' sanity checking pass to detect simple buffer overflows.Duncan Sands2012-09-261-19/+39
| | | | llvm-svn: 164671
* Change the way the lint sanity checking pass detects misaligned memory accesses.Duncan Sands2012-09-251-6/+18
| | | | | | | | | | | | | | | Previously it was only be able to detect problems if the pointer was a numerical value (eg inttoptr i32 1 to i32*), but not if it was an alloca or globa. The reason was the use of ComputeMaskedBits: imagine you have "alloca i8, align 2", and ask ComputeMaskedBits what it knows about the bits of the alloca pointer. It can tell you that the bottom bit is known zero (due to align 2) but it can't tell you that bit 1 is known one. That's because the address could be an even multiple of 2 rather than an odd multiple, eg it might be a multiple of 4. Thus trying to use KnownOne is ineffective in the case of an alloca as it will never have any bits set. Instead look explicitly for constant offsets from allocas and globals. llvm-svn: 164595
* Always compute all the bits in ComputeMaskedBits.Rafael Espindola2012-04-041-6/+4
| | | | | | | | This allows us to keep passing reduced masks to SimplifyDemandedBits, but know about all the bits if SimplifyDemandedBits fails. This allows instcombine to simplify cases like the one in the included testcase. llvm-svn: 154011
* Fix a few more places where TargetData/TargetLibraryInfo is not being passed.Chad Rosier2011-12-021-1/+1
| | | | | | Add FIXMEs to places that are non-trivial to fix. llvm-svn: 145661
* Propagate TargetLibraryInfo throughout ConstantFolding.cpp and Chad Rosier2011-12-011-1/+6
| | | | | | | InstructionSimplify.cpp. Other fixups as needed. Part of rdar://10500969 llvm-svn: 145559
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-4/+4
| | | | llvm-svn: 135375
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-131-5/+2
| | | | llvm-svn: 135040
* PR9214: Convert ConstantExpr::getIndices() to return an ArrayRef, plusJay Foad2011-04-131-1/+1
| | | | | | related tweaks to ExprMapKeyType. llvm-svn: 129443
* Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman2011-01-241-1/+1
| | | | | | | | | | | with BasicAA's DecomposeGEPExpression, which recently began using a TargetData. This fixes PR8968, though the testcase is awkward to reduce. Also, update several off GetUnderlyingObject's users which happen to have a TargetData handy to pass it in. llvm-svn: 124134
* Move Value::getUnderlyingObject to be a standaloneDan Gohman2010-12-151-1/+1
| | | | | | | function so that it can live in Analysis instead of VMCore. llvm-svn: 121885
* Update a comment.Dan Gohman2010-12-131-4/+3
| | | | llvm-svn: 121727
* Use PartialAlias to do better noalias lint checking.Dan Gohman2010-12-101-4/+6
| | | | llvm-svn: 121514
* Now that hasConstantValue has been made simpler, it may return theDuncan Sands2010-11-171-1/+2
| | | | | | | phi node itself if it occurs in an unreachable basic block. Protect against this. Hopefully this will fix some more buildbots. llvm-svn: 119493
* Previously SimplifyInstruction could report that an instructionDuncan Sands2010-11-171-2/+1
| | | | | | | | simplified to itself (this can only happen in unreachable blocks). Change it to return null instead. Hopefully this will fix some buildbot failures. llvm-svn: 119490
* Fix a layering violation: hasConstantValue, which is part of the PHINodeDuncan Sands2010-11-171-2/+2
| | | | | | | | | | | | | | class, uses DominatorTree which is an analysis. This change moves all of the tricky hasConstantValue logic to SimplifyInstruction, and replaces it with a very simple literal implementation. I already taught users of hasConstantValue that need tricky stuff to use SimplifyInstruction instead. I didn't update InlineFunction because the IR looks like it might be in a funky state at the point it calls hasConstantValue, which makes calling SimplifyInstruction dangerous since it can in theory do a lot of tricky reasoning. This may be a pessimization, for example in the case where all phi node operands are either undef or a fixed constant. llvm-svn: 119459
* Avoid calling alias on non-pointer values.Dan Gohman2010-11-111-3/+4
| | | | llvm-svn: 118822
* Reapply r116831 and r116839, converting AliasAnalysis to useDan Gohman2010-10-191-3/+3
| | | | | | uint64_t, plus fixes for places I missed before. llvm-svn: 116875
* Revert r116831 and r116839, which are breaking selfhost builds.Dan Gohman2010-10-191-3/+3
| | | | llvm-svn: 116858
* Change AliasAnalysis and its clients to use uint64_t instead of unsignedDan Gohman2010-10-191-3/+3
| | | | | | for representing object sizes, for consistency with other parts of LLVM. llvm-svn: 116831
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Consistently use AliasAnalysis::UnknownSize instead of hardcoding ~0u.Dan Gohman2010-10-191-16/+25
| | | | llvm-svn: 116815
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-121-1/+6
| | | | | | | | | perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. llvm-svn: 116334
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* zap dead code.Chris Lattner2010-09-041-22/+0
| | | | llvm-svn: 113073
* Revert r111058, the lint check for indirectbr successors that aren'tDan Gohman2010-08-161-6/+0
| | | | | | | address-taken. This can occur normally, if the code which took the address got DCEd. llvm-svn: 111121
* Add a lint check for an indirectbr destination which has notDan Gohman2010-08-131-0/+6
| | | | | | had its address taken. llvm-svn: 111058
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* Add a convenient form of AliasAnalysis::alias for the case where the sizesDan Gohman2010-08-031-2/+1
| | | | | | are unknown. llvm-svn: 110090
* Add a lint check for indirectbr with no successors.Dan Gohman2010-08-021-0/+3
| | | | llvm-svn: 110074
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+1
| | | | llvm-svn: 109045
* Add a lint check for mismatched return types, inspired by PR6944.Dan Gohman2010-07-121-0/+4
| | | | llvm-svn: 108162
* Add some more TODO comments.Dan Gohman2010-07-061-0/+6
| | | | llvm-svn: 107657
* Add a comment.Dan Gohman2010-07-061-1/+2
| | | | llvm-svn: 107656
* Fix the noalias checking so that it doesn't worry aboutDan Gohman2010-06-011-12/+12
| | | | | | an argument aliasing itself. Thanks Duncan! llvm-svn: 105288
* Add lint checks for function attributes.Dan Gohman2010-05-281-30/+91
| | | | llvm-svn: 105009
* Fix lint's memcpy and memmove checks, and its basic block traversal.Dan Gohman2010-05-281-5/+8
| | | | llvm-svn: 104970
* Detect self-referential values.Dan Gohman2010-05-281-6/+19
| | | | llvm-svn: 104957
* Eli pointed out that va_arg instruction result values don'tDan Gohman2010-05-281-4/+4
| | | | | | reference the stack. llvm-svn: 104951
* Teach lint how to look through simple store+load pairs and otherDan Gohman2010-05-281-10/+75
| | | | | | | effective no-op constructs, to make it more effective on unoptimized IR. llvm-svn: 104950
* Add a lint check for returning the address of stack memory.Dan Gohman2010-05-281-0/+6
| | | | llvm-svn: 104936
* Fix Lint printing warnings multiple times. Remove the ErrorStrDan Gohman2010-05-261-5/+2
| | | | | | | option from lintModule, which was an artifact from being based on Verifier code. llvm-svn: 104765
* Reinstate checking of stackrestore, with checking for both ReadDan Gohman2010-05-261-0/+8
| | | | | | and Write, and add a comment explaining this. llvm-svn: 104756
OpenPOWER on IntegriCloud