aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-07-18Migrate LLVM and Clang to use the new makeArrayRef(...) functions where ↵Frits van Bommel1-6/+3
previously explicit non-default constructors were used. Mostly mechanical with some manual reformatting. llvm-svn: 135390
2011-07-18land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner1-15/+15
llvm-svn: 135375
2011-07-13Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad1-31/+28
llvm-svn: 135040
2011-06-27Move onlyUsedByLifetimeMarkers to ValueTracking so that it can be used by otherNick Lewycky1-0/+16
passes as well. llvm-svn: 133904
2011-05-26Renamed llvm.x86.sse42.crc32 intrinsics; crc64 doesn't exist. Chad Rosier1-2/+2
crc32.[8|16|32] have been renamed to .crc32.32.[8|16|32] and crc64.[8|16|32] have been renamed to .crc32.64.[8|64]. llvm-svn: 132163
2011-05-23Teach valuetracking that byval arguments with a specified alignment areChris Lattner1-1/+11
aligned. Teach memcpyopt to not give up all hope when confonted with an underaligned memcpy feeding an overaligned byval. If the *source* of the memcpy can be determined to be adequeately aligned, or if it can be forced to be, we can eliminate the memcpy. This addresses PR9794. We now compile the example into: define i32 @f(%struct.p* nocapture byval align 8 %q) nounwind ssp { entry: %call = call i32 @g(%struct.p* byval align 8 %q) nounwind ret i32 %call } in both x86-64 and x86-32 mode. We still don't get a tailcall though, because tailcalls apparently can't handle byval. llvm-svn: 131884
2011-05-22Teach ValueTracking about x86 crc32 intrinsics.Evan Cheng1-0/+4
llvm-svn: 131861
2011-04-15Fix a ton of comment typos found by codespell. Patch byChris Lattner1-2/+2
Luis Felipe Strano Moraes! llvm-svn: 129558
2011-04-02Don't assume something which might be a constant expression is an instruction.Eli Friedman1-3/+3
Based on PR9429, but no testcase because I can't figure out how to trigger it anymore given other changes to the relevant code. llvm-svn: 128781
2011-03-21Fix INT_MIN gotcha pointed out by Eli Friedman.Nick Lewycky1-3/+4
llvm-svn: 128028
2011-03-12Teach ComputeMaskedBits about sub nsw.Benjamin Kramer1-8/+16
llvm-svn: 127548
2011-03-11ComputeMaskedBits: sub falls through to add, and sub doesn't have the same ↵Benjamin Kramer1-1/+2
overflow semantics as add. Should fix the selfhost failures that started with r127463. llvm-svn: 127465
2011-03-11Teach ComputeMaskedBits about nsw on add. I don't think there's anything we canNick Lewycky1-0/+14
do with nuw here, but sub and mul should be given similar treatment. Fixes PR9343 #15! llvm-svn: 127463
2011-03-08Fix PR9331. Simplified version of a patch by Jakub Staszak.Duncan Sands1-0/+4
llvm-svn: 127243
2011-03-07Add more analysis of the sign bit of an srem instruction. If the LHS is negativeNick Lewycky1-0/+13
then the result could go either way. If it's provably positive then so is the srem. Fixes PR9343 #7! llvm-svn: 127146
2011-02-28Fix comment.Nick Lewycky1-1/+1
llvm-svn: 126645
2011-02-28srem doesn't actually have the same resulting sign as its numerator, you couldNick Lewycky1-12/+0
also have a zero when numerator = denominator. Reverts parts of r126635 and r126637. llvm-svn: 126644
2011-02-28Teach value tracking to make use of flags in more situations.Nick Lewycky1-0/+25
llvm-svn: 126642
2011-02-28Teach ValueTracking to look at the dividend when determining the sign bit of anNick Lewycky1-0/+12
srem instruction. llvm-svn: 126637
2011-02-19Stores of null pointers should turn into memset, we weren't recognizingChris Lattner1-0/+5
them as splat values. llvm-svn: 126041
2011-02-10Tolerate degenerate phi nodes that can occur in the middle of optimizationNick Lewycky1-0/+4
passes. Fixes PR9112. Patch by Jakub Staszak! llvm-svn: 125319
2011-02-01Add a m_SignBit pattern for convenience.Duncan Sands1-3/+1
llvm-svn: 124656
2011-01-29Fix typo: should have been testing that X was odd, not V.Duncan Sands1-3/+3
llvm-svn: 124533
2011-01-26APInt has a method for determining whether a number is a power of 2Duncan Sands1-1/+1
which is more efficient than countPopulation - use it. llvm-svn: 124283
2011-01-25In which I discover that zero+zero is zero, d'oh!Duncan Sands1-3/+3
llvm-svn: 124188
2011-01-25See if this fixes llvm-gcc bootstrap.Duncan Sands1-1/+2
llvm-svn: 124184
2011-01-25According to my auto-simplifier the most common missed simplifications inDuncan Sands1-1/+164
optimized code are: (non-negative number)+(power-of-two) != 0 -> true and (x | 1) != 0 -> true Instcombine knows about the second one of course, but only does it if X|1 has only one use. These fire thousands of times in the testsuite. llvm-svn: 124183
2011-01-24Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman1-3/+4
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
2011-01-04fix an off-by-one bug that caused a crash analyzingChris Lattner1-1/+1
ashr's with huge shift amounts, PR8896 llvm-svn: 122814
2010-12-26move isBytewiseValue out to ValueTracking.h/cppChris Lattner1-0/+69
llvm-svn: 122565
2010-12-17Add vector versions of some existing scalar transforms to aid codegen in ↵Nate Begeman1-0/+7
matching psign & pblend operations to the IR produced by clang/gcc for their C idioms. llvm-svn: 122105
2010-12-15Reapply r121886, and also update DecomposeGEPExpression to keepDan Gohman1-0/+8
it in sync. llvm-svn: 121895
2010-12-15Revert r121886. DecomposeGEPExpression needs to be keptDan Gohman1-8/+0
in sync. llvm-svn: 121892
2010-12-15Strengthen GetUnderlyingObject using InstructionSimplify.Dan Gohman1-0/+9
While LLVM's main design is that analysis code shouldn't go out of its way to understand code which hasn't been InstCombined, analysis utility routines like this can find themselves being called in the middle of transform passes when instcombine hasn't had a chance to run. llvm-svn: 121886
2010-12-15Move Value::getUnderlyingObject to be a standaloneDan Gohman1-0/+20
function so that it can live in Analysis instead of VMCore. llvm-svn: 121885
2010-12-07PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad1-12/+10
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121120
2010-12-01PR5207: Rename overloaded APInt methods set(), clear(), flip() toJay Foad1-11/+11
setAllBits(), setBit(unsigned), etc. llvm-svn: 120564
2010-11-30move GetPointerBaseWithConstantOffset out of GVN into ValueTracking.hChris Lattner1-0/+41
llvm-svn: 120476
2010-11-30PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.Jay Foad1-2/+3
llvm-svn: 120413
2010-09-05fix PR8063, a crash in globalopt in the malloc analysis code.Chris Lattner1-20/+29
llvm-svn: 113109
2010-08-18move gep decomposition out of ValueTracking into BasicAA. The form ofChris Lattner1-189/+0
decomposition that it is doing is very basicaa specific and is only used by basicaa. Now with less tree breakingness. llvm-svn: 111433
2010-08-18Revert r111375, "move gep decomposition out of ValueTracking into BasicAA. TheDaniel Dunbar1-0/+188
form of", it doesn't pass tests. llvm-svn: 111385
2010-08-18move gep decomposition out of ValueTracking into BasicAA. The form ofChris Lattner1-188/+0
decomposition that it is doing is very basicaa specific and is only used by basicaa. llvm-svn: 111375
2010-08-18fix PR7589: In brief:Chris Lattner1-3/+3
gep P, (zext x) != gep P, (sext x) DecomposeGEPExpression was getting this wrong, confusing basicaa. llvm-svn: 111352
2010-06-23use ArgOperand accessorsGabor Greif1-2/+2
llvm-svn: 106697
2010-04-16Revert 101465, it broke internal OpenGL testing.Eric Christopher1-2/+2
Probably the best way to know that all getOperand() calls have been handled is to replace that API instead of updating. llvm-svn: 101579
2010-04-16reapply r101434Gabor Greif1-2/+2
with a fix for self-hosting rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101465
2010-04-16back out r101423 and r101397, they break llvm-gcc self-host on darwin10Gabor Greif1-2/+2
llvm-svn: 101434
2010-04-15reapply r101364, which has been backed out in r101368Gabor Greif1-2/+2
with a fix rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101397
2010-04-15back out r101364, as it trips the linux nightlybot on some clang C++ testsGabor Greif1-2/+2
llvm-svn: 101368