Commit Graph

2150 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
700bfada63 Add a -regalloc=default option that chooses a register allocator based on the -O
optimization level.

This only really affects llc for now because both the llvm-gcc and clang front
ends override the default register allocator. I intend to remove that code later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 23:57:25 +00:00
Devang Patel
80250686d5 Simplify. Eliminate unneeded debug_loc entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 23:55:23 +00:00
Devang Patel
394427b014 Update debug info when live-in reg is copied into a vreg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 20:18:50 +00:00
Dale Johannesen
b09e793bf9 Testcase for 104624/104619/PR7191/8023512.
Reduced from one provided by Duncan Sands, thanks!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 17:55:45 +00:00
Dale Johannesen
854f30d965 Removing test; Chris thinks it's better to have the
bug go untested than have a testcase this large.  So be it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104632 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 20:40:10 +00:00
Dale Johannesen
86234c30a7 Fix another variant of PR 7191. Also add a testcase
Mon Ping provided; unfortunately bugpoint failed to
reduce it, but I think it's important to have a test for
this in the suite.  8023512.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104624 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 18:47:23 +00:00
Eric Christopher
1e6d3ac709 This test is darwin only. Make it so(tm).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104418 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 00:55:55 +00:00
Eric Christopher
8116ca5134 Add full bss data support for darwin tls variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104414 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 00:10:22 +00:00
Chris Lattner
a26a8471bd now that fp reg kill insertion stuff happens as a separate
pass after isel instead of being interlaced with it, we can
trust that all the code for a function has been isel'd before
it is run.

The practical impact of this is that we can scan for machine
instr phis instead of doing a fuzzy match on the LLVM BB for
phi nodes.  Doing the fuzzy match required knowing when isel
would produce an fp reg stack phi which was gross.  It was
also wrong in cases where select got lowered to a branch
tree because cmovs aren't available (PR6828).

Just do the scan on machine phis which is simpler, faster
and more correct.  This fixes PR6828.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104333 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 18:17:54 +00:00
Dale Johannesen
7d07b48b26 Fix i64->f64 conversion, x86-64, -no-sse. A bit
tricky since there's a 3rd 64-bit type, MMX vectors.
PR 7135.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104308 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 00:52:33 +00:00
Dan Gohman
f182b23f8f When canonicalizing icmp operand order to put the loop invariant
operand on the left, the interesting operand is on the right. This
fixes a bug where LSR was failing to recognize ICmpZero uses,
which led it to be unable to reverse the induction variable in the
attached testcase.

Delete test/CodeGen/X86/stack-color-with-reg-2.ll, because its test
is extremely fragile and hard to meaningfully update.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104262 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 19:26:52 +00:00
Dan Gohman
e5efbafdac When converting a test to a cmp to fold a load, use the cmp that has an
8-bit immediate field rather than one with a wider immediate field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 21:42:03 +00:00
Daniel Dunbar
3f40b31256 MC/X86: Implement custom lowering to make sure we match things like
X86::ADC32ri $0, %eax
to
  X86::ADC32i32 $0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104030 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 17:22:24 +00:00
