Commit Graph

5877 Commits

Author SHA1 Message Date
Evan Cheng f713722975 For now, don't split live intervals around x87 stack register barriers. FpGET_ST0_80 must be right after a call instruction (and ADJCALLSTACKUP) so we need to find a way to prevent reload of x87 registers between them.
llvm-svn: 58230
2008-10-27 07:14:50 +00:00
Chris Lattner a9642ff459 no need to print output
llvm-svn: 58228
2008-10-27 06:56:35 +00:00
Chris Lattner a43f2b21e7 remove eh output from this test.
llvm-svn: 58196
2008-10-26 18:53:07 +00:00
Evan Cheng ed033ede22 Do not shrink wrap live interval in a mbb if it's livein any of its successor blocks. The mbb can be revisited again after all of the successors are processed.
llvm-svn: 58184
2008-10-26 07:49:03 +00:00
Evan Cheng f48367b8e9 Handle cases where there aren't uses in the barrier mbb.
llvm-svn: 58174
2008-10-25 23:49:39 +00:00
Gordon Henriksen bf40eee91a Related to PR2911, reject as invalid non-pointer GC roots.
llvm-svn: 58143
2008-10-25 16:28:35 +00:00
Evan Cheng 85d71d4588 If val# def is ~0U, meaning it's defined by a PHI, and it's previously split, spill before the barrier because it's impossible to determine if all the defs are spilled in the same spill slot.
llvm-svn: 58129
2008-10-25 00:52:41 +00:00
Dale Johannesen e45896fc4f Be kind to non-x86 hosts.
llvm-svn: 58113
2008-10-24 21:20:25 +00:00
Duncan Sands 014f5bbaad Fix translateX86CC: if SetCCOpcode is SETULE and
LHS is a foldable load, then LHS and RHS are swapped
and SetCCOpcode is changed to SETUGT.  But the later
code is expecting operands to be the wrong way round
for SETUGT, but they are not in this case, resulting
in an inverted compare.  The solution is to move the
load normalization before the correction for SETUGT.
This bug was tickled by LegalizeTypes which happened
to legalize the testcase slightly differently to
LegalizeDAG.

llvm-svn: 58092
2008-10-24 13:03:10 +00:00
Nick Lewycky 730d5dade6 Don't try to create a mask when we don't need one. Fixes a crash.
llvm-svn: 58075
2008-10-24 06:14:27 +00:00
Evan Cheng 4bac4d0a16 Avoid splitting an interval multiple times; avoid splitting re-materializable val# (for now).
llvm-svn: 58068
2008-10-24 02:05:00 +00:00
Chris Lattner 9246c2c8e1 make this test not depend on how the system header defines memset.
llvm-svn: 58016
2008-10-23 00:24:51 +00:00
Gordon Henriksen e38d542d89 [PR2886] Ignore stderr from ocamlc since it prints unresolvable warnings on some platforms.
llvm-svn: 57976
2008-10-22 12:41:54 +00:00
Chris Lattner 35b40f8c2f Fix PR2907 by digging through constant expressions to find FP constants that
are their operands.

llvm-svn: 57956
2008-10-22 04:53:16 +00:00
Dan Gohman 8b44b88eff Fix SelectionDAGBuild lowering of Select instructions to
handle first-class aggregate values. Also, fix a bug in
the Ret handling for empty aggregates.

llvm-svn: 57925
2008-10-21 20:00:42 +00:00
Torok Edwin 016fa4cd0d Fix make check on Solaris 10/x86: the default grep is not GNU grep, same for as.
llvm-svn: 57912
2008-10-21 17:21:32 +00:00
Chris Lattner 192f27cb5c really fix run line
llvm-svn: 57889
2008-10-21 03:55:19 +00:00
Chris Lattner b4ee2aebb5 fix run line
llvm-svn: 57888
2008-10-21 03:54:49 +00:00
Chris Lattner 0b641e4718 remove some unneeded eh generation
llvm-svn: 57887
2008-10-21 03:49:19 +00:00
Dan Gohman 269246b034 Don't create TargetGlobalAddress nodes with offsets that don't fit
in the 32-bit signed offset field of addresses. Even though this
may be intended, some linkers refuse to relocate code where the
relocated address computation overflows.

Also, fix the sign-extension of constant offsets to use the
actual pointer size, rather than the size of the GlobalAddress
node, which may be different, for example on x86-64 where MVT::i32
is used when the address is being fit into the 32-bit displacement
field.

llvm-svn: 57885
2008-10-21 03:38:42 +00:00
Dan Gohman 97d95d6d85 Optimized FCMP_OEQ and FCMP_UNE for x86.
Where previously LLVM might emit code like this:

        ucomisd %xmm1, %xmm0
        setne   %al
        setp    %cl
        orb     %al, %cl
        jne     .LBB4_2

it now emits this:

        ucomisd %xmm1, %xmm0
        jne     .LBB4_2
        jp      .LBB4_2

