Commit Graph

11493 Commits

Author SHA1 Message Date
Evan Cheng
9ef82ce4fe Avoid replacing the value of a directly stored load with the stored value if the load is indexed. rdar://9117613.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127440 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 00:48:56 +00:00
Cameron Zwarich
6a951ac63f Add an option to disable critical edge splitting in PHIElimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 05:59:17 +00:00
Jakob Stoklund Olesen
47dbf6cef7 Change the Spiller interface to take a LiveRangeEdit reference.
This makes it possible to register delegates and get callbacks when the spiller
edits live ranges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127389 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 01:51:42 +00:00
Jakob Stoklund Olesen
38f6bd0fc8 Make SpillIs an optional pointer. Avoid creating a bunch of temporary SmallVectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 01:21:58 +00:00
Evan Cheng
b0519e15f7 Re-commit 127368 and 127371. They are exonerated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127380 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 00:16:32 +00:00
Evan Cheng
02d7c92982 Revert 127368 and 127371 for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127376 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 23:53:17 +00:00
Evan Cheng
17adafc6c1 Change the definition of TargetRegisterInfo::getCrossCopyRegClass to be more
flexible.

If it returns a register class that's different from the input, then that's the
register class used for cross-register class copies.
If it returns a register class that's the same as the input, then no cross-
register class copies are needed (normal copies would do).
If it returns null, then it's not at all possible to copy registers of the
specified register class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 22:47:38 +00:00
Jakob Stoklund Olesen
5d96e5a1cc Make physreg coalescing independent on the number of uses of the virtual register.
The damage done by physreg coalescing only depends on the number of instructions
the extended physreg live range covers. This fixes PR9438.

The heuristic is still luck-based, and physreg coalescing really should be
disabled completely. We need a register allocator with better hinting support
before that is possible.

Convert a test to FileCheck and force spilling by inserting an extra call. The
previous spilling behavior was dependent on misguided physreg coalescing
decisions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127351 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 19:27:06 +00:00
Andrew Trick
4bbf4678e3 Improve pre-RA-sched register pressure tracking for duplicate operands.
This helps cases like 2008-07-19-movups-spills.ll, but doesn't have an obvious impact on benchmarks


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127347 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 19:12:43 +00:00
Benjamin Kramer
d7cdc3e1f9 Fix typo, make helper static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127335 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 16:19:12 +00:00
Benjamin Kramer
8104163fd1 Remove unused virtual dtor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127331 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 14:20:28 +00:00
Matt Beaumont-Gay
ab2ee2ea75 Add a virtual dtor to Delegate to silence -Wnon-virtual-dtor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 04:02:15 +00:00
Jakob Stoklund Olesen
92a55f4bdd Add a LiveRangeEdit::Delegate protocol.
This will we used for keeping register allocator data structures up to date
while LiveRangeEdit is trimming live intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127300 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 00:57:29 +00:00
Jakob Stoklund Olesen
f46aa914c8 Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 00:07:39 +00:00
Jakob Stoklund Olesen
5881799d0c Delete dead code after rematerializing.
LiveRangeEdit::eliminateDeadDefs() will eventually be used by coalescing,
splitting, and spilling for dead code elimination. It can delete chains of dead
instructions as long as there are no dependency loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 22:46:11 +00:00
Jakob Stoklund Olesen
5bf76cd119 Fix the build for MSVC 9 whose upper_bound() wants to compare elements in the sorted array.
Patch by Olaf Krzikalla!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 19:37:54 +00:00
Eric Christopher
29449448b0 Fix some latent bugs if the nodes are unschedulable. We'd gotten away
with this before since none of the register tracking or nightly tests
had unschedulable nodes.

This should probably be refixed with a special default Node that just
returns some "don't touch me" values.

Fixes PR9427


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127263 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 19:35:47 +00:00
Oscar Fuentes
3aefa7771d Revert "Make a comparator's argument `const'. This fixes the build for
MSVC 9."

The "fix" was meaningless.

This reverts commit r127245.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127260 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 19:26:21 +00:00
Benjamin Kramer
f337fb2fa8 Reduce vector reallocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127254 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 17:28:36 +00:00
Oscar Fuentes
86e4eeb6c7 Make a comparator's argument `const'. This fixes the build for MSVC 9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127245 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 13:52:07 +00:00
Andrew Trick
0bf56c821c Further improvements to pre-RA-sched=list-ilp.
This change uses the MaxReorderWindow for both height and depth, which
tends to limit the negative effects of high register pressure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127203 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 01:51:56 +00:00
Jakob Stoklund Olesen
0d8ccaa5c8 Let shrinkToUses optionally return a list of now dead machine instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127192 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 23:29:10 +00:00
Jakob Stoklund Olesen
1973b3e254 Make the UselessRegs argument optional in the LiveRangeEdit constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127181 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 22:42:16 +00:00
Cameron Zwarich
be2119e8e2 Move getRegPressureLimit() from TargetLoweringInfo to TargetRegisterInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127175 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 21:56:36 +00:00
Jakob Stoklund Olesen
a9d5c2715b Handle the special case of registers begin redefined by early-clobber defs.
In this case, the value need to be available at the load index instead of the
normal use index.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127167 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 18:56:16 +00:00
Owen Anderson
6154f6c929 Use the correct LHS type when determining the legalization of a shift's RHS type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127163 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 18:29:47 +00:00
Eric Christopher
b43034d700 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127131 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 21:13:45 +00:00
NAKAMURA Takumi
511cab20cb lib/CodeGen/AsmPrinter/CMakeLists.txt: Fix CMake build, following up to r127099.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127114 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 00:13:15 +00:00
Andrew Trick
3c6e49504e Disable a couple of experimental heuristics to get the best results from the current implementation of -pre-RA-sched=list-ilp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127113 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 00:03:32 +00:00
Anton Korobeynikov
b5e16af9ea Some first rudimentary support for ARM EHABI: print exception table in "text mode".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127099 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 18:43:15 +00:00
Anton Korobeynikov
6dd97471c4 Add FrameSetup MI flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127098 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 18:43:04 +00:00
Jakob Stoklund Olesen
2b0f9e73d8 Work around a coalescer bug.
The coalescer can in very rare cases leave too large live intervals around after
rematerializing cheap-as-a-move instructions.

