Frits van Bommel
6c24f9c277
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
e1fe7061ce
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
88fb4f4597
Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.
...
llvm-svn: 135040
2011-07-13 10:26:04 +00:00
Nick Lewycky
4a0f5218f2
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
b87c4a6945
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
c277b19e97
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
a2e8770368
Teach ValueTracking about x86 crc32 intrinsics.
...
llvm-svn: 131861
2011-05-22 18:25:30 +00:00
Chris Lattner
0304b82f80
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
823b0d6c77
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
e8f6eb49ee
Fix INT_MIN gotcha pointed out by Eli Friedman.
...
llvm-svn: 128028
2011-03-21 21:40:32 +00:00
Benjamin Kramer
5986a24bae
Teach ComputeMaskedBits about sub nsw.
...
llvm-svn: 127548
2011-03-12 17:18:11 +00:00
Benjamin Kramer
d4ea449e7e
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
cf0e3e88df
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
41075b3ffb
Fix PR9331. Simplified version of a patch by Jakub Staszak.
...
llvm-svn: 127243
2011-03-08 12:39:03 +00:00
Nick Lewycky
2cbaf887bb
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
fe02856d37
Fix comment.
...
llvm-svn: 126645
2011-02-28 09:18:11 +00:00
Nick Lewycky
dcc97b5f44
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
dd5df7ef0a
Teach value tracking to make use of flags in more situations.
...
llvm-svn: 126642
2011-02-28 08:02:21 +00:00
Nick Lewycky
aa03b76c53
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
90786c35a5
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
6380885ba1
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
659237307a
Add a m_SignBit pattern for convenience.
...
llvm-svn: 124656
2011-02-01 08:50:33 +00:00
Duncan Sands
0587f785bf
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
803522ec6f
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
017a3d76f7
In which I discover that zero+zero is zero, d'oh!
...
llvm-svn: 124188
2011-01-25 15:14:15 +00:00
Duncan Sands
4d8a541ae2
See if this fixes llvm-gcc bootstrap.
...
llvm-svn: 124184
2011-01-25 12:15:09 +00:00
Duncan Sands
92b081bd42
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
db0dc19c04
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
dbb1b09731
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
c56d20aa48
move isBytewiseValue out to ValueTracking.h/cpp
...
llvm-svn: 122565
2010-12-26 20:15:01 +00:00
Nate Begeman
063d88d6fb
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
7c7b24af4d
Reapply r121886, and also update DecomposeGEPExpression to keep
...
it in sync.
llvm-svn: 121895
2010-12-15 20:49:55 +00:00
Dan Gohman
4f6b802044
Revert r121886. DecomposeGEPExpression needs to be kept
...
in sync.
llvm-svn: 121892
2010-12-15 20:39:25 +00:00
Dan Gohman
8b09daa387
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
295ba3ab26
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
79e18ed269
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
789e8ac4f7
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
58b829f94c
move GetPointerBaseWithConstantOffset out of GVN into ValueTracking.h
...
llvm-svn: 120476
2010-11-30 22:25:26 +00:00
Jay Foad
c663d7e4f6
PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.
...
llvm-svn: 120413
2010-11-30 09:02:01 +00:00
Chris Lattner
4dccd368f3
fix PR8063, a crash in globalopt in the malloc analysis code.
...
llvm-svn: 113109
2010-09-05 17:20:46 +00:00
Chris Lattner
bd80bd5d69
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
3d68ce9eeb
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
2d584f0b0e
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
49d0f29752
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
b86c04f740
use ArgOperand accessors
...
llvm-svn: 106697
2010-06-23 23:38:07 +00:00
Eric Christopher
e78496e5f1
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
e7d6812008
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
cd116e8c6a
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
2e18d34d80
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
6022150477
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