Commit Graph

14968 Commits

Author SHA1 Message Date
Chandler Carruth
340d596509 Under the hood, MBPI is doing a linear scan of every successor every
time it is queried to compute the probability of a single successor.
This makes computing the probability of every successor of a block in
sequence... really really slow. ;] This switches to a linear walk of the
successors rather than a quadratic one. One of several quadratic
behaviors slowing this pass down.

I'm not really thrilled with moving the sum code into the public
interface of MBPI, but I don't (at the moment) have ideas for a better
interface. My direction I'm thinking in for a better interface is to
have MBPI actually retain much more state and make *all* of these
queries cheap. That's a lot of work, and would require invasive changes.
Until then, this seems like the least bad (ie, least quadratic)
solution. Suggestions welcome.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144530 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 09:12:57 +00:00
Chandler Carruth
c4e1562825 Reuse the logic in getEdgeProbability within getHotSucc in order to
correctly handle blocks whose successor weights sum to more than
UINT32_MAX. This is slightly less efficient, but the entire thing is
already linear on the number of successors. Calling it within any hot
routine is a mistake, and indeed no one is calling it. It also
simplifies the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144527 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 08:55:59 +00:00
Chandler Carruth
2770c14185 Fix an overflow bug in MachineBranchProbabilityInfo. This pass relied on
the sum of the edge weights not overflowing uint32, and crashed when
they did. This is generally safe as BranchProbabilityInfo tries to
provide this guarantee. However, the CFG can get modified during codegen
in a way that grows the *sum* of the edge weights. This doesn't seem
unreasonable (imagine just adding more blocks all with the default
weight of 16), but it is hard to come up with a case that actually
triggers 32-bit overflow. Fortuately, the single-source GCC build is
good at this. The solution isn't very pretty, but its no worse than the
previous code. We're already summing all of the edge weights on each
query, we can sum them, check for an overflow, compute a scale, and sum
them again.

I've included a *greatly* reduced test case out of the GCC source that
triggers it. It's a pretty lame test, as it clearly is just barely
triggering the overflow. I'd like to have something that is much more
definitive, but I don't understand the fundamental pattern that triggers
an explosion in the edge weight sums.

The buggy code is duplicated within this file. I'll colapse them into
a single implementation in a subsequent commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 08:50:16 +00:00
Chandler Carruth
883f2fab47 Add a cautionary note to this API. It was not at all obvious to me how
expensive the most useful interface to this analysis is.

Fun story -- it's also not correct. That's getting fixed in another
patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144523 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-14 06:51:49 +00:00
Craig Topper
f9fd29ea34 Fix comment for LegalizeTypeAction enum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144511 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 22:11:24 +00:00
Jakob Stoklund Olesen
2debd48ca7 Rename SlotIndexes to match how they are used.
The old naming scheme (load/use/def/store) can be traced back to an old
linear scan article, but the names don't match how slots are actually
used.

The load and store slots are not needed after the deferred spill code
insertion framework was deleted.

The use and def slots don't make any sense because we are using
half-open intervals as is customary in C code, but the names suggest
closed intervals.  In reality, these slots were used to distinguish
early-clobber defs from normal defs.

The new naming scheme also has 4 slots, but the names match how the
slots are really used.  This is a purely mechanical renaming, but some
of the code makes a lot more sense now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144503 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 20:45:27 +00:00
NAKAMURA Takumi
569561c7ee Prune more RALinScan. RALinScan was also here!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144487 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 01:33:10 +00:00
Jakob Stoklund Olesen
f5eeaf221c Delete the old spilling framework from LiveIntervalAnalysis.
This is dead code, all register allocators use InlineSpiller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144478 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-12 23:57:05 +00:00
Jakob Stoklund Olesen
799c1ede71 Delete the linear scan register allocator.
RegAllocGreedy has been the default for six months now.

Deleting RegAllocLinearScan makes it possible to also delete
VirtRegRewriter and clean up the spiller code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144475 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-12 22:39:45 +00:00
Eli Friedman
501852423d Don't try to form pre/post-indexed loads/stores until after LegalizeDAG runs. Fixes PR11029.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144438 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-12 00:35:34 +00:00
Nicolas Geoffray
7b8c2f8587 Add a custom safepoint method, in order for language implementers to decide which machine instruction gets to be a safepoint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144399 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-11 18:32:52 +00:00
Daniel Dunbar
dcd33e40b8 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144334 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 23:33:18 +00:00
Owen Anderson
39fe397421 Add additional checking to ensure that MachineMemOperands are never set to null, which can happen in weird circumstances where target intrinsic hooks are implemented incorrectly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144303 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 19:25:09 +00:00
Eric Christopher
ecfd04b272 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144198 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 18:53:37 +00:00
Eric Christopher
dfa30e1ab2 Remove the pubnames section, no one consumes it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144169 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 05:24:07 +00:00
Eli Friedman
5786b4cdc1 Enhance verifyLoop so that it can reliably verify that every block in a loop is reachable from the loop header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144166 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09 04:16:01 +00:00
Pete Cooper
d752e0f7e6 Added invariant field to the DAG.getLoad method and changed all calls.
When this field is true it means that the load is from constant (runt-time or compile-time) and so can be hoisted from loops or moved around other memory accesses


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144100 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 18:42:53 +00:00
Richard Osborne
19a4daff9b Don't introduce custom nodes after legalization in TargetLowering::BuildSDIV()
and TargetLowering::BuildUDIV(). Fixes PR11283


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143964 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 17:09:05 +00:00
Eric Christopher
09ac3d8413 Add the support code to enable the dwarf accelerator tables. Upcoming patches
to fix the types section (all types, not just global types), and testcases.