Dale Johannesen
88dc976102 Removing as part of previous reversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 20:19:40 +00:00
Dale Johannesen
f7f5a2760a Revert 103911; it broke a test that expects bitconvert
<1xi64> -> i64 to work in MMX registers on hosts where -no-sse
is the default (not mine).  The right thing is
to accept this and make i64->f64 conversions go through memory,
but I don't have time right now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 20:19:04 +00:00
Dale Johannesen
f9b2242927 Make x86-64 64-bit bitconvert work when SSE is not available.
(This worked as of about 6 months ago and I didn't track down
exactly what broke it; I think this fix is appropriate.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103911 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 18:22:38 +00:00
Anton Korobeynikov
ded05e34b6 Add support for thiscall calling convention.
Patch by Charles Davis and Steven Watanabe!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 09:08:45 +00:00
Jakob Stoklund Olesen
4ed1082683 Simplify the handling of physreg defs and uses in RegAllocFast.
This adds extra security against using clobbered physregs, and it adds kill
markers to physreg uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-14 18:03:25 +00:00
Jakob Stoklund Olesen
4bf4bafcce Take allocation hints from copy instructions to/from physregs.
This causes way more identity copies to be generated, ripe for coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 00:19:43 +00:00
Jakob Stoklund Olesen
804291e316 Make sure to add kill flags to the last use of a virtreg when it is redefined.
The X86 floating point stack pass and others depend on good kill flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103635 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 18:46:03 +00:00
Jakob Stoklund Olesen
85f4fdaed4 Enable a bunch more -regalloc=fast tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103531 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 00:11:24 +00:00
Jakob Stoklund Olesen
a44c1223cd One more -regalloc=fast test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103509 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 20:51:07 +00:00
Jakob Stoklund Olesen
82b07dc499 Simplify the tracking of used physregs to a bulk bitor followed by a transitive
closure after allocating all blocks.

Add a few more test cases for -regalloc=fast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 20:30:28 +00:00
Jakob Stoklund Olesen
bbf33b38aa Mostly rewrite RegAllocFast.
Sorry for the big change. The path leading up to this patch had some TableGen
changes that I didn't want to commit before I knew they were useful. They
weren't, and this version does not need them.

The fast register allocator now does no liveness calculations. Instead it relies
on kill flags provided by isel. (Currently those kill flags are also ignored due
to isel bugs). The allocation algorithm is supposed to work with any subset of
valid kill flags. More kill flags simply means fewer spills inserted.

Registers are allocated from a working set that contains no aliases. That means
most allocations can be done directly without expensive alias checks. When the
working set runs out of registers we do the full alias check to find new free
registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103488 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 18:54:45 +00:00
Evan Cheng
aad753bbbd Be careful with operand promotion. For a binary operation, the source operands may be the same. PR7018. rdar://7939869.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-10 19:03:57 +00:00
Bill Wendling
369252db2e Readd testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103335 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-08 04:47:54 +00:00
Dan Gohman
59dc60337f When pruning candidate formulae out of an LSRUse, update the
LSRUse's Regs set after all pruning is done, rather than trying
to do it on the fly, which can produce an incomplete result.

This fixes a case where heuristic pruning was stripping all
formulae from a use, which led the solver to enter an infinite
loop.

Also, add a few asserts to diagnose this kind of situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103328 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 23:36:59 +00:00
Bill Wendling
09e7a1722a Remove. Don't XFAIL.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103321 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 23:09:17 +00:00
Bill Wendling
20eb256006 Temorarily revert r101984.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 22:45:36 +00:00
Dale Johannesen
0a406ae0d9 Fix PR 7087, and probably other things, by extending
getConstantFP to accept the two supported long double
target types.  This was not the original intent, but
there are other places that assume this works and it's
easy enough to do.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103299 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 21:35:53 +00:00
Duncan Sands
7d2568ca3c Correct some bogus target triples.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 17:03:48 +00:00
Nick Lewycky
403d312c0f Revert r103133 and add testcase from PR7066.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 01:45:38 +00:00
Dan Gohman
281d65d004 Disable the new unknown-location code for now. It causes a major
increase in the debug line info section, and it's causing
regressions in a gdb testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103226 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 01:08:53 +00:00
Dan Gohman
34dcc6fadc Add a DebugLoc argument to TargetInstrInfo::copyRegToReg, so that it
doesn't have to guess.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103194 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06 20:33:48 +00:00
Dan Gohman
ac963b3279 Add a testcase for r103135, explicitly representing unknown
locations in debug line info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103189 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06 17:49:17 +00:00
Chris Lattner
b4202dbb36 Fix PR7054 - Assertion `Symbol->isUndefined() && "Cannot define a symbol twice!"' failed.
Users can write broken code that emits the same label twice with asm renaming,
detect this and emit a fatal backend error instead of aborting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103140 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06 00:05:37 +00:00
Jakob Stoklund Olesen
51bfd452d5 Fix PR6520. An earlyclobber physreg must not be allocated to anything else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 23:07:41 +00:00
Jakob Stoklund Olesen
b98c549d13 Check that subregisters don't have independent values in RemoveCopyByCommutingDef().
This fixes PR6941.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102970 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 22:40:32 +00:00
Dan Gohman
d4d01154ef Fix tests to use fadd, fsub, and fmul, instead of add, sub, and mul,
when the type is floating-point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102969 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 22:36:46 +00:00
Dan Gohman
30fc5bbfd1 Fix a bug which prevented tail merging of return instructions in
beneficial cases. See the changes in test/CodeGen/X86/tail-opts.ll and
test/CodeGen/ARM/ifcvt2.ll for details.

The fix is to change HashEndOfMBB to hash at most one instruction,
instead of trying to apply heuristics about when it will be profitable to
consider more than one instruction. The regular tail-merging heuristics
are already prepared to handle the same cases, and they're more precise.

Also, make test/CodeGen/ARM/ifcvt5.ll and
test/CodeGen/Thumb2/thumb2-branch.ll slightly more complex so that they
continue to test what they're intended to test.

And, this eliminates the problem in
test/CodeGen/Thumb2/2009-10-15-ITBlockBranch.ll, the testcase from
PR5204. Update it accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 14:35:47 +00:00
Duncan Sands
57b6e9eb6c Remove the -enable-sjlj-eh option, which doesn't do anything.
Remove the -enable-eh option which is only used by the JIT,
and replace it with -jit-enable-eh.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 15:36:26 +00:00
Bill Wendling
3f755d7ec6 Test failing too much on too many platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102812 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 00:12:33 +00:00
Bill Wendling
1c2d7f1196 Maybe it needs sse2?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102802 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 23:19:29 +00:00
Bill Wendling
6c84fdeb9c Force 64-bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 22:45:20 +00:00
Bill Wendling
d71bb56275 EXTRACT_VECTOR_ELT of an INSERT_VECTOR_ELT may have the same index, but the
indexes could be of a different value type. Or not even using the same SDNode
for the constant (weird, I know). Compare the actual values instead of the
pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 22:19:17 +00:00
Jakob Stoklund Olesen
8387d7db19 The local register allocator has to spill dirty callee saved registers before a
call that might throw. The landing pad assumes that all registers are in stack
slots.

We used to spill those dirty CSRs after the call, and the stack slots would be
wrong when arriving at the landing pad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 21:19:29 +00:00
Evan Cheng
f2d36d91e2 Fix test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102694 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 06:00:56 +00:00
Evan Cheng
1361796dd0 Another sibcall bug. If caller and callee calling conventions differ, then it's only safe to do a tail call if the results are returned in the same way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 01:12:32 +00:00
Jakob Stoklund Olesen
f07fc974d3 Reject really weird coalescer case when trying to merge identical subregisters
of different register classes. e.g.

  %reg1048:3<def> = EXTRACT_SUBREG %RAX<kill>, 3

Where %reg1048 is a GR32 register. This is not impossible to handle, but it is
pretty hard and very rare.

This should unbreak the dragonegg builder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-29 23:47:46 +00:00
Evan Cheng
3f54c64a98 Load folding tail call should not use ebp / rbp after it's popped. PEI
should use esp / rsp to reference frame instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102596 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-29 05:08:22 +00:00