Commit Graph

11556 Commits

Author SHA1 Message Date
Devang Patel
23670e5b95 Keep track of directory namd and fIx regression caused by Rafael's patch r119613.
A better approach would be to move source id handling inside MC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128233 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24 20:30:50 +00:00
Eli Friedman
b141099c14 PR9535: add support for splitting and scalarizing vector ISD::FP_ROUND.
Also cleaning up some duplicated code while I'm here.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128176 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 22:18:48 +00:00
Andrew Trick
bd47a4a307 Ensure that def-side physreg copies are scheduled above any other uses
so the scheduler can't create new interferences on the copies
themselves. Prior to this fix the scheduler could get stuck in a loop
creating copies.
Fixes PR9509.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128164 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 20:42:39 +00:00
Andrew Trick
0d93a110e3 whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128163 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 20:40:18 +00:00
Jakob Stoklund Olesen
01079311e1 Don't coalesce identical DBG_VALUE instructions prematurely.
Each of these instructions may have a RegsClobberInsn entry that can't be
ignored. Consecutive ranges are coalesced later when DwarfDebug::emitDebugLoc
merges entries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128155 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 18:37:30 +00:00
Jakob Stoklund Olesen
1e6c65dba7 Notify the delegate before removing dead values from a live interval.
The register allocator needs to know when the range shrinks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128145 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 04:43:16 +00:00
Jakob Stoklund Olesen
0b5015188e Allow the allocation of empty live ranges that have uses.
Empty ranges may represent undef values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128144 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 04:32:51 +00:00
Jakob Stoklund Olesen
bf824efcb9 Dump the register map before rewriting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128143 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 04:32:49 +00:00
Andrew Trick
a2f45291e1 Added block number and name to isel debug output.
I'm tired of doing this manually for each checkout.
If anyone knows a better way debug isel for non-trivial tests feel
free to revert and let me know how to do it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128132 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 01:38:28 +00:00
Jakob Stoklund Olesen
28cf1156c9 Reapply r128045 and r128051 with fixes.
This will extend the ranges of debug info variables in registers until they are
clobbered.

Fix 1: Don't mistake DBG_VALUE instructions referring to incoming arguments on
the stack with DBG_VALUE instructions referring to variables in the frame
pointer. This fixes the gdb test-suite failure.

Fix 2: Don't trace through copies to physical registers setting up call
arguments. These registers are call clobbered, and the source register is more
likely to be a callee-saved register that can be extended through the call
instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128114 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 22:33:08 +00:00
Andrew Trick
c1dbd5d9c3 Revert r128045 and r128051, debug info enhancements.
Temporarily reverting these to see if we can get llvm-objdump to link. Hopefully this is not the problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 19:18:42 +00:00
Jakob Stoklund Olesen
bd17478f2f Clear map after use.
This is likely to fix the segfault in llvm-gcc-x86_64-darwin10-cross-mingw32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128051 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 01:03:24 +00:00
Jakob Stoklund Olesen
e17232ee4d Dont emit 'DBG_VALUE %noreg, ...' to terminate user variable ranges.
These ranges get completely jumbled by the post-ra scheduler, and it is not
really reasonable to expect it to make sense of them.

Instead, teach DwarfDebug to notice when user variables in registers are
clobbered, and terminate the ranges there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128045 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 00:21:41 +00:00
Eric Christopher
28ed90b95d Grammar-o.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128004 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 18:06:21 +00:00
Bill Wendling
a5c177e70a We need to pass the TargetMachine object to the InstPrinter if we are printing
the alias of an InstAlias instead of the thing being aliased. Because we need to
know the features that are valid for an InstAlias.

