Commit Graph

6895 Commits

Author SHA1 Message Date
Dan Gohman
cdb7388233 Reorder some fields in SDNode. This avoids padding,
reducings its size from 80 to 72 on 64-bit hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:26:15 +00:00
Dan Gohman
94d7a5f815 Remove ScheduleDAG's SUnitMap altogether. Instead, use SDNode's NodeId
field, which is otherwise unused after instruction selection, as an index
into the SUnit array.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:18:17 +00:00
Dan Gohman
3627e34486 Add a priority queue class, which is a wrapper around std::priority_queue
and provides fairly efficient removal of arbitrary elements. Switch
ScheduleDAGRRList from std::set to this new priority queue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52582 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 18:35:25 +00:00
Dan Gohman
4c8c83022b Change ScheduleDAG's SUnitMap from DenseMap<SDNode*, vector<SUnit*> >
to DenseMap<SDNode*, SUnit*>, and adjust the way cloned SUnit nodes are
handled so that only the original node needs to be in the map.
This speeds up llc on 447.dealII.llvm.bc by about 2%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52576 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 15:52:51 +00:00
Evan Cheng
c3417609ae Undo spill weight tweak. Need to investigate the performance regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 06:45:54 +00:00
Duncan Sands
c8f88cc8c0 Add some methods for querying the nature of a
store, like the methods for loads (and neaten
those up a bit while there).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52547 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 18:34:30 +00:00
Dan Gohman
be20a88f53 Add an allnodes_size method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 16:03:16 +00:00
Gordon Henriksen
54227f6752 Add C binding for ExecutionEngine::addGlobalMapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 02:16:11 +00:00
Dan Gohman
65c6795af4 It's invalid to take the one-past-the-end address of a non-array
object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 00:49:21 +00:00
Owen Anderson
5678d6e8d3 Add an idx_iterator to the insertvalue and extractvalue instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:15:57 +00:00
Dan Gohman
e6807551cb The inline keyword goes before the return type. This fixes a compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52492 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 16:16:06 +00:00
Evan Cheng
bdf34bc12b Minor spiller tweak to unfavor reload into load/store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:16:17 +00:00
Dan Gohman
e24fa64d52 Move SCEVExpander::visitAddExpr out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 16:37:11 +00:00
Dan Gohman
cfeb6a4506 Move LSR's private isZero function to a public SCEV member
function, and make use of it in several places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 16:23:07 +00:00
Evan Cheng
ce049437d6 Add MachineRegisterInfo::use_empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 07:47:55 +00:00
Devang Patel
6d0cc55ef3 Check empty dominance frontier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52437 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 02:12:09 +00:00
Dan Gohman
44f6a2c951 Auto-upgrade code for multiple-value return statements. This code
isn't actually called yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52435 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 23:38:43 +00:00
Owen Anderson
26bb50ab48 Add an insertBefore method for attaching previously unattached instructions,
such as those created by clone(), to a basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52424 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 18:29:27 +00:00
Owen Anderson
2b7470eb54 Fix use of placement new to actually use an address.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 18:07:43 +00:00
Anton Korobeynikov
210539ebc4 Provide generic hooks for icache invalidation. Add PPC implementation.
Patch by Gary Benson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 17:30:05 +00:00
Matthijs Kooijman
de9256ad2e Forgot to commit the ValueTracking header file along with r52396.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 13:54:33 +00:00
Matthijs Kooijman
74fc4d9686 80 column fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52391 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 08:26:32 +00:00
Chris Lattner
ead0d88ad7 add a new -enable-value-prop flag for llcbeta, that enables propagation
of value info (sign/zero ext info) from one MBB to another.  This doesn't
handle much right now because of two limitations:

1) only handles zext/sext, not random bit propagation (no assert exists 
   for this)