Linear scan doesn't really care, but live range splitting gets very confused
when a live range is killed by a ghost instruction.

I will fix this properly in the coalescer after 2.9 branches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127096 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 18:33:49 +00:00
Andrew Trick
afc7d235e9 Be explicit with abs(). Visual Studio workaround.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127075 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 10:29:25 +00:00
Andrew Trick
5e84e3ccaa Fix for -sched-high-latency-cycles in sched=list-ilp mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127071 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 09:18:16 +00:00
Andrew Trick
ab2e3e2d70 Missing comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127068 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 08:04:11 +00:00
Andrew Trick
e0ef509aeb Increased the register pressure limit on x86_64 from 8 to 12
regs. This is the only change in this checkin that may affects the
default scheduler. With better register tracking and heuristics, it
doesn't make sense to artificially lower the register limit so much.

Added -sched-high-latency-cycles and X86InstrInfo::isHighLatencyDef to
give the scheduler a way to account for div and sqrt on targets that
don't have an itinerary. It is currently defaults to 10 (the actual
number doesn't matter much), but only takes effect on non-default
schedulers: list-hybrid and list-ilp.

Added several heuristics that can be individually disabled for the
non-default sched=list-ilp mode. This helps us determine how much
better we can do on a given benchmark than the default
scheduler. Certain compute intensive loops run much faster in this
mode with the right set of heuristics, and it doesn't seem to have
much negative impact elsewhere. Not all of the heuristics are needed,
but we still need to experiment to decide which should be disabled by
default for sched=list-ilp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127067 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 08:00:22 +00:00
Jakob Stoklund Olesen
874be74179 Rework the global split cost calculation.
The global cost is the sum of block frequencies for spill code that must be
inserted because preferences weren't met.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127062 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 03:28:51 +00:00
Jakob Stoklund Olesen
96dcd95a45 Compute the constraints for global live range splitting from an interference pattern.
This simplifies the code and makes it faster too.

The interference patterns are saved for each candidate register. It will be
reused for actually executing the split. Work in progress.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 01:10:31 +00:00
Jim Grosbach
27ea9999e8 Teach the register scavenger to take subregs into account when finding a free register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127049 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 00:20:19 +00:00
Eric Christopher
0795abd0d4 Improve readability with some whitespace!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127043 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 22:47:12 +00:00
Jakob Stoklund Olesen
8b6a933498 Extract a method. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127040 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 22:11:11 +00:00
Jakob Stoklund Olesen
d17924b1bd Go back to comparing spill weights when deciding if interference can be evicted.
It gives better results. Sometimes, a live range can be large and still have
high spill weight. Such a range should not be spilled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127036 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 21:32:50 +00:00
Jakob Stoklund Olesen
979869c28e Renumber slot indexes locally when possible.
Initially, slot indexes are quad-spaced. There is room for inserting up to 3
new instructions between the original instructions.

When we run out of indexes between two instructions, renumber locally using
double-spaced indexes. The original quad-spacing means that we catch up quickly,
and we only have to renumber a handful of instructions to get a monotonic
sequence. This is much faster than renumbering the whole function as we did
before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127023 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 19:43:38 +00:00
Jakob Stoklund Olesen
f0cf2d357c Number SlotIndexes uniformly without looking at the number of defs on each instruction.
You can't really predict how many indexes will be needed from the number of
defs, so let's keep it simple.

Also remove an extra empty index that was inserted after each basic block. It
was intended for live-out ranges, but it was never used that way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127014 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 18:51:09 +00:00
Jakob Stoklund Olesen
10c5f2dad5 Add SlotIndex statistics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127007 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 18:08:29 +00:00
Jakob Stoklund Olesen
fb69810a2b Tweak debug output. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127006 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 18:08:26 +00:00
Duncan Sands
53dfa78e41 Revert commit 126684 "Use the correct shift amount type". It is only the correct
type after type legalization has completed.  Before then it may simply not be big
enough to hold the shift amount, particularly on x86 which uses a very small type
for shifts (this issue broke stuff in the past which is why LegalizeTypes carefully
uses a large type for shift amounts).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127000 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 14:28:59 +00:00
Andrew Trick
a0807f57ca Minor pre-RA-sched fixes and cleanup.
Fix the PendingQueue, then disable it because it's not required for
the current schedulers' heuristics.
Fix the logic for the unused list-ilp scheduler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126981 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 02:03:45 +00:00
Jakob Stoklund Olesen
40a42a2cca Precompute block frequencies, pow() isn't free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126975 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 00:58:40 +00:00
Jakob Stoklund Olesen
13ba2dab63 Use an IndexedMap instead of a DenseMap for the live-out cache.
This speeds up updateSSA() so it only accounts for 5% of the live range
splitting time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126972 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 00:15:36 +00:00