summaryrefslogtreecommitdiff
path: root/lib/Analysis
Commit message (Collapse)AuthorAge
...
* Fix a problem in alias analysis. It is about the misinterpretation of "Object".Shuxin Yang2013-02-28
| | | | | | | | | | | | | | | | | | This problem is exposed by r171325 which is already reverted. It is rather hard to fabricate a testing case without it. r171325 should *NOT* be resurrected as it has a potential problem although this problem dosen't directly contribute to PR14988. The bug is tracked by: - rdar://13063553, and - http://llvm.org/bugs/show_bug.cgi?id=14988 Thank Arnold for coming up a better solution to this problem. After comparing this solution and my original proposal, I decided to ditch mine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176225 91177308-0d34-0410-b5e6-96231b3b80d8
* Constant fold vector bitcasts of halves similarly to how floats and doubles ↵Michael Ilseman2013-02-26
| | | | | | are folded. Test case included. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176131 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify clang/llvm attributes for asan/tsan/msan (LLVM part)Kostya Serebryany2013-02-26
| | | | | | | | | | | | | | | | | | | | These are two related changes (one in llvm, one in clang). LLVM: - rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode) - rename thread_safety => sanitize_thread - rename no_uninitialized_checks -> sanitize_memory CLANG: - add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis)) - add __attribute__((no_sanitize_thread)) - add __attribute__((no_sanitize_memory)) for S in address thread memory If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not set llvm attribute sanitize_S git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176075 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting.Chad Rosier2013-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175692 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the DataLayout aware constant folder to be much more aggressive towardsNick Lewycky2013-02-14
| | | | | | | 'and' instructions. This is a pattern that shows up a lot in ubsan binaries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175128 91177308-0d34-0410-b5e6-96231b3b80d8
* Metadata for annotating loops as parallel. The first consumer for this Pekka Jaaskelainen2013-02-13
| | | | | | | | | | metadata is the loop vectorizer. See the documentation update for more info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175060 91177308-0d34-0410-b5e6-96231b3b80d8
* [tsan] disable load widening in ThreadSanitizer modeKostya Serebryany2013-02-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175034 91177308-0d34-0410-b5e6-96231b3b80d8
* Cost model: Add check for reverse shuffles to CostModel analysisArnold Schwaighofer2013-02-12
| | | | | | | | | | Check for reverse shuffles in the CostModel analysis pass and query TargetTransform info accordingly. This allows us we can write test cases for reverse shuffles. radar://13171406 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174932 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add LLVMContext::emitWarning methods and use them. ↵Bob Wilson2013-02-08
| | | | | | | | | | | | | <rdar://problem/12867368>" This reverts r171041. This was a nice idea that didn't work out well. Clang warnings need to be associated with warning groups so that they can be selectively disabled, promoted to errors, etc. This simplistic patch didn't allow for that. Enhancing it to provide some way for the backend to specify a front-end warning type seems like overkill for the few uses of this, at least for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174748 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM cost model: Address computation in vector mem ops not freeArnold Schwaighofer2013-02-08
| | | | | | | | | | | | | | | Adds a function to target transform info to query for the cost of address computation. The cost model analysis pass now also queries this interface. The code in LoopVectorize adds the cost of address computation as part of the memory instruction cost calculation. Only there, we know whether the instruction will be scalarized or not. Increase the penality for inserting in to D registers on swift. This becomes necessary because we now always assume that address computation has a cost and three is a closer value to the architecture. radar://13097204 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174713 91177308-0d34-0410-b5e6-96231b3b80d8
* Identify and simplify idempotent intrinsics. Test case included.Michael Ilseman2013-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174650 91177308-0d34-0410-b5e6-96231b3b80d8
* Conditionalize constant folding of math intrinsics on the availability of an ↵Owen Anderson2013-02-07
| | | | | | implementation on the host. This is a little bit unfortunate, but until someone decides to implement a full libm for APFloat, we don't have a better way to get this functionality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174561 91177308-0d34-0410-b5e6-96231b3b80d8
* Signficantly generalize our ability to constant fold floating point ↵Owen Anderson2013-02-06
| | | | | | intrinsics, including ones on half types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174555 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantFolding: Fix a crash when encoutering a truncating inttoptr.Benjamin Kramer2013-02-05
| | | | | | This was introduced in r173293. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174424 91177308-0d34-0410-b5e6-96231b3b80d8
* use GEP::accumulateConstantOffset() to replace custom written code to ↵Nuno Lopes2013-02-03
| | | | | | compute GEP offset git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174279 91177308-0d34-0410-b5e6-96231b3b80d8
* InstSimplify: stripAndComputeConstantOffsets can be called with vectors of ↵Benjamin Kramer2013-02-01
| | | | | | | | | | pointers too. Prepare it for vectors of pointers and handle simple cases. We don't handle complicated cases because accumulateConstantOffset bails on pointer vectors. Fixes selfhost on i386. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174179 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment explaining an unavailable optimization.Dan Gohman2013-02-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174131 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite instsimplify's handling if icmp on pointer values to remove theDan Gohman2013-02-01
| | | | | | | | | | | | | remaining use of AliasAnalysis concepts such as isIdentifiedObject to prove pointer inequality. @external_compare in test/Transforms/InstSimplify/compare.ll shows a simple case where a noalias argument can be equal to a global variable address, and while AliasAnalysis can get away with saying that these pointers don't alias, instsimplify cannot say that they are not equal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174122 91177308-0d34-0410-b5e6-96231b3b80d8
* An alloca can be equal to an argument. It can't *alias* an alloca, but it couldDan Gohman2013-01-31
| | | | | | | | be equal, since there's nothing preventing a caller from correctly predicting the stack location of an alloca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174119 91177308-0d34-0410-b5e6-96231b3b80d8
* Change stripAndComputeConstantOffsets to accept a NULL DataLayout pointerDan Gohman2013-01-31
| | | | | | | as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174030 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment.Dan Gohman2013-01-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174028 91177308-0d34-0410-b5e6-96231b3b80d8
* Move isKnownNonNull out of AliasAnalysis.h and into ValueTracking.cpp sinceDan Gohman2013-01-31
| | | | | | | | it isn't really an AliasAnalysis concept, and ValueTracking has similar things that it could plausibly share code with some day. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174027 91177308-0d34-0410-b5e6-96231b3b80d8
* Change GetPointerBaseWithConstantOffset's DataLayout argument from aDan Gohman2013-01-31
| | | | | | | | reference to a pointer, so that it can handle the case where DataLayout is not available and behave conservatively. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174024 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor code simplification.Dan Gohman2013-01-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174005 91177308-0d34-0410-b5e6-96231b3b80d8
* stripAndComputeConstantOffsets is only called on pointers; check thisDan Gohman2013-01-31
| | | | | | | with an assert instead of failing and requiring callers to check for failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173998 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantFolding: Add a missing folding that leads to a miscompile.Benjamin Kramer2013-01-24
| | | | | | | | | | We use constant folding to see if an intrinsic evaluates to the same value as a constant that we know. If we don't take the undefinedness into account we get a value that doesn't match the actual implementation, and miscompiled code. This was uncovered by Chandler's simplifycfg changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173356 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantFolding: Tweak r173289, it should evaluate in the intptr type, not ↵Benjamin Kramer2013-01-23
| | | | | | the index type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173293 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantFolding: Evaluate GEP indices in the index type.Benjamin Kramer2013-01-23
| | | | | | | This fixes some edge cases that we would get wrong with uint64_ts. PR14986. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173289 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin fleshing out an interface in TTI for modelling the costs ofChandler Carruth2013-01-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | generic function calls and intrinsics. This is somewhat overlapping with an existing intrinsic cost method, but that one seems targetted at vector intrinsics. I'll merge them or separate their names and use cases in a separate commit. This sinks the test of 'callIsSmall' down into TTI where targets can control it. The whole thing feels very hack-ish to me though. I've left a FIXME comment about the fundamental design problem this presents. It isn't yet clear to me what the users of this function *really* care about. I'll have to do more analysis to figure that out. Putting this here at least provides it access to proper analysis pass tools and other such. It also allows us to more cleanly implement the baseline cost interfaces in TTI. With this commit, it is now theoretically possible to simplify much of the inline cost analysis's handling of calls by calling through to this interface. That conversion will have to happen in subsequent commits as it requires more extensive restructuring of the inline cost analysis. The CodeMetrics class is now really only in the business of running over a block of code and aggregating the metrics on that block of code, with the actual cost evaluation done entirely in terms of TTI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173148 91177308-0d34-0410-b5e6-96231b3b80d8
* Make APFloat constructor require explicit semantics.Tim Northover2013-01-22
| | | | | | | | | Previously we tried to infer it from the bit width size, with an added IsIEEE argument for the PPC/IEEE 128-bit case, which had a default value. This default value allowed bugs to creep in, where it was inappropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173138 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch CodeMetrics itself over to use TTI to determine if an instructionChandler Carruth2013-01-21
| | | | | | | | | | | | is free. The whole CodeMetrics API should probably be reworked more, but this is enough to allow deleting the duplicate code there for computing whether an instruction is free. All of the passes using this have been updated to pull in TTI and hand it to the CodeMetrics stuff. Further, a dead CodeMetrics API (analyzeFunction) is nuked for lack of users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173036 91177308-0d34-0410-b5e6-96231b3b80d8
* Sink InlineCost.cpp into IPA -- it is now officially an interproceduralChandler Carruth2013-01-21
| | | | | | | | | | analysis. How cute that it wasn't previously. ;] Part of this confusion stems from the flattened header file tree. Thanks to Benjamin for pointing out the goof on IRC, and we're considering un-flattening the headers, so speak now if that would bug you. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173033 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the inline cost analysis's primary cost query to TTI instead of theChandler Carruth2013-01-21
| | | | | | | | old CodeMetrics system. TTI has the specific advantage of being extensible and customizable by targets to reflect target-specific cost metrics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173032 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that the inline cost analysis is a pass, we can easily have itChandler Carruth2013-01-21
| | | | | | | | | | | depend on and use other analyses (as long as they're either immutable passes or CGSCC passes of course -- nothing in the pass manager has been fixed here). Leverage this to thread TargetTransformInfo down through the inline cost analysis. No functionality changed here, this just threads things through. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173031 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the inline cost a proper analysis pass. This remains essentiallyChandler Carruth2013-01-21
| | | | | | | | | | | | | | | | a dynamic analysis done on each call to the routine. However, now it can use the standard pass infrastructure to reference other analyses, instead of a silly setter method. This will become more interesting as I teach it about more analysis passes. This updates the two inliner passes to use the inline cost analysis. Doing so highlights how utterly redundant these two passes are. Either we should find a cheaper way to do always inlining, or we should merge the two and just fiddle with the thresholds to get the desired behavior. I'm leaning increasingly toward the latter as it would also remove the Inliner sub-class split. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173030 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a generic interface for querying an operation's expectedChandler Carruth2013-01-21
| | | | | | | | | | | | | | | lowered cost. Currently, this is a direct port of the logic implementing isInstructionFree in CodeMetrics. The hope is that the interface can be improved (f.ex. supporting un-formed instruction queries) and the implementation abstracted so that as we have test cases and target knowledge we can expose increasingly accurate heuristics to clients. I'll start switching existing consumers over and kill off the routine in CodeMetrics in subsequent commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172998 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert CostTable algorithm, will re-writeRenato Golin2013-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172992 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 80-col and early exit in cost modelRenato Golin2013-01-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172877 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r171325 & r172363. This was causing a mis-compile on the ↵Bill Wendling2013-01-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | self-hosted LTO build bots. Okay, here's how to reproduce the problem: 1) Build a Release (or Release+Asserts) version of clang in the normal way. 2) Using the clang & clang++ binaries from (1), build a Release (or Release+Asserts) version of the same sources, but this time enable LTO --- specify the `-flto' flag on the command line. 3) Run the ARC migrator tests: $ arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ ./src/tools/clang/test/ARCMT/cxx-rewrite.mm You'll see that the output isn't correct (the whitespace is off). The mis-compile is in the function `RewriteBuffer::RemoveText' in the clang/lib/Rewrite/Core/Rewriter.cpp file. When that function and RewriteRope.cpp are compiled with LTO and the `arcmt-test' executable is regenerated, you'll see the error. When those files are not LTO'ed, then the output of the `arcmt-test' is fine. It is *really* hard to get a testcase out of this. I'll file a PR with what I have currently. --- Reverse-merging r172363 into '.': U include/llvm/Analysis/MemoryBuiltins.h U lib/Analysis/MemoryBuiltins.cpp --- Reverse-merging r171325 into '.': U test/Transforms/InstCombine/objsize.ll G include/llvm/Analysis/MemoryBuiltins.h G lib/Analysis/MemoryBuiltins.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172756 91177308-0d34-0410-b5e6-96231b3b80d8
* Change CostTable model to be global to all targetsRenato Golin2013-01-16
| | | | | | | | Moving the X86CostTable to a common place, so that other back-ends can share the code. Also simplifying it a bit and commoning up tables with one and two types on operations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172658 91177308-0d34-0410-b5e6-96231b3b80d8
* SCEVExpander fix. RAUW needs to update the InsertedExpressions cache.Andrew Trick2013-01-14
| | | | | | | | Note that this bug is only exposed because LTO fails to use TTI. Fixes self-LTO of clang. rdar://13007381. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172462 91177308-0d34-0410-b5e6-96231b3b80d8
* fix compile-time regression report by Joerg Sonnenberger:Nuno Lopes2013-01-13
| | | | | | cache result of Size/OffsetVisitor to speedup analysis of PHI nodes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172363 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove redundant 'llvm::' qualificationsDmitri Gribenko2013-01-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172358 91177308-0d34-0410-b5e6-96231b3b80d8
* Update CMakeLists for CallPrinter.cpp.Andrew Trick2013-01-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172222 91177308-0d34-0410-b5e6-96231b3b80d8
* Added -view-callgraph module pass.Andrew Trick2013-01-11
| | | | | | | | -dot-callgraph similarly follows a standard module pass pattern. Patch by Speziale Ettore! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172220 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM Cost model: Use the size of vector registers and widest vectorizable ↵Nadav Rotem2013-01-09
| | | | | | instruction to determine the max vectorization factor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172010 91177308-0d34-0410-b5e6-96231b3b80d8
* Cost Model: Move the 'max unroll factor' variable to the TTI and add initial ↵Nadav Rotem2013-01-09
| | | | | | Cost Model support on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171928 91177308-0d34-0410-b5e6-96231b3b80d8
* Move CallGraphSCCPass.h into the Analysis tree; that's where theChandler Carruth2013-01-07
| | | | | | implementation lives already. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171746 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch the SCEV expander and LoopStrengthReduce to useChandler Carruth2013-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TargetTransformInfo rather than TargetLowering, removing one of the primary instances of the layering violation of Transforms depending directly on Target. This is a really big deal because LSR used to be a "special" pass that could only be tested fully using llc and by looking at the full output of it. It also couldn't run with any other loop passes because it had to be created by the backend. No longer is this true. LSR is now just a normal pass and we should probably lift the creation of LSR out of lib/CodeGen/Passes.cpp and into the PassManagerBuilder. =] I've not done this, or updated all of the tests to use opt and a triple, because I suspect someone more familiar with LSR would do a better job. This change should be essentially without functional impact for normal compilations, and only change behvaior of targetless compilations. The conversion required changing all of the LSR code to refer to the TTI interfaces, which fortunately are very similar to TargetLowering's interfaces. However, it also allowed us to *always* expect to have some implementation around. I've pushed that simplification through the pass, and leveraged it to simplify code somewhat. It required some test updates for one of two things: either we used to skip some checks altogether but now we get the default "no" answer for them, or we used to have no information about the target and now we do have some. I've also started the process of removing AddrMode, as the TTI interface doesn't use it any longer. In some cases this simplifies code, and in others it adds some complexity, but I think it's not a bad tradeoff even there. Subsequent patches will try to clean this up even further and use other (more appropriate) abstractions. Yet again, almost all of the formatting changes brought to you by clang-format. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171735 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the initialization to the Analysis library as well as the pass.Chandler Carruth2013-01-07
| | | | | | | This was (somewhat distressingly) only caught be the ocaml bindings tests... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171690 91177308-0d34-0410-b5e6-96231b3b80d8