This is part of a work-in-progress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127986 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 04:13:46 +00:00
Jakob Stoklund Olesen
2dc455a366 Process all dead defs after rematerializing during splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127973 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 19:46:23 +00:00
Jakob Stoklund Olesen
682eed0da8 Also eliminate redundant spills downstream of inserted reloads.
This can happen when multiple sibling registers are spilled after live range
splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 05:44:58 +00:00
Jakob Stoklund Olesen
01a46c82e0 Change an argument to a LiveInterval instead of a register number to save some redundant lookups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127964 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 05:44:55 +00:00
Jakob Stoklund Olesen
d2eff137ca Replace a broken LiveInterval::MergeValueInAsValue() with something simpler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127960 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 23:02:49 +00:00
Jakob Stoklund Olesen
c1655e1a3c Add debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127959 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 23:02:47 +00:00
Evan Cheng
9344f97108 Minor code re-structuring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127952 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 17:03:16 +00:00
Nadav Rotem
06cc324b9d Add support for legalizing UINT_TO_FP of vectors on platforms which do
not have native support for this operation (such as X86).
The legalized code uses two vector INT_TO_FP operations and is faster
than scalarizing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127951 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 13:09:10 +00:00
Stuart Hastings
65c8bca788 Reapply 127939 since Daniel fixed the breakage. <rdar://problem/9012638>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127944 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 02:42:31 +00:00
Stuart Hastings
825dd96918 Revert 127939. <rdar://problem/9012638>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 02:33:56 +00:00
Stuart Hastings
7257897402 Revise r126127 to address Daniel's comments. <rdar://problem/9012638>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127939 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 01:32:01 +00:00
Jim Grosbach
31649e61bc Beginnings of MC-JIT code generation.
Proof-of-concept code that code-gens a module to an in-memory MachO object.
This will be hooked up to a run-time dynamic linker library (see: llvm-rtdyld
for similarly conceptual work for that part) which will take the compiled
object and link it together with the rest of the system, providing back to the
JIT a table of available symbols which will be used to respond to the
getPointerTo*() queries.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127916 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 22:48:41 +00:00
Jakob Stoklund Olesen
1744e476ec Extend live debug values down the dominator tree by following copies.
The llvm.dbg.value intrinsic refers to SSA values, not virtual registers, so we
should be able to extend the range of a value by tracking that value through
register copies. This greatly improves the debug value tracking for function
arguments that for some reason are copied to a second virtual register at the
end of the entry block.

We only extend the debug value range where its register is killed. All original
llvm.dbg.value locations are still respected.

Copies from physical registers are ignored. That should not be a problem since
the entry block already adds DBG_VALUE instructions for the virtual registers
holding the function arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127912 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 21:42:19 +00:00
Jakob Stoklund Olesen
2a72bfa1b1 Hoist spills when the same value is known to be in less loopy sibling registers.
Stack slot real estate is virtually free compared to registers, so it is
advantageous to spill earlier even though the same value is now kept in both a
register and a stack slot.

Also eliminate redundant spills by extending the stack slot live range
underneath reloaded registers.

This can trigger a dead code elimination, removing copies and even reloads that
were only feeding spills.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127868 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 04:23:06 +00:00
Jakob Stoklund Olesen
9ef931e71c Accept instructions that read undefined values.
This is not supposed to happen, but I have seen the x86 rematter getting
confused when rematerializing partial redefs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127857 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 03:06:04 +00:00
Jakob Stoklund Olesen
7cec179a64 Be more accurate about the slot index reading a register when dealing with defs
and early clobbers.

Assert when trying to find an undefined value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127856 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 03:06:02 +00:00
Benjamin Kramer
1c10b8de46 BuildUDIV: If the divisor is even we can simplify the fixup of the multiplied value by introducing an early shift.
This allows us to compile "unsigned foo(unsigned x) { return x/28; }" into
	shrl	$2, %edi
	imulq	$613566757, %rdi, %rax
	shrq	$32, %rax
	ret

instead of
	movl    %edi, %eax
	imulq   $613566757, %rax, %rcx
	shrq    $32, %rcx
	subl    %ecx, %eax
	shrl    %eax
	addl    %ecx, %eax
	shrl    $4, %eax

