Commit Graph

28585 Commits

Author SHA1 Message Date
Evan Cheng
eca24fba3f Teach TransferDeadness to delete truly dead instructions if they do not produce side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71606 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 23:07:00 +00:00
Jim Grosbach
c93f961874 correct register class for tADDspi to GPR since the register will always be SP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 22:30:18 +00:00
Bill Wendling
b877a1f545 More MSVC fixes -- class/struct conflicts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 21:55:29 +00:00
John Mosby
378553cb07 Restructure PEI code:
- moved shrink wrapping code from PrologEpilogInserter.cpp to
  new file ShrinkWrapping.cpp.

- moved PEI pass definition into new shared header PEI.h.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 20:33:29 +00:00
Jay Foad
e1e201416a Switch to using IRBuilder throughout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 20:27:44 +00:00
Evan Cheng
0af934eb64 80 col violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 20:17:52 +00:00
Evan Cheng
1ea7327845 Fixed a stack slot coloring with reg bug: do not update implicit use / def when doing forward / backward propagation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 18:31:57 +00:00
Bob Wilson
39bf051ec2 Fix up a few minor typos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 17:35:29 +00:00
Bob Wilson
8494526a23 Fix 80-col violations and remove trailing whitespace. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 17:09:30 +00:00
Sanjiv Gupta
2364cfeb54 Iterate over globals once and sectionize them into appropriate sections.
Later in asmprinter, go over thsese sections and print them.
Do not print empty sections.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 17:07:27 +00:00
Sanjiv Gupta
429185787a We do not need to create a label for external defs and decls,
just emit a comment for readability.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71544 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 06:52:41 +00:00
Sanjiv Gupta
ed4f4fbfba Mark mayLoad, mayStore for insns correctly and use them
to check if an insn is accessing memory during mem sel optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 04:30:38 +00:00
Bob Wilson
74b0ccc577 Fix pr4195: When iterating through predecessor blocks, break out of the loop
after finding the (unique) layout predecessor.  Sometimes a block may be listed
more than once, and processing it more than once in this loop can lead to
inconsistent values for FtTBB/FtFBB, since the AnalyzeBranch method does not
clear these values.  There's no point in continuing the loop regardless.
The testcase for this is reduced from the 2003-05-02-DependentPHI SingleSource
test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71536 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 03:48:10 +00:00
Dan Gohman
81db61a2e6 Factor the code for collecting IV users out of LSR into an IVUsers class,
and generalize it so that it can be used by IndVarSimplify. Implement the
base IndVarSimplify transformation code using IVUsers. This removes
TestOrigIVForWrap and associated code, as ScalarEvolution now has enough
builtin overflow detection and folding logic to handle all the same cases,
and more. Run "opt -iv-users -analyze -disable-output" on your favorite
loop for an example of what IVUsers does.

This lets IndVarSimplify eliminate IV casts and compute trip counts in
more cases. Also, this happens to finally fix the remaining testcases
in PR1301.

