summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Add a comment explaining an unavailable optimization.Dan Gohman2013-02-011-0/+28
| | | | llvm-svn: 174131
* Rewrite instsimplify's handling if icmp on pointer values to remove theDan Gohman2013-02-011-56/+88
| | | | | | | | | | | | 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. llvm-svn: 174122
* An alloca can be equal to an argument. It can't *alias* an alloca, but it couldDan Gohman2013-01-311-12/+0
| | | | | | | be equal, since there's nothing preventing a caller from correctly predicting the stack location of an alloca. llvm-svn: 174119
* Change stripAndComputeConstantOffsets to accept a NULL DataLayout pointerDan Gohman2013-01-311-10/+15
| | | | | | as well. llvm-svn: 174030
* Add a comment.Dan Gohman2013-01-311-0/+4
| | | | llvm-svn: 174028
* Move isKnownNonNull out of AliasAnalysis.h and into ValueTracking.cpp sinceDan Gohman2013-01-313-17/+16
| | | | | | | it isn't really an AliasAnalysis concept, and ValueTracking has similar things that it could plausibly share code with some day. llvm-svn: 174027
* Change GetPointerBaseWithConstantOffset's DataLayout argument from aDan Gohman2013-01-314-50/+49
| | | | | | | reference to a pointer, so that it can handle the case where DataLayout is not available and behave conservatively. llvm-svn: 174024
* Minor code simplification.Dan Gohman2013-01-311-1/+1
| | | | llvm-svn: 174005
* stripAndComputeConstantOffsets is only called on pointers; check thisDan Gohman2013-01-311-10/+1
| | | | | | with an assert instead of failing and requiring callers to check for failure. llvm-svn: 173998
* ConstantFolding: Add a missing folding that leads to a miscompile.Benjamin Kramer2013-01-241-4/+4
| | | | | | | | | | 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. llvm-svn: 173356
* ConstantFolding: Tweak r173289, it should evaluate in the intptr type, not ↵Benjamin Kramer2013-01-231-18/+15
| | | | | | the index type. llvm-svn: 173293
* ConstantFolding: Evaluate GEP indices in the index type.Benjamin Kramer2013-01-231-2/+11
| | | | | | | This fixes some edge cases that we would get wrong with uint64_ts. PR14986. llvm-svn: 173289
* Begin fleshing out an interface in TTI for modelling the costs ofChandler Carruth2013-01-223-63/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 173148
* Make APFloat constructor require explicit semantics.Tim Northover2013-01-221-1/+1
| | | | | | | | | 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. llvm-svn: 173138
* Switch CodeMetrics itself over to use TTI to determine if an instructionChandler Carruth2013-01-212-79/+6
| | | | | | | | | | | | 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. llvm-svn: 173036
* Sink InlineCost.cpp into IPA -- it is now officially an interproceduralChandler Carruth2013-01-213-1/+1
| | | | | | | | | | 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. llvm-svn: 173033
* Move the inline cost analysis's primary cost query to TTI instead of theChandler Carruth2013-01-211-4/+4
| | | | | | | | old CodeMetrics system. TTI has the specific advantage of being extensible and customizable by targets to reflect target-specific cost metrics. llvm-svn: 173032
* Now that the inline cost analysis is a pass, we can easily have itChandler Carruth2013-01-211-12/+20
| | | | | | | | | | | 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. llvm-svn: 173031
* Make the inline cost a proper analysis pass. This remains essentiallyChandler Carruth2013-01-211-5/+27
| | | | | | | | | | | | | | | | 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. llvm-svn: 173030
* Introduce a generic interface for querying an operation's expectedChandler Carruth2013-01-211-1/+122
| | | | | | | | | | | | | | | 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. llvm-svn: 172998
* Revert CostTable algorithm, will re-writeRenato Golin2013-01-201-45/+0
| | | | llvm-svn: 172992
* Fix 80-col and early exit in cost modelRenato Golin2013-01-191-12/+16
| | | | llvm-svn: 172877
* Reverting r171325 & r172363. This was causing a mis-compile on the ↵Bill Wendling2013-01-171-29/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 172756
* Change CostTable model to be global to all targetsRenato Golin2013-01-161-0/+41
| | | | | | | | 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. llvm-svn: 172658
* SCEVExpander fix. RAUW needs to update the InsertedExpressions cache.Andrew Trick2013-01-141-3/+2
| | | | | | | | Note that this bug is only exposed because LTO fails to use TTI. Fixes self-LTO of clang. rdar://13007381. llvm-svn: 172462
* fix compile-time regression report by Joerg Sonnenberger:Nuno Lopes2013-01-131-9/+11
| | | | | | cache result of Size/OffsetVisitor to speedup analysis of PHI nodes llvm-svn: 172363
* Remove redundant 'llvm::' qualificationsDmitri Gribenko2013-01-131-1/+1
| | | | llvm-svn: 172358
* Update CMakeLists for CallPrinter.cpp.Andrew Trick2013-01-111-0/+1
| | | | llvm-svn: 172222
* Added -view-callgraph module pass.Andrew Trick2013-01-112-0/+89
| | | | | | | | -dot-callgraph similarly follows a standard module pass pattern. Patch by Speziale Ettore! llvm-svn: 172220
* ARM Cost model: Use the size of vector registers and widest vectorizable ↵Nadav Rotem2013-01-091-0/+8
| | | | | | instruction to determine the max vectorization factor. llvm-svn: 172010
* Cost Model: Move the 'max unroll factor' variable to the TTI and add initial ↵Nadav Rotem2013-01-091-0/+8
| | | | | | Cost Model support on ARM. llvm-svn: 171928
* Move CallGraphSCCPass.h into the Analysis tree; that's where theChandler Carruth2013-01-071-1/+1
| | | | | | implementation lives already. llvm-svn: 171746
* Switch the SCEV expander and LoopStrengthReduce to useChandler Carruth2013-01-072-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. =] llvm-svn: 171735
* Move the initialization to the Analysis library as well as the pass.Chandler Carruth2013-01-071-0/+1
| | | | | | | This was (somewhat distressingly) only caught be the ocaml bindings tests... llvm-svn: 171690
* Make the popcnt support enums and methods have more clear names andChandler Carruth2013-01-071-5/+5
| | | | | | | follow the conding conventions regarding enumerating a set of "kinds" of things. llvm-svn: 171687
* Move TargetTransformInfo to live under the Analysis library. This noChandler Carruth2013-01-073-1/+272
| | | | | | | longer would violate any dependency layering and it is in fact an analysis. =] llvm-svn: 171686
* Switch the cost model analysis over to just the TTI interface.Chandler Carruth2013-01-051-20/+15
| | | | llvm-svn: 171619
* Memory Dependence Analysis: fix a miscompile that uses DT to approxmiate theManman Ren2013-01-041-4/+34
| | | | | | | | | | | | reachablity. We conservatively approximate the reachability analysis by saying it is not reachable if there is a single path starting from "From" and the path does not reach "To". rdar://12801584 llvm-svn: 171512
* Actually update the CMake and Makefile builds correctly, and update theChandler Carruth2013-01-021-1/+1
| | | | | | | | | | code that includes Intrinsics.gen directly. This never showed up in my testing because the old Intrinsics.gen was still kicking around in the make build system and was correct there. =[ Thankfully, some of the bots to clean rebuilds and that caught this. llvm-svn: 171373
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-0247-170/+170
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
* Rename VMCore directory to IR.Chandler Carruth2013-01-021-7/+7
| | | | | | | | | | | | | | | | | | Aside from moving the actual files, this patch only updates the build system and the source file comments under lib/... that are relevant. I'll be updating other docs and other files in smaller subsequnet commits. While I've tried to test this, but it is entirely possible that there will still be some build system fallout. Also, note that I've not changed the library name itself: libLLVMCore.a is still the library name. I'd be interested in others' opinions about whether we should rename this as well (I think we should, just not sure what it might break) llvm-svn: 171359
* reimplement GetPointerBaseWithConstantOffset().Nuno Lopes2012-12-311-31/+21
| | | | | | | The new code is an improved copy of the code I deleted from Analysis/Loads.cpp. One less compute-constant-gep-offset implementation. yay :) llvm-svn: 171326
* recommit r171298 (add support for PHI nodes to ObjectSizeOffsetVisitor). ↵Nuno Lopes2012-12-311-11/+26
| | | | | | Hopefully with bugs corrected now. llvm-svn: 171325
* Revert "add support for PHI nodes to ObjectSizeOffsetVisitor"Benjamin Kramer2012-12-311-14/+3
| | | | | | This reverts r171298. Breaks clang selfhost. llvm-svn: 171318
* revert r171306, since we cannot compare APInts with different bitwidthsNuno Lopes2012-12-311-1/+1
| | | | llvm-svn: 171308
* use ValueTracking's GetPointerBaseWithConstantOffset() function instead of a ↵Nuno Lopes2012-12-311-36/+8
| | | | | | local implementation llvm-svn: 171307
* minor code simplificationNuno Lopes2012-12-311-1/+1
| | | | llvm-svn: 171306
* add support for GlobalAlias to ObjectSizeOffsetVisitorNuno Lopes2012-12-311-0/+9
| | | | llvm-svn: 171303
* add support for PHI nodes to ObjectSizeOffsetVisitorNuno Lopes2012-12-311-3/+14
| | | | llvm-svn: 171298
* convert a bunch of callers from DataLayout::getIndexedOffset() to ↵Nuno Lopes2012-12-301-3/+2
| | | | | | | | | GEP::accumulateConstantOffset(). The later API is nicer than the former, and is correct regarding wrap-around offsets (if anyone cares). There are a few more places left with duplicated code, which I'll remove soon. llvm-svn: 171259
OpenPOWER on IntegriCloud