on x86_64

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127829 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 20:39:14 +00:00
Jakob Stoklund Olesen
6a3dbd3b25 Dead code elimination may separate the live interval into multiple connected components.
I have convinced myself that it can only happen when a phi value dies. When it
happens, allocate new virtual registers for the components.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127827 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 20:37:07 +00:00
Cameron Zwarich
7bbf0ee97c Move more logic into getTypeForExtArgOrReturn.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127809 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 14:53:37 +00:00
Cameron Zwarich
4457968011 Rename getTypeForExtendedInteger() to getTypeForExtArgOrReturn().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 14:21:56 +00:00
Jakob Stoklund Olesen
2254227791 Rewrite instructions as part of ConnectedVNInfoEqClasses::Distribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127779 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 00:23:45 +00:00
Jakob Stoklund Olesen
1d5b845081 Add a LiveRangeEdit delegate callback before shrinking a live range.
The register allocator needs to adjust its live interval unions when that happens.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127774 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:56:16 +00:00
Jakob Stoklund Olesen
cc5c4296fd Erase virtual registers that are unused after DCE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127773 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:56:13 +00:00
Jakob Stoklund Olesen
2926733240 Tag cached interference with a user-provided tag instead of the virtual register number.
The live range of a virtual register may change which invalidates the cached
interference information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127772 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:56:11 +00:00
Jakob Stoklund Olesen
c46570dc05 Clarify debugging output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127771 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:56:08 +00:00
Cameron Zwarich
ebe8173941 The x86-64 ABI says that a bool is only guaranteed to be sign-extended to a byte
rather than an int. Thankfully, this only causes LLVM to miss optimizations, not
generate incorrect code.

This just fixes the zext at the return. We still insert an i32 ZextAssert when
reading a function's arguments, but it is followed by a truncate and another i8
ZextAssert so it is not optimized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127766 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:20:18 +00:00
Cameron Zwarich
8df6bf5f5c Don't recompute something that we already have in a local variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127764 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:20:07 +00:00
Daniel Dunbar
83320a023c Revert r127757, "Patch to a fix dwarf relocation problem on ARM. One-line fix
plus the test where it used to break.", which broke Clang self-host of a
Debug+Asserts compiler, on OS X.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127763 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 22:16:39 +00:00
Renato Golin
2589d0aedf Patch to a fix dwarf relocation problem on ARM. One-line fix plus the test where it used to break.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127757 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 21:05:52 +00:00
Jakob Stoklund Olesen
13ba2527f7 Trace back through sibling copies to hoist spills and find rematerializable defs.
After live range splitting, an original value may be available in multiple
registers. Tracing back through the registers containing the same value, find
the best place to insert a spill, determine if the value has already been
spilled, or discover a reaching def that may be rematerialized.

This is only the analysis part. The information is not used for anything yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127698 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 21:13:25 +00:00
Jakob Stoklund Olesen
29ef87599c Preserve both isPHIDef and isDefByCopy bits when copying parent values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127697 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 21:13:22 +00:00
Evan Cheng
d158fba3e4 Add a peephole optimization to optimize pairs of bitcasts. e.g.
v2 = bitcast v1
...
v3 = bitcast v2
...
   = v3
=>
v2 = bitcast v1
...
   = v1
if v1 and v3 are of in the same register class.

bitcast between i32 and fp (and others) are often not nops since they
are in different register classes. These bitcast instructions are often
left because they are in different basic blocks and cannot be
eliminated by dag combine.

rdar://9104514


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127668 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 05:13:13 +00:00
Evan Cheng
bf34a5ec22 sext(undef) = 0, because the top bits will all be the same.
zext(undef) = 0, because the top bits will be zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127649 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 02:22:10 +00:00
Bill Wendling
28cc1aa3a7 There are some situations which can cause the URoR hack to infinitely recurse
and then go kablooie. The problem was that it was tracking the PHI nodes anew
each time into this function. But it didn't need to. And because the recursion
didn't know that a PHINode was visited before, it would go ahead and call
itself.

There is a testcase, but unfortunately it's too big to add. This problem will go
away with the EH rewrite.
<rdar://problem/8856298>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127640 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 01:03:17 +00:00
Jakob Stoklund Olesen
cf03e35d90 Place context in member variables instead of passing around pointers.
Use the opportunity to get rid of the trailing underscore variable names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 20:57:14 +00:00
Jakob Stoklund Olesen
766faf4b2b Rename members to match LLVM naming conventions more closely.
Remove the unused reserved_ bit vector, no functional change intended.

This doesn't break 'svn blame', this file really is all my fault.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127607 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 19:56:43 +00:00