aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis
AgeCommit message (Collapse)AuthorFilesLines
2012-11-30Move the InstVisitor utility into VMCore where it belongs. It heavilyChandler Carruth3-3/+3
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
2012-11-30Modified dump() to provide a littlePreston Briggs1-32/+30
more information for dependences between instructions that don't share a common loop. Updated the test results appropriately. llvm-svn: 168965
2012-11-29Follow up to 168711: It's safe to base this analysis on the found compare, ↵Benjamin Kramer1-4/+3
just return the value for the right predicate. Thanks to Andy for catching this. llvm-svn: 168921
2012-11-29Improve isImpliedCond comment a bit.Andrew Trick1-2/+2
llvm-svn: 168914
2012-11-29Cleaned up a couple of comments.Preston Briggs1-4/+4
llvm-svn: 168854
2012-11-27Modified depends() to recognize that when all levels are "=" andPreston Briggs1-1/+16
there's no possible loo-independent dependence, then there's no dependence. Updated all test result appropriately. llvm-svn: 168719
2012-11-27SCEV: Even if the latch terminator is foldable we can't deduce the result of ↵Benjamin Kramer1-3/+4
an unrelated condition with it. Fixes PR14432. llvm-svn: 168711
2012-11-27Modify depends(Src, Dst, PossiblyLoopIndependent).Preston Briggs1-0/+3
If the Src and Dst are the same instruction, no loop-independent dependence is possible, so we force the PossiblyLoopIndependent flag to false. The test case results are updated appropriately. llvm-svn: 168678
2012-11-27Fast-math optimization: fold multiply by zeroMichael Ilseman1-0/+39
Added in first optimization using fast-math flags to serve as an example for following optimizations. SimplifyInstruction will now try to optimize an fmul observing its FastMathFlags to see if it can fold multiply by zero when 'nnan' and 'nsz' flags are set. llvm-svn: 168648
2012-11-21Corrects a problem where we reply exclusively of GEPs to drivePreston Briggs1-69/+108
analysis. Better is to look for cases with useful GEPs and use them when possible. When a pair of useful GEPs is not available, use the raw SCEVs directly. This approach supports better analysis of pointer dereferencing. In parallel, all the test cases are updated appropriately. Cases where we have a store to *B++ can now be analyzed! llvm-svn: 168474
2012-11-20removes a few "const" qualifiersSebastian Pop1-13/+13
so that I can (someday) call SE->getSCEV without complaint. No semantic change intended. Patch from Preston Briggs <preston.briggs@gmail.com>. llvm-svn: 168391
2012-11-19Clean up handling of always-inline functions in the inliner.Bob Wilson1-71/+105
This patch moves the isInlineViable function from the InlineAlways pass into the InlineCostAnalyzer and then changes the InlineCost computation to use that simple check for always-inline functions. All the special-case checks for AlwaysInline in the CallAnalyzer can then go away. llvm-svn: 168300
2012-11-19Some comment fixes.Bob Wilson1-1/+1
llvm-svn: 168299
2012-11-17Phi speculation improvement for BasicAAHal Finkel1-3/+12
This is a partial solution to PR14351. It removes some of the special significance of the first incoming phi value in the phi aliasing checking logic in BasicAA. In the context of a loop, the old logic assumes that the first incoming value is the interesting one (meaning that it is the one that comes from outside the loop), but this is often not the case. With this change, we now test first the incoming value that comes from a block other than the parent of the phi being tested. llvm-svn: 168245
2012-11-16Make this easier to understand, as suggested by Chandler.Duncan Sands1-1/+6
llvm-svn: 168196
2012-11-16InstructionSimplify should be able to simplify A+B==B+A to 'true'Duncan Sands1-2/+14
but wasn't due to the same logic bug that caused PR14361. llvm-svn: 168186
2012-11-15Add doInitialization and doFinalization methods to ModulePass's, to allow ↵Owen Anderson1-0/+3
them to be re-initialized and reused on multiple Module's. Patch by Pedro Artigas. llvm-svn: 168008
2012-11-13DependenceAnalysis: Print all dependency pairs when dumping. Update all ↵Benjamin Kramer1-8/+5
testcases. Part of a patch by Preston Briggs. llvm-svn: 167827
2012-11-08llvm/ConstantFolding.cpp: Make ReadDataFromGlobal() and ↵NAKAMURA Takumi1-9/+19
FoldReinterpretLoadFromConstPtr() Big-endian-aware. llvm-svn: 167595
2012-11-05Don't infer whether a value is captured in the current function from theRichard Osborne1-5/+5
'nocapture' attribute. The nocapture attribute only specifies that no copies are made that outlive the function. This isn't the same as there being no copies at all. This fixes PR14045. llvm-svn: 167381
2012-11-05ConstantFolding.cpp: Whitespace.NAKAMURA Takumi1-100/+100
llvm-svn: 167377
2012-11-04Apply the patch from PR14160. I failed to construct a testcase for this, butDuncan Sands1-0/+3
I'm applying it anyway since it seems to be obviously correct. llvm-svn: 167370
2012-11-02CostModel: add support for Vector Insert and Extract.Nadav Rotem1-0/+18
llvm-svn: 167329
2012-11-02Add a cost model analysis that allows us to estimate the cost of IR-level ↵Nadav Rotem3-0/+177
instructions. llvm-svn: 167324
2012-11-01Revert the majority of the next patch in the address space series:Chandler Carruth6-37/+20
r165941: Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis. Despite this commit log, this change primarily changed stuff outside of VMCore, and those changes do not carry any tests for correctness (or even plausibility), and we have consistently found questionable or flat out incorrect cases in these changes. Most of them are probably correct, but we need to devise a system that makes it more clear when we have handled the address space concerns correctly, and ideally each pass that gets updated would receive an accompanying test case that exercises that pass specificaly w.r.t. alternate address spaces. However, from this commit, I have retained the new C API entry points. Those were an orthogonal change that probably should have been split apart, but they seem entirely good. In several places the changes were very obvious cleanups with no actual multiple address space code added; these I have not reverted when I spotted them. In a few other places there were merge conflicts due to a cleaner solution being implemented later, often not using address spaces at all. In those cases, I've preserved the new code which isn't address space dependent. This is part of my ongoing effort to clean out the partial address space code which carries high risk and low test coverage, and not likely to be finished before the 3.2 release looms closer. Duncan and I would both like to see the above issues addressed before we return to these changes. llvm-svn: 167222
2012-11-01Revert the series of commits starting with r166578 which introduced theChandler Carruth7-146/+140
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
2012-10-31Fix a couple of comment typos.Benjamin Kramer1-2/+2
llvm-svn: 167113
2012-10-31DependenceAnalysis: Don't crash if there is no constant operand.Benjamin Kramer1-3/+4
This makes the code match the comments. Resolves a crash in loop idiom (PR14219). llvm-svn: 167110
2012-10-29Remove code to saturate profile counts.Bob Wilson1-8/+1
We may need to change the way profile counter values are stored, but saturation is the wrong thing to do. Just remove it for now. Patch by Alastair Murray! llvm-svn: 166938
2012-10-27SCEV validator: Ignore CouldNotCompute/undef on both sides. This is mostly ↵Benjamin Kramer1-3/+6
noise and blocks finding more severe bugs. llvm-svn: 166873
2012-10-27SCEV validator: Add workarounds for some common false positives due to the ↵Benjamin Kramer1-0/+18
way it handles strings. llvm-svn: 166872
2012-10-26Remove LoopDependenceAnalysis.Benjamin Kramer3-364/+0
It was unmaintained and not much more than a stub. The new DependenceAnalysis pass is both more general and complete. llvm-svn: 166810
2012-10-26Add a basic verifier for SCEV's backedge taken counts.Benjamin Kramer1-0/+68
Enabled with -verify-scev. This could be extended significantly but hopefully catches the common cases now. Note that it's not enabled by default in any configuration because the way it tries to distinguish SCEVs is still fragile and may produce false positives. Also the test-suite isn't clean yet, one example is that it fails if a pass drops an NSW bit but it's still present in SCEV's cached. Cleaning up all those cases will take some time. llvm-svn: 166786
2012-10-26Fix a crash in SimpliftDemandedBits of vectors of pointers.Nadav Rotem1-6/+4
PR14183. llvm-svn: 166785
2012-10-26Hoist out some work done inside a loop doing a linear scan over allNick Lewycky1-12/+17
instructions in a block. GetUnderlyingObject is more expensive than it looks as it can, for instance, call SimplifyInstruction. This might have some behavioural changes in odd corner cases, but only because of some strange artefacts of the original implementation. If you were relying on those, we can fix that by replacing this with a smarter algorithm. Change passes the existing tests. llvm-svn: 166754
2012-10-25Revert 166726 because it may have broken a number of SPEC tests. PR14183.Nadav Rotem1-3/+2
llvm-svn: 166739
2012-10-25Fix a crash in ValueTracking. Add support for vectors of pointers.Nadav Rotem1-2/+3
llvm-svn: 166726
2012-10-25DependenceAnalysis: Push #includes down into the implementation.Benjamin Kramer1-1/+5
llvm-svn: 166688
2012-10-24getSmallConstantTripMultiple should never return zero.Hal Finkel1-2/+5
When the trip count is -1, getSmallConstantTripMultiple could return zero, and this would cause runtime loop unrolling to assert. Instead of returning zero, one is now returned (consistent with the existing overflow cases). Fixes PR14167. llvm-svn: 166612
2012-10-24Add some cleanup to the DataLayout changes requested by Chandler.Micah Villmow3-7/+3
llvm-svn: 166607
2012-10-24Add in support for getIntPtrType to get the pointer type based on the ↵Micah Villmow7-133/+143
address space. This checkin also adds in some tests that utilize these paths and updates some of the clients. llvm-svn: 166578
2012-10-23Ignore unreachable blocks when doing memory dependence analysis on non-localBill Wendling1-2/+2
loads. It's not really profitable and may result in GVN going into an infinite loop when it hits constructs like this: %x = gep %some.type %x, ... Found via an LTO build of LLVM. llvm-svn: 166490
2012-10-19revert r166264 because the LTO build is still failingNadav Rotem1-6/+6
llvm-svn: 166340
2012-10-19SCEVExpander: Don't crash when trying to merge two constant phis.Benjamin Kramer1-0/+11
Just constant fold them so they can't cause any trouble. Fixes PR12627. llvm-svn: 166286
2012-10-19recommit the patch that makes LSR and LowerInvoke use the TargetTransform ↵Nadav Rotem1-6/+6
interface. llvm-svn: 166264
2012-10-18Temporarily revert the TargetTransform changes.Bob Wilson1-6/+6
The TargetTransform changes are breaking LTO bootstraps of clang. I am working with Nadav to figure out the problem, but I am reverting it for now to get our buildbots working. This reverts svn commits: 165665 165669 165670 165786 165787 165997 and I have also reverted clang svn 165741 llvm-svn: 166168
2012-10-15Resubmit the changes to llvm core to update the functions to support ↵Micah Villmow6-20/+37
different pointer sizes on a per address space basis. llvm-svn: 165941
2012-10-12fix warningSebastian Pop1-6/+6
DependenceAnalysis.cpp:1164:32: warning: implicit truncation from 'int' to bitfield changes value from -5 to 3 [-Wconstant-conversion] Result.DV[Level].Direction &= ~Dependence::DVEntry::GT; ^ ~~~~~~~~~~~~~~~~~~~~~~~~ Patch from Preston Briggs <preston.briggs@gmail.com>. llvm-svn: 165784
2012-10-11Revert 165732 for further review.Micah Villmow6-37/+20
llvm-svn: 165747
2012-10-11Add in the first iteration of support for llvm/clang/lldb to allow variable ↵Micah Villmow6-20/+37
per address space pointer sizes to be optimized correctly. llvm-svn: 165726