Nadav Rotem
15198e94d2
Fix a crash in SimpliftDemandedBits of vectors of pointers.
...
PR14183.
llvm-svn: 166785
2012-10-26 17:17:05 +00:00
Nadav Rotem
8255ceb2cf
Revert 166726 because it may have broken a number of SPEC tests. PR14183.
...
llvm-svn: 166739
2012-10-25 23:51:48 +00:00
Nadav Rotem
bb4cfb5ee1
Fix a crash in ValueTracking. Add support for vectors of pointers.
...
llvm-svn: 166726
2012-10-25 21:52:52 +00:00
Micah Villmow
4bb926d91d
Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis.
...
llvm-svn: 165941
2012-10-15 16:24:29 +00:00
Micah Villmow
0c61134d8d
Revert 165732 for further review.
...
llvm-svn: 165747
2012-10-11 21:27:41 +00:00
Micah Villmow
083189730e
Add in the first iteration of support for llvm/clang/lldb to allow variable per address space pointer sizes to be optimized correctly.
...
llvm-svn: 165726
2012-10-11 17:21:41 +00:00
Micah Villmow
cdfe20b97f
Move TargetData to DataLayout.
...
llvm-svn: 165402
2012-10-08 16:38:25 +00:00
Duncan Sands
271ea6cdc5
The alignment of an sret parameter is known: it must be at least the
...
alignment of the return type. Teach the optimizers this.
llvm-svn: 165226
2012-10-04 13:36:31 +00:00
Sylvestre Ledru
91ce36c986
Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767
...
llvm-svn: 164768
2012-09-27 10:14:43 +00:00
Sylvestre Ledru
721cffd53a
Fix a typo 'iff' => 'if'
...
llvm-svn: 164767
2012-09-27 09:59:43 +00:00
Richard Smith
228e6d4cf3
Fix integer undefined behavior due to signed left shift overflow in LLVM.
...
Reviewed offline by chandlerc.
llvm-svn: 162623
2012-08-24 23:29:28 +00:00
Nuno Lopes
0d44a50426
PHINode::hasConstantValue(): return undef if the PHI is fully recursive.
...
Thanks Duncan for the idea
llvm-svn: 159687
2012-07-03 21:15:40 +00:00
Dan Gohman
ed7c24e2d9
Teach DeadStoreElimination to eliminate exit-block stores with phi addresses.
...
llvm-svn: 156558
2012-05-10 18:57:38 +00:00
Duncan Sands
34c4869cf6
Just mark the sign bit as known zero, rather than any other irrelevant bits
...
known zero in the LHS. Fixes PR12541.
llvm-svn: 155818
2012-04-30 11:56:58 +00:00
Chandler Carruth
28192c9398
Fix ValueTracking to conclude that debug intrinsics are safe to
...
speculate. Without this, loop rotate (among many other places) would
suddenly stop working in the presence of debug info. I found this
looking at loop rotate, and have augmented its tests with a reduction
out of a very hot loop in yacr2 where failing to do this rotation costs
sometimes more than 10% in runtime performance, perturbing numerous
downstream optimizations.
This should have no impact on performance without debug info, but the
change in performance when debug info is enabled can be extreme. As
a consequence (and this how I got to this yak) any profiling of
performance problems should be treated with deep suspicion -- they may
have been wildly innacurate of debug info was enabled for profiling. =/
Just a heads up.
llvm-svn: 154263
2012-04-07 19:22:18 +00:00
Rafael Espindola
ba0a6cabb8
Always compute all the bits in ComputeMaskedBits.
...
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
2012-04-04 12:51:34 +00:00
Rafael Espindola
80c540e656
Teach CodeGen's version of computeMaskedBits to understand the range metadata.
...
This is the CodeGen equivalent of r153747. I tested that there is not noticeable
performance difference with any combination of -O0/-O2 /-g when compiling
gcc as a single compilation unit.
llvm-svn: 153817
2012-03-31 18:14:00 +00:00
Rafael Espindola
53190539db
Add computeMaskedBitsLoad back, as it was the change to instsimplify that
...
caused the slowdown last time.
llvm-svn: 153747
2012-03-30 15:52:11 +00:00
Chad Rosier
e27081d348
Revert r153521 as it's causing large regressions on the nightly testers.
...
Original commit message for r153521 (aka r153423):
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loding a boolean value.
llvm-svn: 153587
2012-03-28 18:42:50 +00:00
Chad Rosier
8e6dbccd03
Reapply r153423; the original commit was fine. The failing test, distray, had
...
undefined behavior, which Rafael was kind enough to fix.
Original commit message for r153423:
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loding a boolean value.
llvm-svn: 153521
2012-03-27 17:44:52 +00:00
Chad Rosier
08e57e5ccf
Revert r153423 as this is causing failures on our internal nightly testers.
...
Original commit message:
Use the new range metadata in computeMaskedBits and add a new optimization to
instruction simplify that lets us remove an and when loading a boolean value.
llvm-svn: 153452
2012-03-26 18:07:14 +00:00
Rafael Espindola
df9b4adb82
Use the new range metadata in computeMaskedBits and add a new optimization to
...
instruction simplify that lets us remove an and when loding a boolean value.
llvm-svn: 153423
2012-03-26 01:44:11 +00:00
Nick Lewycky
fa30607eca
Factor out the multiply analysis code in ComputeMaskedBits and apply it to the
...
overflow checking multiply intrinsic as well.
Add a test for this, updating the test from grep to FileCheck.
llvm-svn: 153028
2012-03-18 23:28:48 +00:00
Nick Lewycky
fea3e00e09
Factor out the analysis of addition and subtraction in ComputeMaskedBits. Reuse
...
it to analyze extractvalue(llvm.[us](add|sub).with.overflow.*) intrinsics!
llvm-svn: 152398
2012-03-09 09:23:50 +00:00
Nick Lewycky
1d57ee341a
No functionality change. Type::isSized() can be expensive, so avoid calling it
...
until after other inexpensive tests.
llvm-svn: 152195
2012-03-07 02:27:53 +00:00
Eli Friedman
af3c6fe51e
A few more cases of missing masking in ComputeMaskedBits; found by inspection.
...
llvm-svn: 152070
2012-03-05 23:22:40 +00:00
Eli Friedman
a8b75ac798
Make sure we don't return bits outside the mask in ComputeMaskedBits. PR12189.
...
llvm-svn: 152066
2012-03-05 23:09:40 +00:00
Chris Lattner
8213c8af29
Remove some dead code and tidy things up now that vectors use ConstantDataVector
...
instead of always using ConstantVector.
llvm-svn: 149912
2012-02-06 21:56:39 +00:00
Bill Wendling
0aef16afd5
[unwind removal] Remove all of the code for the dead 'unwind' instruction. There
...
were no 'unwind' instructions being generated before this, so this is in effect
a no-op.
llvm-svn: 149906
2012-02-06 21:44:22 +00:00
Chris Lattner
cf9e8f6968
reapply the patches reverted in r149470 that reenable ConstantDataArray,
...
but with a critical fix to the SelectionDAG code that optimizes copies
from strings into immediate stores: the previous code was stopping reading
string data at the first nul. Address this by adding a new argument to
llvm::getConstantStringInfo, preserving the behavior before the patch.
llvm-svn: 149800
2012-02-05 02:29:43 +00:00
Argyrios Kyrtzidis
17c981a45b
Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail.
...
These are:
r149348
r149351
r149352
r149354
r149356
r149357
r149361
r149362
r149364
r149365
llvm-svn: 149470
2012-02-01 04:51:17 +00:00
Chris Lattner
997348e9fe
remove the last vestiges of llvm::GetConstantStringInfo, in CodeGen.
...
llvm-svn: 149356
2012-01-31 05:09:17 +00:00
Chris Lattner
108423a94a
Change ConstantArray::get to form a ConstantDataArray when possible,
...
kicking in the big win of ConstantDataArray. As part of this, change
the implementation of GetConstantStringInfo in ValueTracking to work
with ConstantDataArray (and not ConstantArray) making it dramatically,
amazingly, more efficient in the process and renaming it to
getConstantStringInfo.
This keeps around a GetConstantStringInfo entrypoint that (grossly)
forwards to getConstantStringInfo and constructs the std::string
required, but existing clients should move over to
getConstantStringInfo instead.
llvm-svn: 149351
2012-01-31 04:42:22 +00:00
Chris Lattner
61a1d6cb81
progress making the world safe to ConstantDataVector. While
...
we're at it, allow PatternMatch's "neg" pattern to match integer
vector negations, and enhance ComputeNumSigned bits to handle
shl of vectors.
llvm-svn: 149082
2012-01-26 21:37:55 +00:00
Chris Lattner
6705883ad8
use Constant::getAggregateElement to simplify a bunch of code.
...
llvm-svn: 148934
2012-01-25 06:48:06 +00:00
Chris Lattner
9be59599b3
Use the right method to get the # elements in a CDS.
...
llvm-svn: 148897
2012-01-25 01:27:20 +00:00
Chris Lattner
f7eb543380
teach valuetracking about ConstantDataSequential
...
llvm-svn: 148790
2012-01-24 07:54:10 +00:00
Dan Gohman
7ac046a261
Generalize isSafeToSpeculativelyExecute to work on arbitrary
...
Values, rather than just Instructions, since it's interesting
for ConstantExprs too.
llvm-svn: 147560
2012-01-04 23:01:09 +00:00
Benjamin Kramer
9442cd01f6
PatternMatch: Introduce a matcher for instructions with the "exact" bit. Use it to simplify a few matchers.
...
llvm-svn: 147403
2012-01-01 17:55:30 +00:00
Benjamin Kramer
4ee5747fdd
ComputeMaskedBits: Make knownzero computation more aggressive for ctlz with undef zero.
...
unsigned foo(unsigned x) { return 31 - __builtin_clz(x); }
now compiles into a single "bsrl" instruction on x86.
llvm-svn: 147255
2011-12-24 17:31:46 +00:00
Nick Lewycky
b4039f633c
Make some intrinsics safe to speculatively execute.
...
llvm-svn: 147036
2011-12-21 05:52:02 +00:00
Dan Gohman
75d7d5e988
Move Instruction::isSafeToSpeculativelyExecute out of VMCore and
...
into Analysis as a standalone function, since there's no need for
it to be in VMCore. Also, update it to use isKnownNonZero and
other goodies available in Analysis, making it more precise,
enabling more aggressive optimization.
llvm-svn: 146610
2011-12-14 23:49:11 +00:00
Chad Rosier
8abf65a130
Probably not a good idea to convert a single vector load into a memcpy. We
...
don't do this now, but add a test case to prevent this from happening in the
future.
Additional test for rdar://9892684
llvm-svn: 145879
2011-12-06 00:19:08 +00:00
Nadav Rotem
3924cb0267
Add support for vectors of pointers.
...
llvm-svn: 145801
2011-12-05 06:29:09 +00:00
Duncan Sands
ca6f8ddbf8
Fix a theoretical problem (not seen in the wild): if different instances of a
...
weak variable are compiled by different compilers, such as GCC and LLVM, while
LLVM may increase the alignment to the preferred alignment there is no reason to
think that GCC will use anything more than the ABI alignment. Since it is the
GCC version that might end up in the final program (as the linkage is weak), it
is wrong to increase the alignment of loads from the global up to the preferred
alignment as the alignment might only be the ABI alignment.
Increasing alignment up to the ABI alignment might be OK, but I'm not totally
convinced that it is. It seems better to just leave the alignment of weak
globals alone.
llvm-svn: 145413
2011-11-29 18:26:38 +00:00
Eli Friedman
e7ab1a2f0f
Make SelectionDAG::InferPtrAlignment use llvm::ComputeMaskedBits instead of duplicating the logic for globals. Make llvm::ComputeMaskedBits handle GlobalVariables slightly more aggressively, to match what InferPtrAlignment knew how to do.
...
llvm-svn: 145304
2011-11-28 22:48:22 +00:00
Duncan Sands
81a2af12d6
Fix a crash in which a multiplication was being reported as being both negative
...
and positive: positive, because it could be directly computed to be positive;
negative, because the nsw flags means it is either negative or undefined (the
multiplication always overflowed).
llvm-svn: 145104
2011-11-23 16:26:47 +00:00
Duncan Sands
985ba6386d
A shift of a power of two is a power of two or zero.
...
For completeness - not spotted in the wild.
llvm-svn: 143211
2011-10-28 18:30:05 +00:00
Duncan Sands
7cb61e5a0e
Reapply commit 143028 with a fix: the problem was casting a ConstantExpr Mul
...
using BinaryOperator (which only works for instructions) when it should have
been a cast to OverflowingBinaryOperator (which also works for constants).
While there, correct a few other dubious looking uses of BinaryOperator.
Thanks to Chad Rosier for the testcase. Original commit message:
My super-optimizer noticed that we weren't folding this expression to
true: (x *nsw x) sgt 0, where x = (y | 1). This occurs in 464.h264ref.
llvm-svn: 143125
2011-10-27 19:16:21 +00:00
Bob Wilson
1455ce27e4
Revert Duncan's r143028 expression folding which appears to be the culprit
...
behind a compile failure on 483.xalancbmk.
llvm-svn: 143102
2011-10-27 15:47:25 +00:00
Duncan Sands
ba286d7c73
The maximum power of 2 dividing a power of 2 is itself. This occurs
...
in 403.gcc and was spotted by my super-optimizer.
llvm-svn: 143054
2011-10-26 20:55:21 +00:00
Duncan Sands
1d2bb9882d
My super-optimizer noticed that we weren't folding this expression to
...
true: (x *nsw x) sgt 0, where x = (y | 1). This occurs in 464.h264ref.
llvm-svn: 143028
2011-10-26 15:31:51 +00:00
Nick Lewycky
462098824f
"@string = constant i8 0" is a value i8* string of length zero. Analyze that
...
correctly in GetStringLength, fixing PR11181!
llvm-svn: 142558
2011-10-20 00:34:35 +00:00
Frits van Bommel
717d7edd3e
Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
...
Mostly mechanical with some manual reformatting.
llvm-svn: 135390
2011-07-18 12:00:32 +00:00
Chris Lattner
229907cd11
land David Blaikie's patch to de-constify Type, with a few tweaks.
...
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Jay Foad
57aa636794
Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.
...
llvm-svn: 135040
2011-07-13 10:26:04 +00:00
Nick Lewycky
3e334a42d7
Move onlyUsedByLifetimeMarkers to ValueTracking so that it can be used by other
...
passes as well.
llvm-svn: 133904
2011-06-27 04:20:45 +00:00
Chad Rosier
b362884ca9
Renamed llvm.x86.sse42.crc32 intrinsics; crc64 doesn't exist.
...
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-26 23:13:19 +00:00
Chris Lattner
83791ced7b
Teach valuetracking that byval arguments with a specified alignment are
...
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-23 00:03:39 +00:00
Evan Cheng
2a746bfe36
Teach ValueTracking about x86 crc32 intrinsics.
...
llvm-svn: 131861
2011-05-22 18:25:30 +00:00
Chris Lattner
0ab5e2cded
Fix a ton of comment typos found by codespell. Patch by
...
Luis Felipe Strano Moraes!
llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Eli Friedman
8baa2c7ad9
Don't assume something which might be a constant expression is an instruction.
...
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-04-02 22:11:56 +00:00
Nick Lewycky
f0469af63e
Fix INT_MIN gotcha pointed out by Eli Friedman.
...
llvm-svn: 128028
2011-03-21 21:40:32 +00:00
Benjamin Kramer
5acc751b6f
Teach ComputeMaskedBits about sub nsw.
...
llvm-svn: 127548
2011-03-12 17:18:11 +00:00
Benjamin Kramer
391a946fa9
ComputeMaskedBits: sub falls through to add, and sub doesn't have the same overflow semantics as add.
...
Should fix the selfhost failures that started with r127463.
llvm-svn: 127465
2011-03-11 14:46:49 +00:00
Nick Lewycky
cc79973856
Teach ComputeMaskedBits about nsw on add. I don't think there's anything we can
...
do with nuw here, but sub and mul should be given similar treatment.
Fixes PR9343 #15 !
llvm-svn: 127463
2011-03-11 09:00:19 +00:00
Duncan Sands
7dc3d47c34
Fix PR9331. Simplified version of a patch by Jakub Staszak.
...
llvm-svn: 127243
2011-03-08 12:39:03 +00:00
Nick Lewycky
e467979d0a
Add more analysis of the sign bit of an srem instruction. If the LHS is negative
...
then the result could go either way. If it's provably positive then so is the
srem. Fixes PR9343 #7 !
llvm-svn: 127146
2011-03-07 01:50:10 +00:00
Nick Lewycky
afe4a3062d
Fix comment.
...
llvm-svn: 126645
2011-02-28 09:18:11 +00:00
Nick Lewycky
66f4f22f7b
srem doesn't actually have the same resulting sign as its numerator, you could
...
also have a zero when numerator = denominator. Reverts parts of r126635 and
r126637.
llvm-svn: 126644
2011-02-28 09:17:39 +00:00
Nick Lewycky
c9aab8567b
Teach value tracking to make use of flags in more situations.
...
llvm-svn: 126642
2011-02-28 08:02:21 +00:00
Nick Lewycky
29dbbd12c1
Teach ValueTracking to look at the dividend when determining the sign bit of an
...
srem instruction.
llvm-svn: 126637
2011-02-28 06:52:12 +00:00
Chris Lattner
acf6b0776a
Stores of null pointers should turn into memset, we weren't recognizing
...
them as splat values.
llvm-svn: 126041
2011-02-19 19:35:49 +00:00
Nick Lewycky
ac0b62c277
Tolerate degenerate phi nodes that can occur in the middle of optimization
...
passes. Fixes PR9112. Patch by Jakub Staszak!
llvm-svn: 125319
2011-02-10 23:54:10 +00:00
Duncan Sands
4b397fcdc2
Add a m_SignBit pattern for convenience.
...
llvm-svn: 124656
2011-02-01 08:50:33 +00:00
Duncan Sands
2e9e4f1be3
Fix typo: should have been testing that X was odd, not V.
...
llvm-svn: 124533
2011-01-29 13:27:00 +00:00
Duncan Sands
8a33733228
APInt has a method for determining whether a number is a power of 2
...
which is more efficient than countPopulation - use it.
llvm-svn: 124283
2011-01-26 08:44:16 +00:00
Duncan Sands
9e9d5b25e2
In which I discover that zero+zero is zero, d'oh!
...
llvm-svn: 124188
2011-01-25 15:14:15 +00:00
Duncan Sands
fced7620f5
See if this fixes llvm-gcc bootstrap.
...
llvm-svn: 124184
2011-01-25 12:15:09 +00:00
Duncan Sands
d395108394
According to my auto-simplifier the most common missed simplifications in
...
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-25 09:38:29 +00:00
Dan Gohman
0f124e1987
Give GetUnderlyingObject a TargetData, to keep it in sync
...
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-24 18:53:32 +00:00
Chris Lattner
c86e67e110
fix an off-by-one bug that caused a crash analyzing
...
ashr's with huge shift amounts, PR8896
llvm-svn: 122814
2011-01-04 18:19:15 +00:00
Chris Lattner
9cb1035f94
move isBytewiseValue out to ValueTracking.h/cpp
...
llvm-svn: 122565
2010-12-26 20:15:01 +00:00
Nate Begeman
7aa18bf46a
Add vector versions of some existing scalar transforms to aid codegen in matching psign & pblend operations to the IR produced by clang/gcc for their C idioms.
...
llvm-svn: 122105
2010-12-17 23:12:19 +00:00
Dan Gohman
05b18f143f
Reapply r121886, and also update DecomposeGEPExpression to keep
...
it in sync.
llvm-svn: 121895
2010-12-15 20:49:55 +00:00
Dan Gohman
d02b65982e
Revert r121886. DecomposeGEPExpression needs to be kept
...
in sync.
llvm-svn: 121892
2010-12-15 20:39:25 +00:00
Dan Gohman
949ab7889c
Strengthen GetUnderlyingObject using InstructionSimplify.
...
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-15 20:10:26 +00:00
Dan Gohman
a4fcd2418d
Move Value::getUnderlyingObject to be a standalone
...
function so that it can live in Analysis instead of
VMCore.
llvm-svn: 121885
2010-12-15 20:02:24 +00:00
Jay Foad
583abbc4df
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
...
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-07 08:25:19 +00:00
Jay Foad
25a5e4ca1f
PR5207: Rename overloaded APInt methods set(), clear(), flip() to
...
setAllBits(), setBit(unsigned), etc.
llvm-svn: 120564
2010-12-01 08:53:58 +00:00
Chris Lattner
e28618de59
move GetPointerBaseWithConstantOffset out of GVN into ValueTracking.h
...
llvm-svn: 120476
2010-11-30 22:25:26 +00:00
Jay Foad
15084f085d
PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.
...
llvm-svn: 120413
2010-11-30 09:02:01 +00:00
Chris Lattner
72d283c826
fix PR8063, a crash in globalopt in the malloc analysis code.
...
llvm-svn: 113109
2010-09-05 17:20:46 +00:00
Chris Lattner
9f7500f57b
move gep decomposition out of ValueTracking into BasicAA. The form of
...
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-18 22:07:29 +00:00
Daniel Dunbar
fbeeb130d8
Revert r111375, "move gep decomposition out of ValueTracking into BasicAA. The
...
form of", it doesn't pass tests.
llvm-svn: 111385
2010-08-18 18:43:08 +00:00
Chris Lattner
54fe883203
move gep decomposition out of ValueTracking into BasicAA. The form of
...
decomposition that it is doing is very basicaa specific and is only used
by basicaa.
llvm-svn: 111375
2010-08-18 18:22:17 +00:00
Chris Lattner
a33edcb56c
fix PR7589: In brief:
...
gep P, (zext x) != gep P, (sext x)
DecomposeGEPExpression was getting this wrong, confusing
basicaa.
llvm-svn: 111352
2010-08-18 04:28:19 +00:00
Gabor Greif
1abbde3103
use ArgOperand accessors
...
llvm-svn: 106697
2010-06-23 23:38:07 +00:00
Eric Christopher
7258dcd77f
Revert 101465, it broke internal OpenGL testing.
...
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-16 23:37:20 +00:00
Gabor Greif
f375520f7b
reapply r101434
...
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-16 15:33:14 +00:00
Gabor Greif
403e9694f9
back out r101423 and r101397, they break llvm-gcc self-host on darwin10
...
llvm-svn: 101434
2010-04-16 01:16:20 +00:00
Gabor Greif
33ae80bff7
reapply r101364, which has been backed out in r101368
...
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-15 20:51:13 +00:00
Gabor Greif
9fd00c7d25
back out r101364, as it trips the linux nightlybot on some clang C++ tests
...
llvm-svn: 101368
2010-04-15 12:46:56 +00:00
Gabor Greif
aafd209632
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: 101364
2010-04-15 10:49:53 +00:00
Dan Gohman
0b4df0425f
Constify GetConstantStringInfo.
...
llvm-svn: 101298
2010-04-14 22:20:45 +00:00
Evan Cheng
2a65429671
Fix a typo in ValueTracking that's causing instcombine to delete needed shift instructions.
...
llvm-svn: 98416
2010-03-13 02:20:29 +00:00
Eric Christopher
4899cbc77d
Move GetStringLength and helper from SimplifyLibCalls to ValueTracking.
...
No functionality change.
llvm-svn: 97793
2010-03-05 06:58:57 +00:00
Duncan Sands
19d0b47b1f
There are two ways of checking for a given type, for example isa<PointerType>(T)
...
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Duncan Sands
9dff9bec31
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Duncan Sands
26cd6bd0b0
It looks like the changes to the SRem logic of SimplifyDemandedUseBits
...
(fix for PR6165) are needed here too.
llvm-svn: 94801
2010-01-29 06:18:37 +00:00
Chris Lattner
35d3b9dcd0
teach ComputeNumSignBits to look through PHI nodes.
...
llvm-svn: 92964
2010-01-07 23:44:37 +00:00
Benjamin Kramer
d2564e3afb
Move remaining stuff to the isInteger predicate.
...
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Chris Lattner
a3aef788ec
Fix GetConstantStringInfo to not look into MDString (it works on
...
real data, not metadata) and fix DbgInfoPrinter to not abuse
GetConstantStringInfo.
llvm-svn: 91444
2009-12-15 19:34:20 +00:00
Mon P Wang
bb3eac9e7a
Fixed an assertion failure for tracking sext of a vector of integers
...
llvm-svn: 90290
2009-12-02 04:59:58 +00:00
Chris Lattner
c7bc66dfc6
implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
...
way that getUnderlyingObject does it.
This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!'
assertion on sqlite3.
llvm-svn: 90038
2009-11-28 15:12:41 +00:00
Chris Lattner
8e62d0a93d
limit the recursion depth of GetLinearExpression. This
...
fixes a crash analyzing consumer-lame, which had an "%X = add %X, 1"
in unreachable code.
llvm-svn: 90000
2009-11-27 08:32:52 +00:00
Chris Lattner
1bf7ff704a
Implement PR1143 (at -m64) by making basicaa look through extensions. We
...
previously already handled it at -m32 because there were no i32->i64
extensions for addressing.
llvm-svn: 89959
2009-11-26 18:53:33 +00:00
Chris Lattner
d7cabea8ca
fix two transposed lines duncan caught and add an explanatory comment.
...
llvm-svn: 89958
2009-11-26 18:35:46 +00:00
Chris Lattner
9aa846956e
this todo is resolved.
...
llvm-svn: 89957
2009-11-26 17:14:10 +00:00
Chris Lattner
29f82a1465
move DecomposeGEPExpression out into ValueTracking.cpp
...
llvm-svn: 89956
2009-11-26 17:12:50 +00:00
Chris Lattner
4f0b47d9e7
remove some redundant braces
...
llvm-svn: 89912
2009-11-26 01:50:12 +00:00
Nick Lewycky
39dbfd3c58
Remove unused LLVMContext.
...
llvm-svn: 89642
2009-11-23 03:29:18 +00:00
Dan Gohman
6a976bbcb7
Simplify ComputeMultiple so that it doesn't depend on TargetData.
...
llvm-svn: 89175
2009-11-18 00:58:27 +00:00
Victor Hernandez
4744488e8d
Add ComputeMultiple() analysis function that recursively determines if a Value V is a multiple of unsigned Base
...
llvm-svn: 86675
2009-11-10 08:28:35 +00:00
Victor Hernandez
8acf2956b8
Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
...
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Victor Hernandez
a3aaf85e23
Remove MallocInst from LLVM Instructions.
...
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Dale Johannesen
f6a987b784
Handle sqrt in CannotBeNegativeZero. absf and absl
...
appear to be misspellings, removed in favor of fabs*.
llvm-svn: 82796
2009-09-25 20:54:50 +00:00
Dan Gohman
94262db4d4
Teach ValueTracking how to look through GlobalAliases. GlobalAliases are
...
not folded in the constant folder because the constant folder doesn't
simplify ConstantExpr operands.
llvm-svn: 81864
2009-09-15 16:14:44 +00:00
Chris Lattner
0cdbc7a2ca
fix ComputeMaskedBits handling of zext/sext/trunc to work with vectors.
...
This fixes PR4905
llvm-svn: 81174
2009-09-08 00:13:52 +00:00
Chris Lattner
4bc2825d0b
add some comments to describe the invariants.
...
llvm-svn: 81173
2009-09-08 00:06:16 +00:00
Torok Edwin
18e03dd70c
Fix DbgStopPointInst->getFileName/getDirectory, broken by the MDNodification in
...
r80406, and readd a -print-dbginfo test.
llvm-svn: 80778
2009-09-02 11:13:56 +00:00
Dan Gohman
05f11351ab
Handle TargetData with const.
...
llvm-svn: 80262
2009-08-27 17:51:25 +00:00
Dan Gohman
5d5bc6d000
Use hasDefinitiveInitializer() instead of testing the same thing
...
by hand, and fix a few places that were using hasInitializer() that
appear to depend on the initializer value.
llvm-svn: 79441
2009-08-19 18:20:44 +00:00
Dan Gohman
dea2358c68
Fix SimplifyLibcalls and ValueTracking to check mayBeOverridden
...
before performing optimizations based on constant string values.
llvm-svn: 79384
2009-08-19 00:11:12 +00:00
Owen Anderson
55f1c09e31
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Dan Gohman
a72f856aa4
Don't assume that external global variables are aligned at their preferred
...
alignment. Only the minimum alignment guaranteed by the ABI may be assumed.
llvm-svn: 78668
2009-08-11 15:50:03 +00:00
Dan Gohman
a6d0afcb74
Fix a bunch of namespace pollution.
...
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Owen Anderson
5a1acd9912
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
...
metadata related, which I'm waiting on to avoid conflicting with Devang.
llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson
b292b8ce70
Move more code back to 2.5 APIs.
...
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Daniel Dunbar
ca414c7cae
Remove Value::getNameLen
...
llvm-svn: 77148
2009-07-26 08:34:35 +00:00
Owen Anderson
47db941fd3
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Dan Gohman
80ca01c466
Add a new Operator class, for handling Instructions and ConstantExprs
...
in a convenient manner, factoring out some common code from
InstructionCombining and ValueTracking. Move the contents of
BinaryOperators.h into Operator.h and use Operator to generalize them
to support ConstantExprs as well as Instructions.
llvm-svn: 76232
2009-07-17 20:47:02 +00:00
Owen Anderson
38264b1554
"LLVMContext* " --> "LLVMContext *"
...
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Owen Anderson
f1f1743b2e
Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's through the ValueTracking API.
...
llvm-svn: 74873
2009-07-06 22:37:39 +00:00
Chris Lattner
edb8407f0c
do not try to analyze bitcasts from i64 to <2 x i32> in ComputedMaskedBits. While
...
we could do this, doing so requires adjusting the demanded mask and the code isn't
doing that yet. This fixes PR4495
llvm-svn: 74699
2009-07-02 16:04:08 +00:00
Dan Gohman
2636693a3c
Fix llvm::ComputeNumSignBits to handle pointer types
...
conservatively correctly, instead of aborting.
llvm-svn: 73908
2009-06-22 22:02:32 +00:00
Dan Gohman
7ccc52f131
Support vector casts in more places, fixing a variety of assertion
...
failures.
To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.
Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.
llvm-svn: 73431
2009-06-15 22:12:54 +00:00
Dan Gohman
a5b9645c4b
Split the Add, Sub, and Mul instruction opcodes into separate
...
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.
For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.
This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt
llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Dan Gohman
071156c19c
When the low bits of one operand of an add are zero, that number
...
of low bits of the other operand are preserved in the output.
llvm-svn: 72365
2009-05-24 18:02:35 +00:00
Dan Gohman
bf0002e7c1
Teach ValueTracking a new way to analyze PHI nodes, and and teach
...
Instcombine to be more aggressive about using SimplifyDemandedBits
on shift nodes. This allows a shift to be simplified to zero in the
included test case.
llvm-svn: 72204
2009-05-21 02:28:33 +00:00