It has fewer instructions and uses fewer registers, but it does
have more branches. And in the case that this code is followed by
a non-fallthrough edge, it may be followed by a jmp instruction,
resulting in three branch instructions in sequence. Some effort
is made to avoid this situation.

To achieve this, X86ISelLowering.cpp now recognizes FCMP_OEQ and
FCMP_UNE in lowered form, and replace them with code that emits
two branches, except in the case where it would require converting
a fall-through edge to an explicit branch.

Also, X86InstrInfo.cpp's branch analysis and transform code now
knows now to handle blocks with multiple conditional branches. It
uses loops instead of having fixed checks for up to two
instructions. It can now analyze and transform code generated
from FCMP_OEQ and FCMP_UNE.

llvm-svn: 57873
2008-10-21 03:29:32 +00:00
Dan Gohman c835458da9 When the coalescer is doing rematerializing, have it remove
the copy instruction from the instruction list before asking the
target to create the new instruction. This gets the old instruction
out of the way so that it doesn't interfere with the target's
rematerialization code. In the case of x86, this helps it find
more cases where EFLAGS is not live.

Also, in the X86InstrInfo.cpp, teach isSafeToClobberEFLAGS to check
to see if it reached the end of the block after scanning each
instruction, instead of just before. This lets it notice when the
end of the block is only two instructions away, without doing any
additional scanning.

These changes allow rematerialization to clobber EFLAGS in more
cases, for example using xor instead of mov to set the return value
to zero in the included testcase.

