Commit Graph

69024 Commits

Author SHA1 Message Date
Evan Cheng
0521928ae7 Re-implement r122936 with proper target hooks. Now getMaxStoresPerMemcpy
etc. takes an option OptSize. If OptSize is true, it would return
the inline limit for functions with attribute OptSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122952 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 06:52:41 +00:00
Chris Lattner
8cd4efb6a5 implement constant folding support for an exotic constant expr:
ret i64 ptrtoint (i8* getelementptr ([1000 x i8]* @X, i64 1, i64 sub (i64 0, i64 ptrtoint ([1000 x i8]* @X to i64))) to i64)

to "ret i64 1000".  This allows us to correctly compute the trip count
on a loop in PR8883, which occurs with std::fill on a char array.  This
allows us to transform it into a memset with a constant size.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122950 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 06:19:46 +00:00
Evan Cheng
255874ff52 Revert r122936. I'll re-implement the change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122949 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 06:17:53 +00:00
Michael J. Spencer
238589ebf5 UnitTests/Path: Add magical tests. This will also test identify_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122948 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 05:58:02 +00:00
Michael J. Spencer
f9fd07864e UnitTests/Path: More ASSERT_NO_ERROR cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122947 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 05:57:54 +00:00
Cameron Zwarich
6cf34abe1c Add the CallInst optimizations that don't involve expanding inline assembly to
OptimizeInst() so that they can be used on a worklist instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122945 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 02:56:42 +00:00
Cameron Zwarich
865ae1a9e7 Move the GEP handling in CodeGenPrepare to OptimizeInst().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122944 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 02:44:52 +00:00
Cameron Zwarich
c061101e03 Split the optimizations in CodeGenPrepare that don't manipulate the iterators
into a separate function, so that it can be called from a loop using a worklist
rather than a loop traversing a whole basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 02:37:26 +00:00
Jakob Stoklund Olesen
19bb35db1f Zap the last two -Wself-assign warnings in llvm.
Simplify RALinScan::DowngradeRegister with TRI::getOverlaps while we are there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122940 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 01:33:22 +00:00
Jakob Stoklund Olesen
8bfe50871f Add the SpillPlacement analysis pass.
This pass precomputes CFG block frequency information that can be used by the
register allocator to find optimal spill code placement.

Given an interference pattern, placeSpills() will compute which basic blocks
should have the current variable enter or exit in a register, and which blocks
prefer the stack.

The algorithm is ready to consume block frequencies from profiling data, but for
now it gets by with the static estimates used for spill weights.

This is a work in progress and still not hooked up to RegAllocGreedy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122938 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 01:21:53 +00:00
Bill Wendling
05e353c4ed Fix test to coincide with r122934 change from PR8919.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122937 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 01:09:35 +00:00
Evan Cheng
9a9d847afa r105228 reduced the memcpy / memset inline limit to 4 with -Os to avoid blowing
up freebsd bootloader. However, this doesn't make much sense for Darwin, whose
-Os is meant to optimize for size only if it doesn't hurt performance.
rdar://8821501


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122936 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 01:04:47 +00:00
Evan Cheng
d08e5b48bc Avoid zero extend bit test operands to pointer type if all the masks fit in
the original type of the switch statement key.
rdar://8781238


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122935 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 01:02:44 +00:00
Bill Wendling
a99ec28134 PR8919 - LLVM incorrectly generates "_alloca" as the stack probing call. That
works only on MinGW32. On 64-bit, the function to call is "__chkstk".
Patch by KS Sreeram!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122934 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 00:50:34 +00:00
Bill Wendling
78d15761e4 PR8918 - When used with MinGW64, LLVM generates a "calll __main" at the
beginning of the "main" function. The assembler complains about the invalid
suffix for the 'call' instruction. The right instruction is "callq __main".
Patch by KS Sreeram!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122933 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 00:47:10 +00:00
Cameron Zwarich
8c3527e7a4 Stop reallocating SunkAddrs for each basic block. When we move to an instruction
worklist, the key will need to become std::pair<BasicBlock*, Value*>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122932 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 00:42:50 +00:00
Owen Anderson
e68713ae8b Reorder, rename, and document some members to make this easier to follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 23:26:22 +00:00
Evan Cheng
0b71d3972d Optimize:
r1025 = s/zext r1024, 4
  r1026 = extract_subreg r1025, 4
