Commit Graph

23393 Commits

Author SHA1 Message Date
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
Gabor Greif
52ed363fd3 fix a minor deviation from the original in my previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52247 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 21:51:29 +00:00
Gabor Greif
177dd3ff11 op_iterator-ify some loops, low hanging fruit only, there is more
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 21:37:33 +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
Evan Cheng
0d0ca8572f Revert 52223.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52243 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 20:55:39 +00:00
Owen Anderson
af4240ac2d Switch GVN to use ScopedHashTable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 19:25:32 +00:00
Matthijs Kooijman
cf45ca0408 Fix redirection of stderr in sys::Program::ExecuteAndWait. There was logic
error that caused it to redirect stderr to stdout too often.

This fix is applied identically to the win32 code as well, but that is
untested.
--Thi line, and those below, will be ignored--

M    System/Unix/Program.inc
M    System/Win32/Program.inc


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 12:53:35 +00:00
Matthijs Kooijman
905261efed Make I/O redirection handling in sys::Program a bit more consistent. No
functional changes. Win32 code is untested, but should work fine.

In the unix variant, rename RedirectFD to RedirectIO and let that function
handle empty and null paths instead of doing that in the caller 3 times. This
is the same as win32 already does it.

In the win32 variant, use Path::isEmpty() instead of checking the resulting
c_str() manually. This is the same as unix already does it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 10:47:18 +00:00
Gabor Greif
6725cb5f1c op_iterator-ify some loops, fix 80col violations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 21:38:51 +00:00
Anton Korobeynikov
096b461b2e Properly lower DYNAMIC_STACKALLOC - bracket all black magic with
CALLSEQ_BEGIN & CALLSEQ_END.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52225 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 20:16:42 +00:00
Evan Cheng
797d95188d For now, avoid generating FP select instructions in order to speculatively execute integer arithmetic instructions. FP selects are more likely to be expensive (even compared to branch on fcmp). This is not a wonderful solution but I rather err on the side of conservative.
This fixes the heapsort performance regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 19:18:20 +00:00
Evan Cheng
bb318c073e Avoid duplicating loop header which leads to unnatural loops (and just seem like general badness to me, likely to cause code explosion).
Patch by Florian Brandner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 19:07:54 +00:00
Matthijs Kooijman
a9012eca1a Teach instruction combining about the extractvalue. It can succesfully fold
useless insert-extract chains, similar to how it folds them for vectors.

Add a testcase for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 14:05:05 +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
Gordon Henriksen
a068fd32e2 Better test for availability of __gnu_cxx::stdio_filebuf.
If this doesn't work, I'll write a configure test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52213 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 10:46:24 +00:00
Matthijs Kooijman
b4d6a5a76c Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 09:00:12 +00:00
Gabor Greif
f7ea3638e0 op_iterator-ify loops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 22:03:26 +00:00
Dan Gohman
9ea3f56d07 Teach isGAPlusOffset to respect a GlobalAddressSDNode's offset
value, which is something that apparently isn't used much.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 22:05:52 +00:00
Dan Gohman
7dc1def162 Re-apply 52002, allowing the verifier to accept non-MRV struct return
types on functions, with adjustments so that it accepts both
new-style aggregate returns and old-style MRV returns, including those
with only a single member.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:26:13 +00:00
Dan Gohman
f5025cfa68 CodeGen support for aggregate-value function arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:19:23 +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
Dan Gohman
8a6ccb5f73 Handle empty aggregate values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 15:21:47 +00:00
Dan Gohman
f910eaaddd AsmParser support for immediate constant aggregate values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52149 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:45:02 +00:00
Dan Gohman
75146a6725 CPPBackend support for extractvalue and insertvalue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52147 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:12:10 +00:00
Dan Gohman
26825a84e9 Abort on an unrecognized opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:09:13 +00:00
Dan Gohman
e8e3b5585a Update the CPP backend for the ConstantFP::get API change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52144 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:08:11 +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
Rafael Espindola
d674b4e87d add support for PIC on linux x86-64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 09:52:31 +00:00
Chris Lattner
313f0e63f7 lower calls to abs to inline code, PR2337
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 08:26:51 +00:00
Chris Lattner
18d73c206e Fix PR2411, where ip constant prop would propagate the
result of a weak function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:58:07 +00:00
Chris Lattner
822143e6f7 use 'continue' to make the function linker simpler. When linking a strong
function into a weak function, zap the weak function body so that the
strong one overrides it.  This fixes PR2410


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:47:34 +00:00
Chris Lattner
8246849829 minor changes to short circuit the 'no linkage' case earlier for
function bodies.  We now don't try to unify types or handling type
mismatches if when linking an internal foo to an external foo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:36:11 +00:00
Chris Lattner
bc3d1c7e4c simplify function visibility handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:25:28 +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
Chris Lattner
7d8ab4efbc Limit the icmp+phi merging optimization to the cases where it is profitable:
don't make i1 phis when it won't be possible to eliminate them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 20:52:11 +00:00
Bruno Cardoso Lopes
e90ea5e81f Added FP instruction formats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 01:39:36 +00:00
Bill Wendling
a8a8f427d6 Temporarily reverting r52056. It's causing PPC to fail to bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 01:36:24 +00:00
Bruno Cardoso Lopes
dfac7cb306 Added support for FP Registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 21:32:41 +00:00
Evan Cheng
4d09efd7b8 Speculatively execute a block when the the block is the then part of a triangle shape and it contains a single, side effect free, cheap instruction. The branch is eliminated by adding a select instruction. i.e.
Turn                                                                                                                                                                                                       
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    br i1 %t1, label %BB1, label %BB2                                                                                                                                                                      
BB1:                                                                                                                                                                                                       
    %t3 = add %t2, c                                                                                                                                                                                       
    br label BB2                                                                                                                                                                                           
BB2:                                                                                                                                                                                                       
=>                                                                                                                                                                                                         
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    %t4 = add %t2, c                                                                                                                                                                                       
    %t3 = select i1 %t1, %t2, %t3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52073 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 08:52:29 +00:00
Evan Cheng
3e3aa86b68 Revert r52046. It broke cbe on x86 / Mac OS X.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 07:50:29 +00:00
Dan Gohman
1d685a46bf CodeGen support for insertvalue and extractvalue, and for loads and
stores of aggregate values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 02:02:36 +00:00
Owen Anderson
2d389e8ad7 Connect successors before creating the DAG node for the branch. This has
no visible functionality change, but enables a future patch where node creation
will update the CFG if it decides to create an unconditional rather than a conditional branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 00:00:23 +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
Evan Cheng
929b39f0a0 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 21:00:10 +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
Evan Cheng
877333b99d Enable stack coloring by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 19:52:44 +00:00
Evan Cheng
6b4a65f4e7 PPC preferred loop alignment is 16.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 19:50:46 +00:00
Devang Patel
4c37c07ee3 LoopSimplify preserves AA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 17:50:58 +00:00
Devang Patel
8fb6a94b69 Print debug message only if there are dead passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 17:50:36 +00:00
Anton Korobeynikov
001c73e3a1 Handle assembler identifiers specially in CBE. This fixes PR2418.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 16:08:26 +00:00