Now that IndVarSimplify is being more aggressive, it occasionally runs
into the problem where ScalarEvolutionExpander's code for avoiding
duplicate expansions makes it difficult to ensure that all expanded
instructions dominate all the instructions that will use them. As a
temporary measure, IndVarSimplify now uses a FixUsesBeforeDefs function
to fix up instructions inserted by SCEVExpander. Fortunately, this code
is contained, and can be easily removed once a more comprehensive
solution is available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 02:17:14 +00:00
Dan Gohman
efb9fbfdab When forgetting SCEVs for loop PHIs, don't forget SCEVUnknown values.
These values aren't analyzable, so they don't care if more information
about the loop trip count can be had. Also, SCEVUnknown is used for
a PHI while the PHI itself is being analyzed, so it needs to be left
in the Scalars map. This fixes a variety of subtle issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 01:27:58 +00:00
Dan Gohman
42a5875e10 Fix GetMinTrailingZeros for SCEVSignExtend and SCEVZeroExtendExpr to
return the correct value when the cast operand is all zeros. This ought
to be pretty rare, because it would mean that the regular SCEV folding
routines missed a case, though there are cases they might legitimately
miss. Also, it's unlikely anything currently using GetMinTrailingZeros
cares about this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71532 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 01:23:18 +00:00
Evan Cheng
6ed34918eb Avoid unneeded SIB byte encoding. Patch by Zoltan Varga.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 00:07:35 +00:00
Bill Wendling
bc12c2be18 - Record that the debug info is actually used so that the label folder doesn't
blast it away.
- Move InlineInfo bookkeeping to bookkeep the correct debug info object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 00:06:59 +00:00
Lang Hames
9c992f1141 Fixed PR4090.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71495 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 23:14:13 +00:00
Evan Cheng
5792f51e12 Teach LSR to optimize more loop exit compares, i.e. change them to use postinc iv value. Previously LSR would only optimize those which are in the loop latch block. However, if LSR can prove it is safe (and profitable), it's now possible to change those not in the latch blocks to use postinc values.
Also, if the compare is the only use, LSR would place the iv increment instruction before the compare instead in the latch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71485 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 22:33:01 +00:00
Dale Johannesen
bf06f6a6f1 Fix PR4188. TailMerging can't tolerate inexact
sucessor info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71478 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 21:54:13 +00:00
Evan Cheng
fb3bd472a1 Apply patch review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 20:53:52 +00:00
Jay Foad
8d730fbde5 Don't #include DerivedTypes.h from TargetData.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71468 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 19:38:09 +00:00
Dan Gohman
1f3be1a1fe Fix two wording errors that Duncan spotted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:51:16 +00:00
Evan Cheng
6afd198fd8 Unbreak non-debug build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71457 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:40:52 +00:00
Evan Cheng
ec51b58b1c Eliminate a compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71456 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:40:35 +00:00
Dan Gohman
4e3fdf2c0f When scalarizing a vector BITCAST, check whether the operand has vector
type, rather than assume that it does. If the operand is not vector, it
shouldn't be run through ScalarizeVectorOp. This fixes one of the
testcases in PR3886.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71453 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:30:42 +00:00
Dan Gohman
0d9bb68d6d LLVM has unaligned loads and stores now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71449 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:06:05 +00:00
Douglas Gregor
01746745f1 Add terminal width detection to llvm::sys::Process. This is needed to
fix Clang PRs 4148 and 4183.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71448 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:05:52 +00:00
Dan Gohman
5c8274b5e3 Upgrade this example to new-style syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:04:52 +00:00
Dan Gohman
3cd90a18bb Convert a subtract into a negate and an add when it helps x86
address folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:02:53 +00:00
Chris Lattner
32c5f17024 remove some done things: we have nocapture and SROA is smarter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71443 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 17:41:40 +00:00
Chris Lattner
d919a8bc8a add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 17:36:33 +00:00
Dale Johannesen
c1acc3f764 Reverse a loop that is counting up to a maximum to
count down to 0 instead, under very restricted
circumstances.  Adjust 4 testcases in which this
optimization fires.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71439 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 17:15:42 +00:00
John Mosby
b9cfbd94ab Shrink wrapping in PEI:
- reduces _static_ callee saved register spills
  and restores similar to Chow's original algorithm.
- iterative implementation with simple heuristic
  limits to mitigate compile time impact.
- handles placing spills/restores for multi-entry,
  multi-exit regions in the Machine CFG without
  splitting edges.
- passes test-suite in LLCBETA mode.

Added contains() method to ADT/SparseBitVector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 17:04:19 +00:00
Jay Foad
589b1efe1b Don't generate redundant casts of constant values when lowering calls to
memcpy, memmove and memset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 11:32:25 +00:00
Jay Foad
7524b59062 Change TargetData::getIntPtrType() to return an IntegerType instead of
just a Type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 11:13:47 +00:00
Sanjiv Gupta
e0b4b0e436 Fix more naming issues.
compiler libcalls start with .lib. now.
fixed section names.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71424 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 08:52:04 +00:00
Sanjiv Gupta
0608b49819 Detect calls to compiler intrinsics and emit an extern declarations
only for those. These extern declarations to intrinsics are currently 
being emitted at the bottom of generated .s file, which works fine with
gpasm(not sure about MPSAM though).
PIC16 linker generates errors for few cases (function-args/struct_args_5) if you do not include any
extern declarations (even if no intrinsics are being used), but that
needs to be fixed in the linker itself.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 06:01:38 +00:00
Bill Wendling
26e2de135c Needed #includes. Thanks Fritz van Bommel!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 23:27:41 +00:00
Bill Wendling
a5c8a4e4e6 This is a large rewrite of how Dwarf info for inlined functions is handled.
The DwarfWriter expects DbgScopes and DIEs to behave themselves according to
DwarfWriter's rules. However, inlined functions violate these rules. There are
two different types of DIEs associated with an inlined function: an abstract
instance, which has information about the original source code for the function
being inlined; and concrete instances, which are created for each place the
function was inlined and point back to the abstract instance.