2) doesn't handle phis.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 06:09:18 +00:00
Evan Cheng
4e444436f2 Horizontal-add instructions are not commutative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52363 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:16:24 +00:00
Gabor Greif
e98fc279e2 Move some documentation from the header file into ProgrammersManual. About to improve.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52360 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:06:12 +00:00
Evan Cheng
6bd9567a6a - Add "Commutative" property to intrinsics. This allows tblgen to generate the commuted variants for dagisel matching code.
- Mark lots of X86 intrinsics as "Commutative" to allow load folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 20:29:38 +00:00
Chris Lattner
e846db6675 Add a new flag that disables symbol lookup with dlsym when set. This allows
a JIT client to completely control symbol lookup with the LazyFunctionCreator
interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 17:44:14 +00:00
Matthijs Kooijman
9772891219 Make the InsertBefore argument to FindInsertedValue optional, so you can find an inserted value without modifying the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 13:28:31 +00:00
Matthijs Kooijman
0a7413dad8 Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 13:13:08 +00:00
Matthijs Kooijman
b23d5adbc8 Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. While
I'm at it, rename it to FindInsertedValue.

The only functional change is that newly created instructions are no longer
added to instcombine's worklist, but that is not really necessary anyway (and
I'll commit some improvements next that will completely remove the need).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 12:48:21 +00:00
Matthijs Kooijman
069f42a058 Add comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 12:20:05 +00:00
Duncan Sands
ad205a7687 Allow these transforms for types like i256 while
still excluding types like i1 (not byte sized)
and i120 (loading an i120 requires loading an i64,
an i32, an i16 and an i8, which is expensive). 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 08:14:38 +00:00
Evan Cheng
58dcb0e0cd Add option to commuteInstruction() which forces it to create a new (commuted) instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 07:33:11 +00:00
Chris Lattner
0ad4d9be03 add a const version of stripPointerCasts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:43:06 +00:00
Wojciech Matyjewicz
8a08769bad Fix PR2434. When scanning for exising binary operator to reuse don't
take into account the instrucion pointed by InsertPt. Thanks to it, 
returning the new value of InsertPt to the InsertBinop() caller can be 
avoided. The bug was, actually, in visitAddRecExpr() method which wasn't 
correctly handling changes of InsertPt. There shouldn't be any 
performance regression, as -gvn pass (run after -indvars) removes any 
redundant binops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 19:07:39 +00:00
Andrew Lenharth
507a58ac9b add missing atomic intrinsic from gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52270 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-14 05:48:15 +00:00
Duncan Sands
d4b9c17fb7 Disable some DAG combiner optimizations that may be
wrong for volatile loads and stores.  In fact this
is almost all of them!  There are three types of
problems: (1) it is wrong to change the width of
a volatile memory access.  These may be used to
do memory mapped i/o, in which case a load can have
an effect even if the result is not used.  Consider
loading an i32 but only using the lower 8 bits.  It
is wrong to change this into a load of an i8, because
you are no longer tickling the other three bytes.  It
is also unwise to make a load/store wider.  For
example, changing an i16 load into an i32 load is
wrong no matter how aligned things are, since the
fact of loading an additional 2 bytes can have
i/o side-effects.  (2) it is wrong to change the
number of volatile load/stores: they may be counted
by the hardware.  (3) it is wrong to change a volatile
load/store that requires one memory access into one
that requires several.  For example on x86-32, you
can store a double in one processor operation, but to
store an i64 requires two (two i32 stores).  In a
multi-threaded program you may want to bitcast an i64
to a double and store as a double because that will
occur atomically, and be indivisible to other threads.
So it would be wrong to convert the store-of-double
into a store of an i64, because this will become two
i32 stores - no longer atomic.  My policy here is
to say that the number of processor operations for
an illegal operation is undefined.  So it is alright
to change a store of an i64 (requires at least two
stores; but could be validly lowered to memcpy for
example) into a store of double (one processor op).
In short, if the new store is legal and has the same
size then I say that the transform is ok.  It would
also be possible to say that transforms are always
ok if before they were illegal, whether after they
are illegal or not, but that's more awkward to do
and I doubt it buys us anything much.
However this exposed an interesting thing - on x86-32
a store of i64 is considered legal!  That is because
operations are marked legal by default, regardless of
whether the type is legal or not.  In some ways this
is clever: before type legalization this means that
operations on illegal types are considered legal;
after type legalization there are no illegal types
so now operations are only legal if they really are.
But I consider this to be too cunning for mere mortals.
Better to do things explicitly by testing AfterLegalize.
So I have changed things so that operations with illegal
types are considered illegal - indeed they can never
map to a machine operation.  However this means that
the DAG combiner is more conservative because before
it was "accidentally" performing transforms where the
type was illegal because the operation was nonetheless
marked legal.  So in a few such places I added a check
on AfterLegalize, which I suppose was actually just
forgotten before.  This causes the DAG combiner to do
slightly more than it used to, which resulted in the X86
backend blowing up because it got a slightly surprising
node it wasn't expecting, so I tweaked it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 19:07:40 +00:00
Nick Lewycky
6f8abf929a Crash less. The i64 restriction in BinomialCoefficient caused some problems
with code that was expecting different bit widths for different values.

Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 04:38:55 +00:00
Evan Cheng
502a4f5162 Do not speculatively execute an instruction by hoisting it to its predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 21:15:59 +00:00
Duncan Sands
4c54067f67 If queried as to whether an operation is legal
for a particular MVT, return false if the type
is illegal rather than barfing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52229 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 09:01:30 +00:00
Gabor Greif
0039adb514 remove bogus comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 13:53:41 +00:00
Gabor Greif
37e5484004 op_iterator-ify dropAllReferences
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 11:45:26 +00:00
Duncan Sands
edfcf598fa Sometimes (rarely) nodes held in LegalizeTypes
maps can be deleted.  This happens when RAUW
replaces a node N with another equivalent node
E, deleting the first node.  Solve this by
adding (N, E) to ReplacedNodes, which is already
used to remap nodes to replacements.  This means
that deleted nodes are being allowed in maps,
which can be delicate: the memory may be reused
for a new node which might get confused with the
old deleted node pointer hanging around in the
maps, so detect this and flush out maps if it
occurs (ExpungeNode).  The expunging operation
is expensive, however it never occurs during
a llvm-gcc bootstrap or anywhere in the nightly
testsuite.  It occurs three times in "make check":
Alpha/illegal-element-type.ll,
PowerPC/illegal-element-type.ll and
X86/mmx-shift.ll.  If expunging proves to be too
expensive then there are other more complicated
ways of solving the problem.
In the normal case this patch adds the overhead
of a few more map lookups, which is hopefully
negligable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52214 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 11:42:12 +00:00
Duncan Sands
02703ba753 Small doc fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52190 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 20:54:01 +00:00
Duncan Sands
893076354a Various tweaks related to apint codegen. No functionality
change for non-funky-sized integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52151 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 15:48:25 +00:00
Duncan Sands
8eab8a2798 Remove some DAG combiner assumptions about sizes
of integer types.  Fix the isMask APInt method to
actually work (hopefully) rather than crashing
because it adds apints of different bitwidths.
It looks like isShiftedMask is also broken, but
I'm leaving that one to the APInt people (it is
not used anywhere).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 11:32:28 +00:00
Chris Lattner
d10e467ad9 Add a simple, but efficient, generic scoped hash table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52112 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 00:42:10 +00:00
Duncan Sands
8e4eb09b1e Remove comparison methods for MVT. The main cause
of apint codegen failure is the DAG combiner doing
the wrong thing because it was comparing MVT's using
< rather than comparing the number of bits.  Removing
the < method makes this mistake impossible to commit.
Instead, add helper methods for comparing bits and use
them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 20:54:56 +00:00
Gabor Greif
76aca6f38f get rid of ExtractValueInst::init's Value argument, it is already passed to the UnaryInstruction ctor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 21:06:32 +00:00
Gabor Greif
d4f268bdd4 make ExtractValueInst derived from UnaryInstruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 20:28:12 +00:00