The code to do the final emission is disabled by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143923 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 09:24:32 +00:00
Craig Topper
4c763ee613 Add AVX2 variable shift instructions and intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143915 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 08:26:24 +00:00
Craig Topper
28692044db Add AVX2 VPMOVMASK instructions and intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143904 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 03:20:35 +00:00
Craig Topper
69f5df7778 Add AVX2 VEXTRACTI128 and VINSERTI128 instructions. Fix VPERM2I128 to be qualified with HasAVX2 instead of HasAVX. Mark VINSERTF128 and VEXTRACTF128 as never having side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143902 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 02:00:04 +00:00
Craig Topper
9595ede514 Fix accidental edit to __builtin_ia32_vperm2f128_ps256's name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143901 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 00:54:28 +00:00
Craig Topper
c8eb880a7f More AVX2 instructions and their intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143895 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-06 23:04:08 +00:00
Benjamin Kramer
5908536673 Replace (Lower|Upper)caseString in favor of StringRef's newest methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143891 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-06 20:37:06 +00:00
Daniel Dunbar
589fbb1770 ADT/StringRef: Add ::lower() and ::upper() methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143880 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-06 18:04:43 +00:00
Craig Topper
27e5d0c72a Add more AVX2 instructions and intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-06 06:12:20 +00:00
Benjamin Kramer
c25c908977 Add an option to pad an uleb128 to MCObjectWriter and remove the uleb128 encoding from the DWARF asm printer.
As a side effect we now print dwarf ulebs with .ascii directives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143809 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 11:52:44 +00:00
Benjamin Kramer
c09b770c13 Fix pasto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143802 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 09:45:17 +00:00
Benjamin Kramer
41a964931a Add more PRI.64 macros for MSVC and use them throughout the codebase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143799 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 08:57:40 +00:00
Daniel Dunbar
b0d9ce567f build/cmake: Use tblgen macro directly instead of llvm_tablegen, which just
added a layer of indirection with no value (not even conciseness).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143727 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 19:04:23 +00:00
Eli Friedman
84a6126937 Add missing includes/decls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 18:45:34 +00:00
Eli Friedman
73a1ad8f05 Add missing includes/class declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143718 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 18:30:30 +00:00
Eli Friedman
5cdf0700c7 Add missing forward declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143717 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 18:29:09 +00:00
Eli Friedman
06138ac569 Add a couple missing includes; found while analyzing LLVM headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143716 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 18:19:43 +00:00
Eli Friedman
b39e25ef2c Delete names for unused parameters in inline function definitions in headers, so LLVM users can compile with -Wunused-parameter. PR11257; based on patch by Kevin Harris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143715 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 18:11:56 +00:00
Chad Rosier
2fb655eefe Remove declarations for functions that don't exist (and never have).
Patch by Anders Waldenborg <anders@0x63.nu>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143705 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 17:07:11 +00:00
Craig Topper
018262768f Add intrinsics for X86 vcvtps2ph and vcvtph2ps instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143683 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 06:59:49 +00:00
Craig Topper
98e0b9c86d Add new X86 AVX2 VBROADCAST instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143612 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 07:35:53 +00:00
Chad Rosier
cde5464970 Remove some cruft from the BitcodeWriter, while still maintaining backward
compatibility in the BitcodeReader.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143598 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 00:14:01 +00:00
Michael J. Spencer
3314c26475 object: Add operator < for SymbolRef and SectionRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143563 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 19:33:41 +00:00
Michael J. Spencer
c8a55a660e Object/Archive: Add symbol table iteration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143561 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 19:33:12 +00:00
Chandler Carruth
37efc9fe42 Begin collecting some of the statistics for block placement discussed on
the mailing list. Suggestions for other statistics to collect would be
awesome. =]

Currently these are implemented as a separate pass guarded by a separate
flag. I'm not thrilled by that, but I wanted to be able to collect the
statistics for the old code placement as well as the new in order to
have a point of comparison. I'm planning on folding them into the single
pass if / when there is only one pass of interest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 07:17:12 +00:00
Craig Topper
205e3378fd More AVX2 instructions and intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143536 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 06:54:17 +00:00
Craig Topper
3f2b2c218f Add a bunch more X86 AVX2 instructions and their corresponding intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 04:42:13 +00:00
Kevin Enderby
613b757689 First part of support for generating dwarf for assembly source files with the
-g flag.  In this part we generate the .file for the source being assembled and
the .loc's for the assembled instructions.

The next part will be to generate the dwarf Compile Unit DIE and a dwarf
subprogram DIE for each non-temporary label.

Once the next part is done test cases will be added.  rdar://9275556


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 22:27:22 +00:00
Sebastian Pop
0173864d8a rename getHostTriple into getDefaultTargetTriple
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 21:32:20 +00:00
Sebastian Pop
de2e0b5e6d rename LLVM_HOSTTRIPLE into LLVM_DEFAULT_TARGET_TRIPLE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 21:31:44 +00:00
Daniel Dunbar
8f4a17214c Support/Compiler: Add LLVM_EXTENSION for use where we want to hide pedantic diags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143468 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 17:46:12 +00:00
Craig Topper
ce7de9f36d Fix operand type for x86 pmadd_ub_sw intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143455 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 07:25:22 +00:00