Commit Graph

44735 Commits

Author SHA1 Message Date
Tobias Grosser
46431d7a93 InstCombine: Match min/max hidden by sext/zext
X = sext x; x >s c ? X : C+1 --> X = sext x; X <s C+1 ? C+1 : X
X = sext x; x <s c ? X : C-1 --> X = sext x; X >s C-1 ? C-1 : X
X = zext x; x >u c ? X : C+1 --> X = zext x; X <u C+1 ? C+1 : X
X = zext x; x <u c ? X : C-1 --> X = zext x; X >u C-1 ? C-1 : X
X = sext x; x >u c ? X : C+1 --> X = sext x; X <u C+1 ? C+1 : X
X = sext x; x <u c ? X : C-1 --> X = sext x; X >u C-1 ? C-1 : X

Instead of calculating this with mixed types promote all to the
larger type. This enables scalar evolution to analyze this
expression. PR8866

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123034 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:33:14 +00:00
Tobias Grosser
8d088bd1e4 Some whitespace fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123033 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:33:13 +00:00
Devang Patel
1dea232624 Appropriately truncate debug info range in dwarf output.
Enable live debug variables pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:30:41 +00:00
Evan Cheng
30a343aeed DBG_VALUE does not have any side effects; it also makes no sense to mark it cheap as a copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123031 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:08:26 +00:00
Benjamin Kramer
eaff66a895 Revert 122959, it needs more thought. Add it back to README.txt with additional notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123030 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:42:20 +00:00
Jay Foad
8e3914d12e Simplify the allocation and freeing of Users' operand lists, now that
every BranchInst has a fixed number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123027 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:29:02 +00:00
Jay Foad
8f9ffbd056 Remove all uses of the "ugly" method BranchInst::setUnconditionalDest().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123025 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:25:56 +00:00
Evan Cheng
a5e1362f96 Revert r122955. It seems using movups to lower memcpy can cause massive regression (even on Nehalem) in edge cases. I also didn't see any real performance benefit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123015 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 19:35:30 +00:00
Bob Wilson
5e8b833707 Add ARM patterns to match EXTRACT_SUBVECTOR nodes.
Also fix an off-by-one in SelectionDAGBuilder that was preventing shuffle
vectors from being translated to EXTRACT_SUBVECTOR.
Patch by Tim Northover.

The test changes are needed to keep those spill-q tests from testing aligned
spills and restores.  If the only aligned stack objects are spill slots, we
no longer realign the stack frame.  Prior to this patch, an EXTRACT_SUBVECTOR
was legalized by loading from the stack, which created an aligned frame index.
Now, however, there is nothing except the spill slot in the stack frame, so
I added an aligned alloca.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:59:04 +00:00
Bob Wilson
67b067d2f9 Fix a comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122994 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:58:58 +00:00
Bob Wilson
6736e19f4c Change EXTRACT_SUBVECTOR to require a constant index.
We were never generating any of these nodes with variable indices, and there
was one legalizer function asserting on a non-constant index.  If we ever have
a need to support variable indices, we can add this back again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122993 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:58:56 +00:00
Bill Wendling
8d90b7190f Early exit if we don't have invokes. The 'Unwinds' vector isn't modified unless
we have invokes, so there is no functionality change here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122990 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 02:54:45 +00:00
Duncan Sands
d9aa80038f Fix the other problem reported in PR8582. Testcase and patch by
Nadav Rotem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122983 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 23:45:22 +00:00
Eric Christopher
8d93d19076 Add some fairly duplicated code to let type legalization split illegal
typed atomics. This will lower exclusively to libcalls at the moment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122979 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 22:28:56 +00:00
Chris Lattner
01cdc2016d With Benjamin's recent amazing patches, we should be able to do even better things :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122978 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 22:25:00 +00:00
Chris Lattner
f1cadf2899 use isNullValue() to simplify code, add an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122977 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 22:24:29 +00:00
Devang Patel
76a788c886 Emit 128 bit constant.
This fixes PR 8913 crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 21:39:25 +00:00
Bob Wilson
6819dbb6f8 PR8921: LDM/POP do not support interworking prior to v5t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 19:24:41 +00:00
Bob Wilson
28f1015e36 Remove extra whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 19:24:36 +00:00
Bob Wilson
0fef58465c Fix comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122968 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 19:24:32 +00:00
Benjamin Kramer
fa36680076 Add a note from llvmdev, this time with more info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122966 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 17:35:50 +00:00
Abramo Bagnara
4bb46f43eb Fixed parsing of hex floats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122963 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 16:55:14 +00:00
Rafael Espindola
2f867a63da Correctly disassemble truncated asm.
Patch by Richard Simth.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 16:48:42 +00:00
Benjamin Kramer
8143a84c46 InstCombine: Turn _chk functions into the "unsafe" variant if length and max langth are equal.
This happens when we take the (non-constant) length from a malloc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 14:22:52 +00:00
Benjamin Kramer
7d9f51f4b5 EarlyCSE does this now (and GVN always did it).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122960 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 13:19:46 +00:00
Benjamin Kramer
240d42d185 InstCombine: If we call llvm.objectsize on a malloc call we can replace it with the size passed to malloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122959 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 13:11:05 +00:00
Benjamin Kramer
783a5c2b69 InstCombine: Teach llvm.objectsize folding to look through GEPs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122958 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 13:07:49 +00:00
Benjamin Kramer
5191e7cc26 Remove dead code and silence warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122957 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 13:01:02 +00:00
Evan Cheng
461f1fc359 Use movups to lower memcpy and memset even if it's not fast (like corei7).
The theory is it's still faster than a pair of movq / a quad of movl. This
will probably hurt older chips like P4 but should run faster on current
and future Intel processors. rdar://8817010


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122955 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 07:58:36 +00:00
Chris Lattner
cce240d26b add a note about object size from drystone, add a poorly optimized loop from 179.art.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122954 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 07:41:22 +00:00
Chris Lattner
c1853e4a03 add a trivial instcombine missed in Dhrystone
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 07:09:23 +00:00
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
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
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