Commit Graph

46230 Commits

Author SHA1 Message Date
Benjamin Kramer
546739656e InstCombine: If the divisor of an fdiv has an exact inverse, turn it into an fmul.
Fixes PR9587.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128546 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 15:42:35 +00:00
Benjamin Kramer
2746000f4f Add APFloat::getExactInverse.
The idea is, that if an ieee 754 float is divided by a power of two, we can
turn the division into a cheaper multiplication. This function sees if we can
get an exact multiplicative inverse for a divisor and returns it if possible.

This is the hard part of PR9587.

I tested many inputs against llvm-gcc's frotend implementation of this
optimization and didn't find any difference. However, floating point is the
land of weird edge cases, so any review would be appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128545 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 15:42:27 +00:00
Jay Foad
3ecfc861b4 Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 11:28:46 +00:00
Jay Foad
d8b4fb4aab (Almost) always call reserveOperandSpace() on newly created PHINodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128535 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 11:19:20 +00:00
Jakob Stoklund Olesen
f22ca3fe5f Treat clones the same as their origin.
When DCE clones a live range because it separates into connected components,
make sure that the clones enter the same register allocator stage as the
register they were cloned from.

For instance, clones may be split even when they where created during spilling.
Other registers created during spilling are not candidates for splitting or even
(re-)spilling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128524 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 02:52:39 +00:00
Bill Wendling
9f86e8054b Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 01:03:48 +00:00
Bill Wendling
87fa8d12b4 Set the unnamed_addr only when we're creating a new GV in the dest module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128507 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:31:06 +00:00
Bill Wendling
5f49c29612 Revert r128501. It caused test failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128506 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:28:02 +00:00
Jim Grosbach
83d808329b Tidy up. 80 columns and trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128504 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:20:22 +00:00
Evan Cheng
92e3916c3b Add intrinsics @llvm.arm.neon.vmulls and @llvm.arm.neon.vmullu.* back. Frontends
was lowering them to sext / uxt + mul instructions. Unfortunately the
optimization passes may hoist the extensions out of the loop and separate them.
When that happens, the long multiplication instructions can be broken into
several scalar instructions, causing significant performance issue.

Note the vmla and vmls intrinsics are not added back. Frontend will codegen them
as intrinsics vmull* + add / sub. Also note the isel optimizations for catching
mul + sext / zext are not changed either.

First part of rdar://8832507, rdar://9203134


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:06:19 +00:00
Bill Wendling
75c7563f83 We need to copy over the unnamed_addr attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:05:41 +00:00
Benjamin Kramer
9822b869fc InstCombine: Add a few missing combines for ANDs and ORs of sign bit tests.
On x86 we now compile "if (a < 0 && b < 0)" into
	testl	%edi, %esi
	js	IF.THEN

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128496 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 22:06:41 +00:00
Cameron Zwarich
3007d3331b Add Neon SINT_TO_FP and UINT_TO_FP lowering from v4i16 to v4f32. Fixes
<rdar://problem/8875309> and <rdar://problem/9057191>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128492 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 21:41:55 +00:00
Jakob Stoklund Olesen
6094bd87d8 Recompute register class and hint for registers created during spilling.
The spill weight is not recomputed for an unspillable register - it stays infinite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128490 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 21:20:19 +00:00
Kevin Enderby
360d8d7a02 Added support symbolic floating point constants in the MC assembler for Infinity
and Nans with the same strings as GAS supports.  rdar://8673024


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128488 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 21:11:52 +00:00
Jim Grosbach
5acfa9f0fd Instantiate a JITMemoryManager for MCJIT Dyld
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 21:03:05 +00:00
Benjamin Kramer
ec3f227820 DSE: Remove an early exit optimization that depended on the ordering of a SmallPtrSet.
Fixes PR9569 and will hopefully make selfhost on ASLR-enabled systems more deterministic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128482 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 20:28:57 +00:00
Owen Anderson
d0cfc99b30 Check early if this is an unsupported opcode, so that we can avoid needlessly instantiating the base register in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128481 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 20:27:38 +00:00
Johnny Chen
9eda569a74 A8.6.188 STC, STC2
The STC_OPTION and STC2_OPTION instructions should have their coprocessor option enclosed in {}.