llvm-svn: 57872
2008-10-21 03:24:31 +00:00
Chris Lattner 4396e0d2c3 Fix gcc.c-torture/compile/920520-1.c by inserting bitconverts
for strange asm conditions earlier.  In this case, we have a
double being passed in an integer reg class.  Convert to like
sized integer register so that we allocate the right number 
for the class (two i32's for the f64 in this case).

llvm-svn: 57862
2008-10-21 00:45:36 +00:00
Chris Lattner 160e8abd77 Reapply r57699 with a fix to not crash on asms with multiple results. Unlike
the previous patch this one actually passes make check.

"Fix PR2356 on PowerPC: if we have an input and output that are tied together
that have different sizes (e.g. i32 and i64) make sure to reserve registers for
the bigger operand."

llvm-svn: 57771
2008-10-18 18:49:30 +00:00
Dan Gohman 2fe6bee5b6 Teach DAGCombine to fold constant offsets into GlobalAddress nodes,
and add a TargetLowering hook for it to use to determine when this
is legal (i.e. not in PIC mode, etc.)

This allows instruction selection to emit folded constant offsets
in more cases, such as the included testcase, eliminating the need
for explicit arithmetic instructions.

This eliminates the need for the C++ code in X86ISelDAGToDAG.cpp
that attempted to achieve the same effect, but wasn't as effective.

Also, fix handling of offsets in GlobalAddressSDNodes in several
places, including changing GlobalAddressSDNode's offset from
int to int64_t.

The Mips, Alpha, Sparc, and CellSPU targets appear to be
unaware of GlobalAddress offsets currently, so set the hook to
false on those targets.

llvm-svn: 57748
2008-10-18 02:06:02 +00:00
Dan Gohman 6de2556205 Revert r57699. It's causing regressions in
test/CodeGen/X86/2008-09-17-inline-asm-1.ll
and a few others, and it breaks the llvm-gcc build.

llvm-svn: 57747
2008-10-18 01:03:45 +00:00
Evan Cheng 94169f1021 Fix PR2898. Spiller delete a store for reuse before it knows for sure the reuse happened.
Patch by Lang Hames!

llvm-svn: 57720
2008-10-17 20:56:41 +00:00
Bill Wendling fe9e2c587d The Dwarf writer was comparing mangled and unmangled names for C++ code when we
have an unreachable block in a function. This was triggering the assert. This is
a horrid hack to cover this up.

Oh! for a good debug info architecture!

llvm-svn: 57714
2008-10-17 18:48:57 +00:00
Chris Lattner c7e65f4377 Fix a bug where the x86 backend would reject 64-bit r constraints when
in 32-bit mode instead of assigning a register pair.  This has nothing to
do with PR2356, but I happened to notice it while working on it.

llvm-svn: 57704
2008-10-17 17:59:52 +00:00
Chris Lattner 052092bf9c Fix PR2356 on PowerPC: if we have an input and output that are tied together
that have different sizes (e.g. i32 and i64) make sure to reserve registers for
the bigger operand.

llvm-svn: 57699
2008-10-17 17:52:49 +00:00
Chris Lattner 00c5d69998 remove an xfailed test.
llvm-svn: 57695
2008-10-17 17:26:48 +00:00
Chris Lattner e212b970cf remove this test: it is xfailed anyway, and is failing for a reason
other than why it was xfailed.

llvm-svn: 57694
2008-10-17 17:26:19 +00:00
Evan Cheng 08acb24225 Fix a very subtle spiller bug: UpdateKills should not forget to track defs of aliases.
llvm-svn: 57673
2008-10-17 06:16:07 +00:00
Dan Gohman ca0546facc Fun x86 encoding tricks: when adding an immediate value of 128,
use a SUB instruction instead of an ADD, because -128 can be
encoded in an 8-bit signed immediate field, while +128 can't be.
This avoids the need for a 32-bit immediate field in this case.

A similar optimization applies to 64-bit adds with 0x80000000,
with the 32-bit signed immediate field.

To support this, teach tablegen how to handle 64-bit constants.

llvm-svn: 57663
2008-10-17 01:33:43 +00:00
Dan Gohman a39b0a1f05 Define patterns for shld and shrd that match immediate
shift counts, and patterns that match dynamic shift counts
when the subtract is obscured by a truncate node.

Add DAGCombiner support for recognizing rotate patterns
when the shift counts are defined by truncate nodes.

Fix and simplify the code for commuting shld and shrd
instructions to work even when the given instruction doesn't
have a parent, and when the caller needs a new instruction.

These changes allow LLVM to use the shld, shrd, rol, and ror
instructions on x86 to replace equivalent code using two
shifts and an or in many more cases.

llvm-svn: 57662
2008-10-17 01:23:35 +00:00
Dan Gohman 016f16daf1 Fix this test so it actually runs the grep lines.
llvm-svn: 57653
2008-10-16 23:57:54 +00:00
Duncan Sands 7451f87273 Testcase for PR2762.
llvm-svn: 57633
2008-10-16 08:56:46 +00:00
Chris Lattner 1baace07c4 apply Eli's patch for PR2165 and provide a testcase.
llvm-svn: 57625
2008-10-16 05:26:51 +00:00
Dan Gohman bc0278400c Teach instcombine's visitLoad to scan back several instructions
to find opportunities for store-to-load forwarding or load CSE,
in the same way that visitStore scans back to do DSE. Also, define
a new helper function for testing whether the addresses of two
memory accesses are known to have the same value, and use it in
both visitStore and visitLoad.

These two changes allow instcombine to eliminate loads in code
produced by front-ends that frequently emit obviously redundant
addressing for memory references.

llvm-svn: 57608
2008-10-15 23:19:35 +00:00
Duncan Sands 5e39031007 Testcase for PR2894.
llvm-svn: 57604
2008-10-15 22:34:34 +00:00
Anton Korobeynikov ba13e8db17 Add global variable to test for consistency
llvm-svn: 57597
2008-10-15 20:22:44 +00:00
Anton Korobeynikov 99ed98ab40 This is not failing anymore
llvm-svn: 57596
2008-10-15 20:13:10 +00:00
Bill Wendling f998a65980 Testcase for PR1638.
llvm-svn: 57590
2008-10-15 18:27:15 +00:00
Chris Lattner 25f74dc574 Fix the .ll grammar rules to allow any type before an 'i32', not just an
integer type.  Invalid things like 'float 42' are now rejected by the
semantic analysis in the productions not the parser.  This fixes PR2733.

llvm-svn: 57560
2008-10-15 06:16:45 +00:00
Evan Cheng 3b0f5e4d61 - Add target lowering hooks that specify which setcc conditions are illegal,
i.e. conditions that cannot be checked with a single instruction. For example,
SETONE and SETUEQ on x86.
- Teach legalizer to implement *illegal* setcc as a and / or of a number of
legal setcc nodes. For now, only implement FP conditions. e.g. SETONE is
implemented as SETO & SETNE, SETUEQ is SETUO | SETEQ.
- Move x86 target over.

llvm-svn: 57542
2008-10-15 02:05:31 +00:00
Daniel Dunbar 0f8155ae4e Prevent assert when using '"' in names (via hexadecimal).
Update LangRef to mention \xx quoting in names.

llvm-svn: 57538
2008-10-14 23:51:43 +00:00
Evan Cheng d885f6e139 Combine (fcmp cc0 x, y) | (fcmp cc1 x, y) into a single fcmp when possible.
llvm-svn: 57515
2008-10-14 18:44:08 +00:00
Evan Cheng ce70752b11 - Somehow I forgot about one / une.
- Renumber fcmp predicates to match their icmp counterparts.
- Try swapping operands to expose more optimization opportunities.

llvm-svn: 57513
2008-10-14 18:13:38 +00:00
Evan Cheng 67786cce66 Optimize anding of two fcmp into a single fcmp if the operands are the same. e.g. uno && ueq -> ueq
ord && olt -> olt
     ord && ueq -> oeq

llvm-svn: 57507
2008-10-14 17:15:11 +00:00
Chris Lattner acc2eb484b new testcase for PR2797
llvm-svn: 57481
2008-10-14 06:56:04 +00:00