to:
  r1026 = copy r1024


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122925 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 23:06:49 +00:00
Chris Lattner
c010e61ae1 fix PR8900, a shuffle miscompilation. Patch by Nadav Rotem!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122921 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 22:28:46 +00:00
Chris Lattner
c46ec649b1 silence more self assignment warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122920 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 22:26:52 +00:00
Jakob Stoklund Olesen
6b705d4825 Add a hidden command line option to display edge bundle graphs as they are
calculated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122912 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:50:24 +00:00
Jakob Stoklund Olesen
7008f1e9ab Silence a warning from non-standard warning avoidance code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122911 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:50:21 +00:00
Eric Christopher
762a17a040 80-cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122909 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:45:56 +00:00
Owen Anderson
be41901d5a When computing the value on an edge, in certain cases LVI would fail to compute the value range
in the predecessor block, leading to an incorrect conclusion for the edge value.  Found by inspection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122908 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:37:18 +00:00
Bob Wilson
bfb7dd9e9e Revert svn 122743, removing the instcombine pass that was replaced by earlycse.
My i386 llvm-gcc nightly tester found a regression for
SingleSource/Benchmarks/McGill/chomp that a bisect blamed on 122743.
That seems strange but apparently the combination of earlycse and instcombine
did something bad.  Chris says he intended to remove the instcombine pass, so
let's go ahead and try that.  We'll see if there are any performance losses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:16:50 +00:00
Owen Anderson
89778462c0 Re-convert several of LazyValueInfo's internal maps to Dense{Map|Set}, and fix the issue in
hasBlockValue() that was causing iterator invalidations.  Many thanks to Dimitry Andric for
tracking down those invalidations!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122906 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:15:29 +00:00
Chris Lattner
54c6d6f42d fix some -Wself-assign warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122893 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 18:41:05 +00:00
Cameron Zwarich
073057f0d0 Add some more statistics to CodeGenPrepare.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122891 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 17:47:38 +00:00
Wesley Peck
3d2148f5ac Commit 122778 broke DWARF debug output when using the MBlaze backend. Fixed by overriding TargetFrameInfo::getFrameIndexOffset to take into account the new frame index information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122889 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 17:34:20 +00:00
Cameron Zwarich
31ff1333e0 Add some stats to CodeGenPrepare to make it easier to speed it up without
regressing code quality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122887 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 17:27:27 +00:00
Wesley Peck
4351bfbd4d Fix small bug in setDebugInfoAvailability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122886 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 17:01:57 +00:00
Michael J. Spencer
f94f7325ad UnitTests/Path: Fix typo, add error number, and enable the directory cleanup code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122885 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:39:46 +00:00
Michael J. Spencer
7fd682aaf2 Support/PathV2: Implement remove_all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122884 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:39:38 +00:00
Michael J. Spencer
277fa1047b Support/Windows/PathV2: Make directory iteration ignore . and ..
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122883 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:39:30 +00:00
Michael J. Spencer
abce07328c Support/Windows/PathV2: Fix remove to handle both files and directories.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122882 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:39:22 +00:00
Michael J. Spencer
5bcdc7f7c4 Support/PathV2: Implement directory_entry::status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122881 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:39:13 +00:00
Michael J. Spencer
2558516859 UnitTests/PathV2: Setup a test fixture to make tracking created file system
entities easier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122880 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:39:05 +00:00
Michael J. Spencer
da7c1cab8c Support/PathV2: Implement directory iteration on POSIX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122879 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:38:57 +00:00
Cameron Zwarich
1901925b78 Use pop_back_val instead of back followed by pop_back.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122876 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 16:08:47 +00:00
Frits van Bommel
c95ff3c422 Fix lit for people whose LLVM path contains 'opt', which is a common directory name on Unix-like systems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122873 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 15:10:24 +00:00
Cameron Zwarich
08602ab1b4 Use a worklist for later iterations just like ordinary instsimplify. The next
step is to only process instructions in subloops if they have been modified by
an earlier simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122869 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 05:47:47 +00:00
Cameron Zwarich
e389ab16f3 Change LoopInstSimplify back to a LoopPass. It revisits subloops rather than
skipping them, but it should probably use a worklist and only revisit those
instructions in subloops that have actually changed. It should probably also
use a worklist after the first iteration like instsimplify now does. Regardless,
it's only 0.3% of opt -O2 time on 403.gcc if it replaces the instcombine placed
in the middle of the loop passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122868 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 05:15:53 +00:00
Chris Lattner
be478819cb Fix PR8906: -fno-builtin should disable loop-idiom recognition.
It forms memset and memcpy's, and will someday form popcount and
other stuff.  All of this is bad when compiling the implementation
of memset, memcpy, popcount, etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122854 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 01:03:32 +00:00
Eric Christopher
2d31d14bac Remove TODO, these appear to be implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122849 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 22:31:50 +00:00
Owen Anderson
2cf7537dc6 Don't bother value numbering instructions with void types in GVN. In theory this should allow us to insert
fewer things into the value numbering maps, but any speedup is beneath the noise threshold on my machine
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122844 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 22:15:21 +00:00
Jakob Stoklund Olesen
631ee4b89f Use the EdgeBundles analysis in X86FloatingPoint instead of recomputing CFG
bundles in the pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122833 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 21:10:11 +00:00
Jakob Stoklund Olesen
8dd070edc2 Turn the EdgeBundles class into a stand-alone machine CFG analysis pass.
The analysis will be needed by both the greedy register allocator and the
X86FloatingPoint pass. It only needs to be computed once when the CFG doesn't
change.

This pass is very fast, usually showing up as 0.0% wall time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122832 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 21:10:05 +00:00
Dale Johannesen
1e08cd1eae Eliminate a warning compiling with llvm-gcc. (IMO the
warning is overzealous but gcc is what it is.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122829 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 19:31:24 +00:00
Owen Anderson
b1602abe63 Complete the NumberTable --> LeaderTable rename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122828 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 19:29:46 +00:00
Owen Anderson
a0709acd6f Fix typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122827 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 19:25:18 +00:00