rdar://problem/9200661


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128478 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 19:49:38 +00:00
Jakob Stoklund Olesen
cf610d07de Remember to use the correct register when rematerializing for snippets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128469 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 17:47:02 +00:00
Jakob Stoklund Olesen
c1d22d8adb Run dead code elimination immediately after rematerialization.
This may eliminate some uses of the spilled registers, and we don't want to
insert reloads for that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128468 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 17:47:00 +00:00
Owen Anderson
9eae80051b Add safety check that didn't show up in testing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128467 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 17:42:25 +00:00
Bill Wendling
3f782f4d75 Inline check that's used only once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128465 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 17:12:55 +00:00
Owen Anderson
848b0c39b1 Get rid of the non-writeback versions VLDMDB and VSTMDB, which don't actually exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128461 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 16:45:53 +00:00
Bill Wendling
3c288b9787 Rework the logic (and removing the bad check for an unreachable block) so that
the FailBB dominator is correctly calculated. Believe it or not, there isn't a
functionality change here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128455 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 07:28:52 +00:00
Cameron Zwarich
9827b78b51 Do some simple copy propagation through integer loads and stores when promoting
vector types. This helps a lot with inlined functions when using the ARM soft
float ABI. Fixes <rdar://problem/9184212>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128453 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 05:19:52 +00:00
Bill Wendling
ad7d8a598b Don't try to add stack protector logic to a dead basic block. It messes up
dominator information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128452 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 05:15:48 +00:00
Bill Wendling
0f41587909 Spruce up the error output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128451 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 04:28:26 +00:00
Jakob Stoklund Olesen
c8ec765551 Handle the special case when all uses follow the last split point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128450 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 03:12:04 +00:00
Jakob Stoklund Olesen
2ef661b0e8 Properly enable rematerialization when spilling after live range splitting.
The instruction to be rematerialized may not be the one defining the register
that is being spilled. The traceSiblingValue() function sees through sibling
copies to find the remat candidate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128449 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 03:12:02 +00:00
Evan Cheng
78fe9ababe Optimizing (zext A + zext B) * C, to (VMULL A, C) + (VMULL B, C) during
isel lowering to fold the zero-extend's and take advantage of no-stall
back to back vmul + vmla:
 vmull q0, d4, d6
 vmlal q0, d5, d6
is faster than
 vaddl q0, d4, d5
 vmovl q1, d6                                                                                                                                                                             
 vmul  q0, q0, q1

This allows us to vmull + vmlal for:
    f = vmull_u8(   vget_high_u8(s), c);
    f = vmlal_u8(f, vget_low_u8(s),  c);

rdar://9197392


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128444 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 01:56:09 +00:00
Francois Pichet
79abc9dd4a Fix the MSVC build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128441 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 00:30:01 +00:00
Bill Wendling
2d930db24f In some cases, the "fail BB dominator" may be null after the BB was split (and
becomes reachable when before it wasn't). Check to make sure that it's not null
before trying to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128434 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 23:02:18 +00:00
Daniel Dunbar
a7b8c2b6a4 Integrated-As: Add support for setting the AllowTemporaryLabels flag via
integrated-as.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128431 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 22:49:19 +00:00
Daniel Dunbar
c6cf43d258 MC: Add support for disabling "temporary label" behavior. Useful for debugging
on Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128430 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 22:49:15 +00:00
Ted Kremenek
cede7c0551 Unbreak CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128426 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 20:43:53 +00:00
Johnny Chen
d560a80925 Fix ARM disassembly for PLD/PLDW/PLI which suffers from code rot and add some test cases.
Add comments to ThumbDisassemblerCore.h for recent change made for t2PLD disassembly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128417 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 18:41:58 +00:00
Kevin Enderby
93f7936435 Again adding a C API to the disassembler for use by such tools as Darwin's
otool(1), this time with the needed fix for case sensitive file systems :) .
This is a work in progress as the interface for producing symbolic operands is
not done.  But a hacked prototype using information from the object file's
relocation entiries and replacing immediate operands with MCExpr's has been
shown to work with no changes to the instrucion printer.  These APIs will be
moved into a dynamic library at some point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128415 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 18:25:07 +00:00
Nick Lewycky
2bf026e375 Remove tabs I accidentally added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 17:48:26 +00:00
Jay Foad
fd4a5497b6 Make more use of PHINode::getNumIncomingValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128406 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 13:03:10 +00:00
Che-Liang Chiou
fb4a8344b6 ptx: clean up branch code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128405 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 10:23:13 +00:00
Frits van Bommel
f56762a96d Add some debug output when -instcombine uses RAUW. This can make debug output for those cases much clearer since without this it only showed that the original instruction was removed, not what it was replaced with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128399 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 23:32:31 +00:00
Jakob Stoklund Olesen
ef1f5ccca7 Amend debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 22:49:23 +00:00
Jakob Stoklund Olesen
eb29157d80 Drop interference reassignment in favor of eviction.
The reassignment phase was able to move interference with a higher spill weight,
but it didn't happen very often and it was fairly expensive.

The existing interference eviction picks up the slack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128397 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 22:49:21 +00:00
Nick Lewycky
675619ca38 Teach the transformation that moves binary operators around selects to preserve
the subclass optional data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 19:51:23 +00:00
Benjamin Kramer
d655e6e9dc Use APInt's umul_ov instead of rolling our own overflow detection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128380 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 15:04:38 +00:00
Frits van Bommel
6208610fd6 Constant folding support for calls to umul.with.overflow(), basically identical to the smul.with.overflow() code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 14:26:13 +00:00
Nick Lewycky
98cd75027c Add a small missed optimization: turn X == C ? X : Y into X == C ? C : Y. This
removes one use of X which helps it pass the many hasOneUse() checks.

In my analysis, this turns up very often where X = A >>exact B and that can't be
simplified unless X has one use (except by increasing the lifetime of A which is
generally a performance loss).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128373 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 07:30:57 +00:00
NAKAMURA Takumi
d645151ac6 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 01:44:40 +00:00
Jakob Stoklund Olesen
e9c50732f7 Use individual register classes when spilling snippets.
The main register class may have been inflated by live range splitting, so that
register class is not necessarily valid for the snippet instructions.

Use the original register class for the stack slot interval.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128351 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 22:16:41 +00:00