This patch tries to stay true to this schema. It bypasses how regular DbgScopes
and DIEs are created and used when necessary. It provides special handling for
DIEs of abstract and concrete instances.

This doesn't take care of all of the problems with debug info for inlined
functions, but it's a step in the right direction. For one thing, llvm-gcc
generates wrong IR (it's missing some llvm.dbg intrinsics at the point where the
function's inlined) for this example:

#include <stdio.h>
static __inline__ __attribute__((always_inline))  int bar(int x) { return 4; }
void foo() {
  long long b = 1;
  int Y = bar(4);
  printf("%d\n", Y);
}

while clang generates correct IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 23:14:38 +00:00
Nick Lewycky
cb33799b9f Make MDNode use CallbackVH. Also change MDNode to store Value* instead of
Constant* in preperation of a future change to support holding non-Constants
in an MDNode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 20:57:05 +00:00
Sanjiv Gupta
af3fdb5dc4 Module iterator contains list of filescope functions as well, we don't need to emit and global declarations for them. This was working earlier and was broken during one of the recent commit for PIC16 naming.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 16:18:39 +00:00
Anton Korobeynikov
9c11d21d90 Add imm-reg and imm-mem patters for cmp on msp430
(imm is allowed to be source operand, not dest...)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71393 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 14:49:00 +00:00
Sanjiv Gupta
211f3624ef Changed lowering and asmprinter to use ABI Names class called PAN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 05:23:47 +00:00
Bill Wendling
c677fe5aba --- Reverse-merging r71370 into '.':
U    lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

Revert r71370.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71373 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 00:10:50 +00:00
Bill Wendling
e34b723d3e A debug function start was not being recorded when the optimization level wasn't
None. However, we were always recording the region end. There's no longer a good
reason for this code to be separated out between the different opt levels, as it
was doing pretty much the same thing anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 23:51:35 +00:00
Evan Cheng
5374405dc1 Oops. Don't forget to align single bb loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 19:18:01 +00:00
Eli Friedman
361e54d433 Allow scalar evolution to compute iteration counts for loops with a
pointer-based condition.  This fixes PR3171.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 12:32:42 +00:00
Eli Friedman
cea03cdb69 Remove a completed optimization. Add a potential optimization I ran
into.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 08:40:15 +00:00
Duncan Sands
777d2306b3 Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 07:06:46 +00:00
Sanjiv Gupta
09560f805e Use 16 bit arithmetic while retrieving the address of callee's frame during indirect function calls, and set pclath before every call to retrieve the frame address.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 05:11:19 +00:00
Evan Cheng
2d85052f2b Factor out code that optimize loop terminating condition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 01:08:24 +00:00
Dan Gohman
c63a62735b Don't attempt to handle unsized types in ScalarEvolution's GEP analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71302 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 00:14:52 +00:00
Evan Cheng
f045f80ba9 Enable loop bb placement optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71291 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 23:35:49 +00:00
Dan Gohman
b0285932ab Fix bogus overflow checks by replacing them with actual
overflow checks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 23:11:16 +00:00
Evan Cheng
82ae933e55 PPC::B and PPC::BCC's target operand may be an immediate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 23:09:25 +00:00
Mike Stump
1e8f072f19 Avoid warning in release-asserts build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 22:53:06 +00:00
Bill Wendling
6c4311dddb Mirror how Fast ISel determines if a region.end intrinsic is the end of an
inlined function or the end of a function. Before, this was never executing the
"inlined" version of the Record method.

This will become important once the inlined Dwarf writer patch lands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 21:14:49 +00:00
Dan Gohman
728c7f3059 Fold trunc casts into add-recurrence expressions, allowing the
add-recurrence to be exposed. Add a new SCEV folding rule to
help simplify expressions in the presence of these extra truncs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 21:03:19 +00:00
Bill Wendling
e688fafd38 Compute the offsets of the compile units. We need this so that when we emit a
concrete instance of an inlined function, we can get the actual address of the
abstract instance inside of the compile unit.

This isn't currently used, but will be by a future check-in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 21:03:15 +00:00
Dan Gohman
fb79160811 Fix another bug in r71252. This code supports GetElementPtr
constant exprs as well as instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:58:38 +00:00
Dan Gohman
6bce643c36 Add memoization for getSCEVAtScope results for instructions
which are not analyzed with SCEV techniques, which can require
brute-forcing through a large number of instructions. This
fixes a massive compile-time issue on 400.perlbench (in
particular, the loop in MD5Transform).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:47:27 +00:00
Dan Gohman
66a7e857aa Make the SCEV* form of getSCEVAtScope public, to allow ScalarEvolution
clients to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:38:54 +00:00
Bill Wendling
a9519579b7 Minor clean ups. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:38:02 +00:00
Dan Gohman
e810b0d430 Fix an error from r71252.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:36:47 +00:00
Bill Wendling
ad9c278338 Print out nicer dump info for DIDescriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:28:06 +00:00
Dan Gohman
26466c0eb3 Factor out the code for creating SCEVs for GEPs into a
separate function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:26:55 +00:00
Dan Gohman
185cf0395c Implement several new SCEV folding rules for UDiv SCEVs.
This fixes an old FIXME, and is needed by some upcoming changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:18:49 +00:00
Evan Cheng
0269d3cbf3 Don't align loop header unless the loop back edge is below the header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 19:01:44 +00:00
Anton Korobeynikov
c1c6ef8f74 Factor out cycle-finder code and make it generic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:51:58 +00:00
Anton Korobeynikov
d34167a4ab Do not emit bit tests if target does not support natively left shift
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:51:34 +00:00
Anton Korobeynikov
da4d2f63d8 Allow 8 bit select in custom inserter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:51:21 +00:00
Anton Korobeynikov
58c04e1496 Properly expand libcalls for urem / srem. Also make code more straightforward.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71238 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:51:08 +00:00
Anton Korobeynikov
fb3f84fe16 Typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71237 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:50:54 +00:00
Anton Korobeynikov
0616c3b678 Expand UREM / SREM into libcalls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71236 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:50:41 +00:00
Anton Korobeynikov
1cb0acee8a Add 8 bit select
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:50:26 +00:00
Chris Lattner
4992196322 Fix PR4152: asm constraint validation happens before dag combine, so we
need to work a bit to combine things like (x+c1+c2) into x+c3.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 18:23:14 +00:00
Chris Lattner
ef554846f0 fix RewriteStoreUserOfWholeAlloca to use the correct type size
method, fixing a crash on PR4146.  While the store will 
ultimately overwrite the "padded size" number of bits in memory,
the stored value may be a subset of this size.  This function
only wants to handle the case where all bits are stored.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 15:54:41 +00:00
Evan Cheng
4b7f7a6e1f Reverse branch condition only when there is a conditional branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71214 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 09:35:53 +00:00
Nick Lewycky
0ab2dcee5b Add explicit braces to disambiguate nested if/else. Removes a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 06:57:41 +00:00
Nick Lewycky
48f95ad971 This transform requires valid TargetData info. Wrap it in 'if (TD)' in
preparation for the day we use null TargetData when no target is specified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 06:47:37 +00:00
Evan Cheng
45e0010e14 Optimize code placement in loop to eliminate unconditional branches or move unconditional branch to the outside of the loop. e.g.
///       A:                                                                                                                                                                 
///       ...                                                                                                                                                                
///       <fallthrough to B>                                                                                                                                                 
///                                                                                                                                                                          
///       B:  --> loop header                                                                                                                                                
///       ...                                                                                                                                                                
///       jcc <cond> C, [exit]                                                                                                                                               
///                                                                                                                                                                          
///       C:                                                                                                                                                                 
///       ...                                                                                                                                                                
///       jmp B                                                                                                                                                              
///                                                                                                                                                                          
/// ==>                                                                                                                                                                      
///                                                                                                                                                                          
///       A:                                                                                                                                                                 
///       ...                                                                                                                                                                
///       jmp B                                                                                                                                                              
///                                                                                                                                                                          
///       C:  --> new loop header                                                                                                                                            
///       ...                                                                                                                                                                
///       <fallthough to B>                                                                                                                                                  
///                                                                                                                                                                          
///       B:                                                                                                                                                                 
///       ...                                                                                                                                                                
///       jcc <cond> C, [exit] 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 06:34:09 +00:00
Nick Lewycky
4a228864f2 Add missing #include for "strlen" which is used inline in this header. Fixes
build under gcc 4.3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 06:22:25 +00:00
Sanjiv Gupta
573eb5e573 Moved pic16 naming functions to correct place.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 04:50:14 +00:00
Eli Friedman
5877ad7e90 PR4123: don't crash when inlining a call which uses its own result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 00:22:04 +00:00
Bob Wilson
9d928c223f Fix pr4100. Do not remove no-op copies when they are dead. The register
scavenger gets confused about register liveness if it doesn't see them.
I'm not thrilled with this solution, but it only comes up when there are dead
copies in the code, which is something that hopefully doesn't happen much.

Here is what happens in pr4100: As shown in the following excerpt from the
debug output of llc, the source of a move gets reloaded from the stack,
inserting a new load instruction before the move.  Since that source operand
is a kill, the physical register is free to be reused for the destination
of the move.  The move ends up being a no-op, copying R3 to R3, so it is
deleted.  But, it leaves behind the load to reload %reg1028 into R3, and
that load is not updated to show that it's destination operand (R3) is dead.
The scavenger gets confused by that load because it thinks that R3 is live.

Starting RegAlloc of: %reg1025<def,dead> = MOVr %reg1028<kill>, 14, %reg0, %reg0
  Regs have values: 
  Reloading %reg1028 into R3
  Last use of R3[%reg1028], removing it from live set
  Assigning R3 to %reg1025
  Register R3 [%reg1025] is never used, removing it from live set

Alternative solutions might be either marking the load as dead, or zapping
the load along with the no-op copy.  I couldn't see an easy way to do
either of those, though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 23:47:03 +00:00
Bob Wilson
8d24f4124e Fix a comment (again).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 21:20:42 +00:00
Bob Wilson
e0f745b54e Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 21:19:45 +00:00
Dan Gohman
9a38e3e399 Revert 71165. It did more than just revert 71158 and it introduced
several regressions. The problem due to 71158 is now fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 19:46:24 +00:00
Dan Gohman
31e4c77fae Perform constant folding on operands of instructions with non-void
types, such as loads and calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71175 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 19:43:39 +00:00
Dan Gohman
a6b35e201f SCEVComplexityCompare's new code was missing SCEVUDivExpr. Implement
the SCEVUDivExpr case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71173 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 19:23:21 +00:00
Duncan Sands
1978426a94 Revert r70876 and add a testcase (@c7) showing the problem:
bits captured, but the pointer marked nocapture.  In fact
I now recall that this problem is why only readnone functions
returning void were considered before!  However keep a small
fix that was also in r70876: a readnone function returning
void can result in bits being captured if it unwinds, so
test for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 18:08:34 +00:00
Bill Wendling
5b8479c385 Temporarily revert r71158. It was causing a failure during a full bootstrap:
checking for bcopy... no
checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decUtility.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decNumber.o] Error 1
make[3]: *** [all-stage2-libdecnumber] Error 2
make[3]: *** Waiting for unfinished jobs....



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 17:26:14 +00:00
Dan Gohman
72861308d5 Make ScalarEvolution's GroupByComplexity more thorough. In addition
to sorting SCEVs by their kind, sort SCEVs of the same kind according
to their operands. This helps avoid things like (a+b) being a distinct
expression from (b+a).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:39:04 +00:00
Dan Gohman
6ee2f3d840 Trim unnecessary headers. Code in Analysis shouldn't use Transforms
headers due to library dependencies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:30:26 +00:00
Dan Gohman
704b6980b8 Constant-fold ptrtoint+add+inttoptr to gep when the pointer is an
array and the add is within range. This helps simplify expressions
expanded by ScalarEvolutionExpander.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:24:56 +00:00
Dan Gohman
ecb403a9d3 Factor out a common base class between SCEVCommutativeExpr and
SCEVAddRecExpr. This eliminates redundant code for visiting
all the operands of an expression.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:00:19 +00:00
Argyrios Kyrtzidis
cd76240f3d Move the tablegen-produced DebugLoc handling into a AsmWriter::processDebugLoc function.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71156 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 13:55:51 +00:00
Evan Cheng
7132e12ee5 Code refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 05:49:39 +00:00
Evan Cheng
bbf1db7213 Rename "loop aligner" pass to "code placement optimization" pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 05:42:24 +00:00
Evan Cheng
a9bb0675e5 Eliminate compiler warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 05:31:56 +00:00
Bill Wendling
2c1d7726f2 Just turn aggressive stack coloring off at -O3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 01:33:38 +00:00
Bill Wendling
d0c1f9c932 Temporarily revert r71010. It was causing massive failures during self-hosting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 01:27:25 +00:00
Argyrios Kyrtzidis
116b27444a Make DwarfWriter::RecordInlinedFnStart more like the other DwarfWriter's methods:
-Have it return a label ID
-Remove the unused Instruction parameter

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 00:16:31 +00:00
Dan Gohman
0a8eb57c3d Use stable_sort instead of plain sort to avoid the risk of generating
trivially different code on different hosts (due to differing
std::sort implementations).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71124 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 22:54:33 +00:00
Bill Wendling
3f500d9358 - Move some debug fields to coincide with how GCC emits them. No functionality
change.
- Reformatting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 21:21:34 +00:00
Oscar Fuentes
d5e8d821dd CMake: Updated lib/Target/PIC16/CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 20:40:05 +00:00
Dale Johannesen
43e91b9c2f Use X86AddrNumOperands instead of magic constant one
more place.  This fixes a bunch of x86-64 JIT regressions.
(Introduced when the value of the magic constant changed
in 68645.  At the time apparently nobody noticed; failures
were hidden in 70343-70439 by an unrelated bug, so showed
up again as "new" failures in 70440.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 19:04:30 +00:00
Evan Cheng
caab129cd1 Do not use register as base ptr of pre- and post- inc/dec load / store nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 18:25:01 +00:00
Evan Cheng
ee08da8956 Unbreak the build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 18:00:56 +00:00
David Greene
e19c840d6c Make sure to use signed arithmetic in APInt to fix a regression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 17:39:26 +00:00
Dan Gohman
e9d87f4906 Simplify code by using SmallVector's pop_back_val() instead of
separate back() and pop_back() calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 17:22:41 +00:00
Oscar Fuentes
5dcf50bd03 CMake: Updated lib/CodeGen/CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 14:56:40 +00:00
Duncan Sands
e149e9960b OCaml parameter attribute bindings from PR2752.
Incomplete, but better than nothing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 12:21:17 +00:00
Duncan Sands
a9cad0e7e0 Add generic expansion of SUB when ADD and XOR
are legal.  Based on a patch by Micah Villmow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 11:29:50 +00:00
Duncan Sands
cfd0ebea27 Fix PR3754: don't mark functions that wrap MallocInst with
the readnone.  Since MallocInst is scheduled for deletion
it doesn't seem worth doing anything more subtle, such as
having mayWriteToMemory return true for MallocInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 08:42:00 +00:00
Sanjiv Gupta
d8d27f4a4b Emit banksel and movlp instructions.
Split large global data (both initialized and un-initialized) into multiple sections of <= 80 bytes.
Provide routines to manage PIC16 ABI naming conventions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 08:02:01 +00:00
Duncan Sands
7af1c78b98 Allow readonly functions to unwind exceptions. Teach
the optimizers about this.  For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 06:49:50 +00:00
Lang Hames
87e3bcab73 Renamed Spiller classes (plus uses and related files) to VirtRegRewriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 02:36:21 +00:00
Dan Gohman
ce174f8e15 Fix a copy+pasto in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 23:02:38 +00:00
Dan Gohman
4221ae84ef Delete a FIXME which is no longer relevant, and add a FIXME that is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 22:59:55 +00:00
Evan Cheng
8f18edd8b6 Quotes should be printed before private prefix; some code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 22:50:29 +00:00
Bill Wendling
16de013640 Add dump method to DIDescriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 22:19:25 +00:00
Dan Gohman
5412d06e9c If a MachineBasicBlock has multiple ways of reaching another block,
allow it to have multiple CFG edges to that block. This is needed
to allow MachineBasicBlock::isOnlyReachableByFallthrough to work
correctly. This fixes PR4126.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 21:10:19 +00:00
Bill Wendling
a48941087b Temporarily reverting r71008. It was causing this failure:
Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/
CodeGen/X86/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/
CodeGen/X86/change-compare-stride-1.ll
Failed with exit(1) at line 2
while running: grep {cmpq       $-478,} change-compare-stride-1.ll.tmp
child process exited abnormally



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 20:49:46 +00:00
Evan Cheng
f9a9b51429 Enable stack coloring with regs at -O3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 20:30:36 +00:00
David Greene
58deef5559 Handle overflow of 64-bit loop conditions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71008 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 20:22:36 +00:00
Chris Lattner
1777d0c6c5 Add basic support for code generation of
addrspace(257) -> FS relative on x86.  Patch by Zoltan Varga!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 18:52:19 +00:00
Evan Cheng
ef1840173c Revert part of 70929 that has to do with determining whether a SIB byte is needed. It causes a lot of x86_64 JIT failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 18:18:57 +00:00
Chris Lattner
e3f6cea9e9 Do not require variable debug info nodes to have a compile unit.
For implicit decls like "self" and "_cmd" in ObjC, these decls
should not have a location.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 04:55:56 +00:00
Evan Cheng
bef60d3804 Do not substitute if the new register isn't in the register class of the operand being updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 00:46:16 +00:00
Evan Cheng
d923fc621f Move getInstrOperandRegClass from the scheduler to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 00:30:09 +00:00
Evan Cheng
c3806ea3bc Do forward and backward substitution to eliminate loads and stores when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 23:13:13 +00:00
Evan Cheng
b0030ddca4 - Avoid the longer SIB encoding on x86_64 when it's not needed.
- Synchronize instruction length computation code in X86InstrInfo with code in X86CodeEmitter.cpp
Patch by Zoltan Varga.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:49:16 +00:00
Dan Gohman
35738ac150 Re-apply 70645, converting ScalarEvolution to use
CallbackVH, with fixes. allUsesReplacedWith need to
walk the def-use chains and invalidate all users of a
value that is replaced. SCEVs of users need to be
recalcualted even if the new value is equivalent. Also,
make forgetLoopPHIs walk def-use chains, since any
SCEV that depends on a PHI should be recalculated when
more information about that PHI becomes available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:30:44 +00:00
Dan Gohman
bf2176a000 Fix an 80-column violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:23:18 +00:00
Dan Gohman
92fa56eb58 Fix doxygen comment syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:20:30 +00:00
Chris Lattner
af29a5235d Make DBG_STOPPOINT nodes, and therefore DBG_LABEL labels, get a DebugLoc, so that it
shows up in -print-machineinstrs.  This doesn't appear to affect anything, but it was
weird for some DBG_LABELs to have DebugLocs but not all of them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:10:05 +00:00
Dan Gohman
622ed671b9 Constify a bunch of SCEV-using code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70919 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:02:23 +00:00
Dan Gohman
7d04e4a7c0 X86FastISel doesn't support the -tailcallopt ABI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 19:50:33 +00:00
Argyrios Kyrtzidis
28f1412c97 Restore a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 19:23:45 +00:00
Anton Korobeynikov
cffb5284f1 Fix code emission for conditional branches.
Patch by Collin Winter!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 19:10:38 +00:00
Mike Stump
fe095f39e7 Restore minor deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 18:40:41 +00:00
Evan Cheng
04fa35ab13 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70792 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 19:10:11 +00:00
Evan Cheng
c781a243a3 In some rare cases, the register allocator can spill registers but end up not utilizing registers at all. The fundamental problem is linearscan's backtracking can end up freeing more than one allocated registers. However, reloads and restores might be folded into uses / defs and freed registers might not be used at all.
VirtRegMap keeps track of allocations so it knows what's not used. As a horrible hack, the stack coloring can color spill slots with *free* registers. That is, it replace reload and spills with copies from and to the free register. It unfold instructions that load and store the spill slot and replace them with register using variants.

Not yet enabled. This is part 1. More coming.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 18:32:42 +00:00
Anton Korobeynikov
87e3caf819 Handle implicit zext in a better way. Shamelessly stolen from x86 backend.
Thanks for Dan Gohman for suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 15:50:18 +00:00
Anton Korobeynikov
9fe9c8ec7d Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:19:57 +00:00
Anton Korobeynikov
60871cb40c Update due to mainline API change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70769 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:19:42 +00:00
Anton Korobeynikov
7594884648 Add TODO list :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70768 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:19:24 +00:00
Anton Korobeynikov
1bb8cd723d Make handling of conditional stuff much more straightforward
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:19:09 +00:00
Anton Korobeynikov
1fcfb6b6d2 Temporary disable imm patterns for cmp. Actually, all cmp-related stuff (select_cc, setcc, br_cc). needs to be rethought
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70766 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:18:50 +00:00
Anton Korobeynikov
f2f540261b Expand divisions into libcalls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70765 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:18:33 +00:00
Anton Korobeynikov
813090cf89 Properly handle sdiv / udiv / srem / urem libcalls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:18:16 +00:00
Anton Korobeynikov
b78e214274 Custom lower SIGN_EXTEND
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70763 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:17:49 +00:00
Anton Korobeynikov
1394db0eeb Some eye-candy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70762 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:17:31 +00:00
Anton Korobeynikov
6130fc8ea3 Print function header / footer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:17:11 +00:00
Anton Korobeynikov
d9e89f6ea4 Fix printing: je => jeq
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:16:54 +00:00
Anton Korobeynikov
bf8ef3f29d Add 8bit shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:16:37 +00:00
Anton Korobeynikov
e699d0f549 Handle logical shift right (at least I hope so :) )
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:16:17 +00:00
Anton Korobeynikov
e375a7c768 Handle anyext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:15:57 +00:00
Anton Korobeynikov
0dbf292f68 Expand all sorts of indirect branches
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:15:40 +00:00
Anton Korobeynikov
8644af3690 Add InsertBranch() hook for tail mergeing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:15:22 +00:00
Anton Korobeynikov
49ebc22784 Implement bswap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70753 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:15:03 +00:00
Anton Korobeynikov
5d59f68ade Properly handle ExternalSymbol's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70752 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:14:46 +00:00
Anton Korobeynikov
8725bd22bf Expand muls (all mulls!) to libcalls for now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:14:25 +00:00
Anton Korobeynikov
c31642f7af Proper name 16 bit libcalls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:14:08 +00:00
Anton Korobeynikov
2f25c2c63f Add libcall expansion for 16 and 128 bit muls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70749 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:13:51 +00:00
Anton Korobeynikov
b8f03c9578 Provide addc and subc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:13:34 +00:00
Anton Korobeynikov
ea54c9846b Add left shift
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:13:17 +00:00
Anton Korobeynikov
824d8ddae8 Add direct branch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70746 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:12:58 +00:00
Anton Korobeynikov
0af5af823b It's error-prone to maintain two separate variants of asmprinting stuff, one of which is even used. Drop second (aka 'intel') variant of operands. It can be added later, if needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:12:37 +00:00
Anton Korobeynikov
8b528e52ee Lower select with custom inserted and make condjumps generic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:12:23 +00:00
Anton Korobeynikov
ed1a51af37 Add first draft for conditions, conditional branches, etc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:12:06 +00:00
Anton Korobeynikov
6e4f62790b Hanle i8 returns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:11:48 +00:00
Anton Korobeynikov
c08163e72d Small tweaking
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70741 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:11:35 +00:00
Anton Korobeynikov
ce45d30fa1 Add prologue/epilogue emission. Fix frame pointer handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:11:20 +00:00
Anton Korobeynikov
d5047cb9f7 Add code for save/restore of callee-saved registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:11:04 +00:00
Anton Korobeynikov
875e1eb8ab Two more hooks for RA and FP registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70738 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:10:40 +00:00
Anton Korobeynikov
40477317f3 Proper handle loading of effective address of stack slot stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:10:26 +00:00
Anton Korobeynikov
82e46c2595 Match frame indexes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70736 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:10:11 +00:00
Anton Korobeynikov
aa29915b58 First draft of stack slot loads / stores lowering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:09:57 +00:00
Anton Korobeynikov
cf14ae5500 Reverse order of memory arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70734 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:09:40 +00:00
Anton Korobeynikov
aecfa7897f Remove bogus pattern
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:09:24 +00:00
Anton Korobeynikov
1deea5f3a7 Correct asmprinting of memory operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:09:10 +00:00
Anton Korobeynikov
0eb6af40e3 Match wrapper node for address
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:08:51 +00:00
Anton Korobeynikov
3513ca81c6 Add lowering for global address nodes. Not pretty efficient though.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70730 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:08:33 +00:00
Anton Korobeynikov
3c2684d136 Some early full call lowering draft for direct calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:08:13 +00:00
Anton Korobeynikov
b561264d2b Add call frame setup instruction elimination and lowerid for bunch of call-related stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:07:54 +00:00
Anton Korobeynikov
4428885c5a Add CALL lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70727 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:07:31 +00:00
Anton Korobeynikov
01e0e8d119 Add bunch of mem-whatever patterns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:07:10 +00:00
Anton Korobeynikov
2682bf5979 Add bunch of reg-mem inst patterns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:06:46 +00:00
Anton Korobeynikov
54f30d3fc9 Add normal and trunc stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:06:26 +00:00
Anton Korobeynikov
36b6e533c1 Basic support for mem=>reg moves
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70723 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:06:03 +00:00
Anton Korobeynikov
51c31d6888 Add 8-bit insts. zext behaviour is not modelled yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:05:42 +00:00
Anton Korobeynikov
cf9adf2cbb Add 8-bit regclass and pattern for sext_inreg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:05:22 +00:00
Anton Korobeynikov
0fc32dae8f Add pattern for OR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70720 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:05:00 +00:00
Anton Korobeynikov
6ee626a1c1 Add reg-imm variants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:04:41 +00:00
Anton Korobeynikov
c8166ac760 Add hint to nop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70718 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:04:23 +00:00
Anton Korobeynikov
0ba0a89c6b Add more instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 13:04:06 +00:00