1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

45391 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
acdd9ab5ff Avoid folding a load instruction into an instruction that redefines the register.
The target hook doesn't know how to do that. (Neither do I).

llvm-svn: 125108
2011-02-08 19:33:55 +00:00
David Greene
1fc808c066 [AVX] Implement BUILD_VECTOR lowering for 256-bit vectors. For
anything but the simplest of cases, lower a 256-bit BUILD_VECTOR by
splitting it into 128-bit parts and recombining.

llvm-svn: 125105
2011-02-08 19:04:41 +00:00
Jakob Stoklund Olesen
d5ad17c42b Add SplitEditor::overlapIntv() to create small ranges where both registers are live.
If a live range is used by a terminator instruction, and that live range needs
to leave the block on the stack or in a different register, it can be necessary
to have both sides of the split live at the terminator instruction.

Example:

  %vreg2 = COPY %vreg1
  JMP %vreg1

Becomes after spilling %vreg2:

  SPILL %vreg1
  JMP %vreg1

The spill doesn't kill the register as is normally the case.

llvm-svn: 125102
2011-02-08 18:50:21 +00:00
Jakob Stoklund Olesen
5a0048302f Add assertion.
llvm-svn: 125101
2011-02-08 18:50:18 +00:00
Andrew Trick
3286438277 Fix PostRA antidependence breaker.
Avoid using the same register for two def operands or and earlyclobber
def and use operand. This fixes PR8986 and improves on the prior fix
for rdar://problem/8959122.

llvm-svn: 125089
2011-02-08 17:39:46 +00:00
Evan Cheng
ce4ff6b69e Temporary workaround for a bad bug introduced by r121082 which replaced
t2LDRpci with t2LDRi12.
There are a couple of problems with this.
1. The encoding for the literal and immediate constant are different.
   Note bit 7 of the literal case is 'U' so it can be negative.
2. t2LDRi12 is now narrowed to tLDRpci before constant island pass is run.
   So we end up never using the Thumb2 instruction, which ends up creating a
   lot more constant islands.

llvm-svn: 125074
2011-02-08 03:07:03 +00:00
Dan Gohman
ae7dba9ba8 Don't split any loop backedges, including backedges of loops other than
the active loop. This is generally desirable, and it avoids trouble
in situations such as the testcase in PR9123, though the failure
mode depends on use-list order, so it is infeasible to test.

llvm-svn: 125065
2011-02-08 00:55:13 +00:00
Jakob Stoklund Olesen
a5e0ea6e4e Add LiveIntervals::shrinkToUses().
After uses of a live range are removed, recompute the live range to only cover
the remaining uses. This is necessary after rematerializing the value before
some (but not all) uses.

llvm-svn: 125058
2011-02-08 00:03:05 +00:00
Benjamin Kramer
04249128ab SimplifyCFG: Track the number of used icmps when turning a icmp chain into a switch. If we used only one icmp, don't turn it into a switch.
Also prevent the switch-to-icmp transform from creating identity adds, noticed by Marius Wachtler.

llvm-svn: 125056
2011-02-07 22:37:28 +00:00
Bruno Cardoso Lopes
0ce5b0f4a8 Add support for parsing dmb/dsb instructions
llvm-svn: 125055
2011-02-07 22:09:15 +00:00
Devang Patel
2c62329722 Remove comment about an argument that was removed couple of years ago.
llvm-svn: 125054
2011-02-07 21:58:52 +00:00
Bruno Cardoso Lopes
0695c35ca2 Remove the MCR asm parser hack and start using the custom target specific asm
parsing of operands introduced in r125030. As a small note, besides using a more
generic approach we can also have more descriptive output when debugging
llvm-mc, example:

mcr  p7, #1, r5, c1, c1, #4

note: parsed instruction:
  ['mcr', <ARMCC::al>,
          <coprocessor number: 7>,
          1,
          <register 73>,
          <coprocessor register: 1>,
          <coprocessor register: 1>,
          4]
llvm-svn: 125052
2011-02-07 21:41:25 +00:00
Chris Lattner
b641eb91a3 fix comment change.
llvm-svn: 125047
2011-02-07 20:03:14 +00:00
David Greene
597e995e8d [AVX] Insert/extract subvector lowering support. This includes a
couple of utility functions that will be used in other places for more
AVX lowering.

llvm-svn: 125029
2011-02-07 19:36:54 +00:00
Jason W Kim
1a423a93dc ARM/MC/ELF Lowercase .cpu attributes in .s, but make them uppercase in .o
llvm-svn: 125025
2011-02-07 19:07:11 +00:00
Evan Cheng
56b78e409e Fix an obvious typo which caused an isel assertion. rdar://8964854.
llvm-svn: 125023
2011-02-07 18:50:47 +00:00
Bob Wilson
65f4a70b82 Add codegen support for using post-increment NEON load/store instructions.
The vld1-lane, vld1-dup and vst1-lane instructions do not yet support using
post-increment versions, but all the rest of the NEON load/store instructions
should be handled now.

llvm-svn: 125014
2011-02-07 17:43:21 +00:00
Bob Wilson
46b105c6a2 Change VLD3/4 and VST3/4 for quad registers to not update the address register.
These operations are expanded to pairs of loads or stores, and the first one
uses the address register update to produce the address for the second one.
So far, the second load/store has also updated the address register, just
for convenience, since that output has never been used.  In anticipation of
actually supporting post-increment updates for these operations, this changes
the non-updating operations to use a non-updating load/store for the second
instruction.

llvm-svn: 125013
2011-02-07 17:43:15 +00:00
Bob Wilson
cdda05b3cc Fix some NEON instruction itineraries.
llvm-svn: 125012
2011-02-07 17:43:12 +00:00
Bob Wilson
b35115db20 Fix a comment: addrmode6 no longer includes the optional writeback flag.
llvm-svn: 125011
2011-02-07 17:43:09 +00:00
Bob Wilson
e742c362e3 Remove inaccurate comments: so_imm and t2_so_imm operands are not encoded
until the instructions are emitted or printed.

llvm-svn: 125010
2011-02-07 17:43:06 +00:00
Bob Wilson
382d661f6a Move code for OffsetCompare struct closer to where it is used.
llvm-svn: 125009
2011-02-07 17:43:03 +00:00
Chris Lattner
2fd09e3397 implement .ll and .bc support for nsw/nuw on shl and exact on lshr/ashr.
Factor some code better.

llvm-svn: 125006
2011-02-07 16:40:21 +00:00
Duncan Sands
7c3f34d524 Add an m_Div pattern for matching either a udiv or an sdiv and use it
to simplify the "(X/Y)*Y->X when the division is exact" transform.

llvm-svn: 125004
2011-02-07 09:36:32 +00:00
Jason W Kim
7342155b4c Teach ARM/MC/ELF about gcc compatible reloc output to get past odd linkage
failures with relocations.

The code committed is a first cut at compatibility for emitted relocations in
ELF .o.

Why do this? because existing ARM tools like emitting relocs symbols as
explicit relocations, not as section-offset relocs.

Result is that with these changes,
1) relocs are now substantially identical what to gcc outputs.
2) larger apps (including many spec2k tests) compile, cross-link, and pass

Added reminder fixme to tests for future conversion to .s form.

llvm-svn: 124996
2011-02-07 01:11:15 +00:00
Jason W Kim
b0d4492aa1 Rework some .ARM.attribute work for improved gcc compatibility.
Unified EmitTextAttribute for both Asm and Obj emission (.cpu only)
Added necessary cortex-A8 related attrs for codegen compat tests.

llvm-svn: 124995
2011-02-07 00:49:53 +00:00
Chris Lattner
1c1b342a62 teach instsimplify to transform (X / Y) * Y to X
when the div is an exact udiv.

llvm-svn: 124994
2011-02-06 22:05:31 +00:00
Chris Lattner
7b6a968f5d enhance vmcore to know that udiv's can be exact, and add a trivial
instcombine xform to exercise this.

Nothing forms exact udivs yet though.  This is progress on PR8862

llvm-svn: 124992
2011-02-06 21:44:57 +00:00
Eric Christopher
b81307b728 Remove premature optimization that avoided calculating argument weights
if we weren't going to inline the function. The rest of the code using
this was removed.

Fixes PR9154.

llvm-svn: 124991
2011-02-06 21:27:46 +00:00
Anders Carlsson
61133e38a9 Simplify test, as suggested by Chris.
llvm-svn: 124990
2011-02-06 20:22:49 +00:00
Anders Carlsson
61f2126479 Remove a virtual inheritance case that clang can devirtualize fully now.
llvm-svn: 124989
2011-02-06 20:16:49 +00:00
Anders Carlsson
1eeebf1c22 When loading from a constant, fold inttoptr if the integer type and the resulting pointer type both have the same size.
llvm-svn: 124987
2011-02-06 20:11:56 +00:00
Nick Lewycky
7e863fb906 Simplify away redundant test, and document what's going on.
llvm-svn: 124977
2011-02-06 05:04:00 +00:00
Nick Lewycky
fb03aee332 Remove specialized comparison of InlineAsm objects. They're uniqued on creation
now, and this wasn't comparing some of their relevant bits anyhow.

llvm-svn: 124976
2011-02-06 04:33:50 +00:00
Anders Carlsson
96a35fc26e Fix another warning.
llvm-svn: 124961
2011-02-05 18:33:43 +00:00
Anders Carlsson
909058c68b Fix a clang warning.
llvm-svn: 124960
2011-02-05 18:19:35 +00:00
NAKAMURA Takumi
aa8b506820 Windows/DynamicLibrary.inc: Split explicit symbols into explicit_symbols.inc.
config.h.* have conditions whether each symbol is defined or not.
Autoconf and CMake may check symbols in libgcc.a for JIT on Mingw.

llvm-svn: 124950
2011-02-05 15:11:53 +00:00
NAKAMURA Takumi
07a84f5950 Target/X86: Tweak allocating shadow area (aka home) on Win64. It must be enough for caller to allocate one.
llvm-svn: 124949
2011-02-05 15:11:32 +00:00
NAKAMURA Takumi
5ae1b1d643 lib/Target/X86/X86ISelLowering.cpp: Introduce a new variable "IsWin64". No functional changes.
llvm-svn: 124948
2011-02-05 15:11:13 +00:00
NAKAMURA Takumi
4f4192b398 lib/Target/X86/X86JITInfo.cpp: Add Win64 stuff.
llvm-svn: 124947
2011-02-05 15:11:03 +00:00
NAKAMURA Takumi
c4522ab931 Target/X86: Fix whitespace.
llvm-svn: 124946
2011-02-05 15:10:54 +00:00
NAKAMURA Takumi
6008a70d4a Windows/Program.inc: Quote arguments when dubious characters (used by cmd.exe or MSYS shell) are included to invoke CreateProcess(). Thanks to Danil Malyshev.
llvm-svn: 124945
2011-02-05 08:53:12 +00:00
Andrew Trick
2cdb14d30b Fix an anti-dep breaker corner case.
<rdar://problem/8959122> illegal register operands for UMULL instruction in cfrac nightly test
I'm stil working on a unit test, but the case is:
rx = movcc rx, r3
r2 = ldr
r2, r3 = umull r2, r2

The anti-dep breaker should not convert this into an illegal instruction:
r2, r2 = umull

llvm-svn: 124932
2011-02-05 02:58:46 +00:00
Eric Christopher
6dbf0c6bbe Fix cut and paste error spotted by Jakob.
llvm-svn: 124930
2011-02-05 02:48:47 +00:00
Jakob Stoklund Olesen
2a26f7f183 Be more strict about the first/last interference-free use.
If the interference overlaps the instruction, we cannot separate it.

llvm-svn: 124918
2011-02-05 01:06:39 +00:00
Jakob Stoklund Olesen
99be342f10 Add assertions to verify that the new interval is clear of the interference.
If these inequalities don't hold, we are creating a live range split that won't
allocate.

llvm-svn: 124917
2011-02-05 01:06:36 +00:00
Eric Christopher
ddc2157034 Rewrite how the indirect call bonus is handled. This now works by:
a) Making it a per call site bonus for functions that we can move from
indirect to direct calls.
b) Reduces the bonus from 500 to 100 per call site.
c) Subtracts the size of the possible newly inlineable call from the
bonus to only add a bonus if we can inline a small function to devirtualize
it.

Also changes the bonus from a positive that's subtracted to a negative
that's added.

Fixes the remainder of rdar://8546196 by reducing the object file size
after inlining by 84%.

llvm-svn: 124916
2011-02-05 00:49:15 +00:00
David Greene
50efbf730f [AVX] Revert 124910 until clients are ready.
llvm-svn: 124912
2011-02-05 00:24:41 +00:00
David Greene
0b0ec3aed7 [AVX] Add some utilities to insert and extract 128-bit subvectors.
This allows us to easily support 256-bit operations that don't have
native 256-bit support.  This applies to integer operations, certain
types of shuffles and various othher things.

llvm-svn: 124910
2011-02-04 23:29:33 +00:00
Jakob Stoklund Olesen
b416dbf12e Apparently, it is possible for a block with a landing pad successor to have no calls.
In that case we simply ignore the landing pad and split live ranges before the
first terminator.

llvm-svn: 124907
2011-02-04 23:11:13 +00:00
Devang Patel
930b4b16a1 Merge .debug_loc entries whenever possible to reduce debug_loc size.
llvm-svn: 124904
2011-02-04 22:57:18 +00:00
Nick Lewycky
a4f2b5a934 Mark that the return is using EAX so that we don't use it for some other
purpose. Fixes PR9080!

llvm-svn: 124903
2011-02-04 22:44:08 +00:00
Jakob Stoklund Olesen
8de536be92 Be more accurate about live range splitting at the end of blocks.
If interference reaches the last split point, it is effectively live out and
should be marked as 'MustSpill'.

This can make a difference when the terminator uses a register. There is no way
that register can be reused in the outgoing CFG bundle, even if it isn't live
out.

llvm-svn: 124900
2011-02-04 21:42:06 +00:00
Jason W Kim
056e5aacb7 Teach ARM/MC/ELF about EF_ARM_EABI_VERSION. The magic number is set to
5 to match the current doc.
Added FIXME reminder Make it really configurable later.

llvm-svn: 124899
2011-02-04 21:41:11 +00:00
Jason W Kim
10c1a81736 Teach ARM/MC/ELF to handle R_ARM_JUMP24 relocation type for conditional jumps.
(yes, this is different from R_ARM_CALL)

- Adds a new method getARMBranchTargetOpValue() which handles the
  necessary distinction between the conditional and unconditional br/bl
  needed for ARM/ELF

At least for ARM mode, the needed fixup for conditional versus unconditional
br/bl is identical, but the ARM docs and existing ARM tools expect this
reloc type...

Added a few FIXME's for future naming fixups in ARMInstrInfo.td

llvm-svn: 124895
2011-02-04 19:47:15 +00:00
Jakob Stoklund Olesen
bf833680ec Add LiveIntervals::getLastSplitPoint().
A live range cannot be split everywhere in a basic block. A split must go before
the first terminator, and if the variable is live into a landing pad, the split
must happen before the call that can throw.

llvm-svn: 124894
2011-02-04 19:33:11 +00:00
Jakob Stoklund Olesen
0ceb8d032a Verify that one of the ranges produced by region splitting is allocatable.
We should not be attempting a region split if it won't lead to at least one
directly allocatable interval. That could cause infinite splitting loops.

llvm-svn: 124893
2011-02-04 19:33:07 +00:00
Daniel Dunbar
622bb34af8 MC/AsmParser: Add support for allowing the conversion process to fail (via
custom conversion functions).

llvm-svn: 124872
2011-02-04 17:12:23 +00:00
David Greene
7de7347ee8 [AVX] Support VSINSERTF128 with more patterns and appropriate
infrastructure.  This makes lowering 256-bit vectors to 128-bit
vectors simple when 256-bit vector support is not available.

llvm-svn: 124868
2011-02-04 16:08:29 +00:00
NAKAMURA Takumi
872c15ce42 Make Win32's header file name lower for cross build on case-sensitive filesystem.
llvm-svn: 124864
2011-02-04 12:53:04 +00:00
Andrew Trick
09aa9fe96b Introducing a new method of tracking register pressure. We can't
precisely track pressure on a selection DAG, but we can at least keep
it balanced. This design accounts for various interesting aspects of
selection DAGS: register and subregister copies, glued nodes, dead
nodes, unused registers, etc.

Added SUnit::NumRegDefsLeft and ScheduleDAGSDNodes::RegDefIter.

Note: I disabled PrescheduleNodesWithMultipleUses when register
pressure is enabled, based on no evidence other than I don't think it
makes sense to have both enabled.

llvm-svn: 124853
2011-02-04 03:18:17 +00:00
Devang Patel
a586bb8ecd DebugLoc associated with a machine instruction is used to emit location entries. DebugLoc associated with a DBG_VALUE is used to identify lexical scope of the variable. After register allocation, while inserting DBG_VALUE remember original debug location for the first instruction and reuse it, otherwise dwarf writer may be mislead in identifying the variable's scope.
llvm-svn: 124845
2011-02-04 01:43:25 +00:00
Evan Cheng
dda52de359 Update comments.
llvm-svn: 124843
2011-02-04 01:10:12 +00:00
Jakob Stoklund Olesen
097e61e40f Skip unused values.
llvm-svn: 124842
2011-02-04 00:59:23 +00:00
Jakob Stoklund Olesen
89c57d3a69 Also compute interference intervals for blocks with no uses.
When the live range is live through a block that doesn't use the register, but
that has interference, region splitting wants to split at the top and bottom of
the basic block.

llvm-svn: 124839
2011-02-04 00:39:20 +00:00
Jakob Stoklund Olesen
f61ad513fc Verify kill flags conservatively.
Allow a live range to end with a kill flag, but don't allow a kill flag that
doesn't end the live range.

This makes the machine code verifier more useful during register allocation when
kill flag computation is deferred.

llvm-svn: 124838
2011-02-04 00:39:18 +00:00
Bob Wilson
f6a7104e41 Do not sign extend floating-point values in the asm parser.
llvm-svn: 124831
2011-02-03 23:17:47 +00:00
Andrew Trick
8f8918816d whitespace
llvm-svn: 124827
2011-02-03 23:00:17 +00:00
Benjamin Kramer
75785ec972 SimplifyCFG: Also transform switches that represent a range comparison but are not sorted into sub+icmp.
This transforms another 1000 switches in gcc.c.

llvm-svn: 124826
2011-02-03 22:51:41 +00:00
Bob Wilson
a1584cee86 Fix 80-column violations and whitespace.
llvm-svn: 124819
2011-02-03 21:46:10 +00:00
Jakob Stoklund Olesen
d59988aebb Ensure that the computed interference intervals actually overlap their basic blocks.
llvm-svn: 124815
2011-02-03 20:29:43 +00:00
Jakob Stoklund Olesen
bb8328dcda Tweak debug output from SlotIndexes.
llvm-svn: 124814
2011-02-03 20:29:41 +00:00
Jakob Stoklund Olesen
1451898887 Add debug output and asserts to the phi-connecting code.
llvm-svn: 124813
2011-02-03 20:29:39 +00:00
Jakob Stoklund Olesen
eb29913703 Fix coloring bug when mapping values in the middle of a live-through block.
If the found value is not live-through the block, we should only add liveness up
to the requested slot index. When the value is live-through, the whole block
should be colored.

Bug found by SSA verification in the machine code verifier.

llvm-svn: 124812
2011-02-03 20:29:36 +00:00
Jakob Stoklund Olesen
319f2bbf2b Return live range end points from SplitEditor::enter*/leave*.
These end points come from the inserted copies, and can be passed directly to
useIntv. This simplifies the coloring code.

llvm-svn: 124799
2011-02-03 17:04:16 +00:00
Jakob Stoklund Olesen
e3aabdc892 Silence an MSVC warning
llvm-svn: 124798
2011-02-03 17:04:12 +00:00
David Greene
2753be260c [AVX] VEXTRACTF128 support. This commit includes patterns for
matching EXTRACT_SUBVECTOR to VEXTRACTF128 along with support routines
to examine and translate index values.  VINSERTF128 comes next.  With
these two in place we can begin supporting more AVX operations as
INSERT/EXTRACT can be used as a fallback when 256-bit support is not
available.

llvm-svn: 124797
2011-02-03 15:50:00 +00:00
Richard Osborne
5c655f451e Add XCore intrinsics for resource instructions.
llvm-svn: 124794
2011-02-03 13:14:25 +00:00
Duncan Sands
fc33df78c1 Improve threading of comparisons over select instructions (spotted by my
auto-simplifier).  This has a big impact on Ada code, but not much else.
Unfortunately the impact is mostly negative!  This is due to PR9004 (aka
SCCP failing to resolve conditional branch conditions in the destination
blocks of the branch), in which simple correlated expressions are not
resolved but complicated ones are, so simplifying has a bad effect!

llvm-svn: 124788
2011-02-03 09:37:39 +00:00
Eric Christopher
57e4dada99 Reapply this.
llvm-svn: 124779
2011-02-03 06:18:29 +00:00
Eric Christopher
8082811b65 Temporarily revert 124765 in an attempt to find the cycle breaking bootstrap.
llvm-svn: 124778
2011-02-03 05:40:54 +00:00
Rafael Espindola
5bfba89832 Fix PR9127 by reversing the operands even if they have more then one use.
Reversing the operands allows us to fold, but doesn't force us to. Also, at
this point the DAG is still being optimized, so the check for hasOneUse is not
very precise.

llvm-svn: 124773
2011-02-03 03:58:05 +00:00
Daniel Dunbar
d2c741c07a raw_fd_ostream: Add a SetUseAtomicWrites() method (uses writev).
llvm-svn: 124771
2011-02-03 03:32:32 +00:00
Jakob Stoklund Olesen
880fa5b5dc Defer SplitKit value mapping until all defs are available.
The greedy register allocator revealed some problems with the value mapping in
SplitKit. We would sometimes start mapping values before all defs were known,
and that could change a value from a simple 1-1 mapping to a multi-def mapping
that requires ssa update.

The new approach collects all defs and register assignments first without
filling in any live intervals. Only when finish() is called, do we compute
liveness and mapped values. At this time we know with certainty which values map
to multiple values in a split range.

This also has the advantage that we can compute live ranges based on the
remaining uses after rematerializing at split points.

The current implementation has many opportunities for compile time optimization.

llvm-svn: 124765
2011-02-03 00:54:23 +00:00
Devang Patel
2fef292729 Fix typo in comment.
llvm-svn: 124759
2011-02-03 00:13:47 +00:00
Devang Patel
71b1fadf20 Add support to describe template value parameter in debug info.
llvm-svn: 124755
2011-02-02 22:35:53 +00:00
Devang Patel
89455dc7cd Add support to describe template parameter type in debug info.
llvm-svn: 124752
2011-02-02 21:38:25 +00:00
Duncan Sands
7eecb72021 Reenable the transform "(X*Y)/Y->X" when the multiplication is known not to
overflow (nsw flag), which was disabled because it breaks 254.gap.  I have
informed the GAP authors of the mistake in their code, and arranged for the
testsuite to use -fwrapv when compiling this benchmark.

llvm-svn: 124746
2011-02-02 20:52:00 +00:00
Bob Wilson
6fabaaad65 Update comment to match my recent change.
llvm-svn: 124725
2011-02-02 17:29:40 +00:00
Benjamin Kramer
b739613711 SimplifyCFG: Turn switches into sub+icmp+branch if possible.
This makes the job of the later optzn passes easier, allowing the vast amount of
icmp transforms to chew on it.

We transform 840 switches in gcc.c, leading to a 16k byte shrink of the resulting
binary on i386-linux.

The testcase from README.txt now compiles into
  decl  %edi
  cmpl  $3, %edi
  sbbl  %eax, %eax
  andl  $1, %eax
  ret

llvm-svn: 124724
2011-02-02 15:56:22 +00:00
Richard Osborne
5ee859cb22 Add support for trampolines on the XCore.
llvm-svn: 124722
2011-02-02 14:57:41 +00:00
Duncan Sands
cfc61f7efb Remove NoVendor and NoOS, added in commit 123990, from Triple. While it
may be useful to understand "none", this is not the place for it.  Tweak
the fix to Normalize while there: the fix added in 123990 works correctly,
but I like this way better.  Finally, now that Triple understands some
non-trivial environment values, teach the unittests about them.

llvm-svn: 124720
2011-02-02 10:08:38 +00:00
Nick Lewycky
4f38aaec24 Remove wasteful caching. This isn't needed for correctness because any function
that might have changed been affected by a merge elsewhere will have been
removed from the function set, and it isn't needed for performance because we
call grow() ahead of time to prevent reallocations.

llvm-svn: 124717
2011-02-02 05:31:01 +00:00
Dan Gohman
11acb5002d Conservatively, clear optional flags, such as nsw, when performing
reassociation. No testcase, because I wasn't able to create a testcase
which actually demonstrates a problem.

llvm-svn: 124713
2011-02-02 02:05:46 +00:00
Dan Gohman
4dc130ea78 Fix reassociate to clear optional flags, such as nsw.
llvm-svn: 124712
2011-02-02 02:02:34 +00:00
Sean Callanan
27a8820ffa Fixed a bug in the disassembler where the mandatory 0x66
prefix would be misinterpreted in some cases on 32-bit
x86 platforms.  Thanks to Olivier Meurant for identifying
the bug.

llvm-svn: 124709
2011-02-02 01:09:02 +00:00
Evan Cheng
c7ce7e2ac3 Given a pair of floating point load and store, if there are no other uses of
the load, then it may be legal to transform the load and store to integer
load and store of the same width.

This is done if the target specified the transformation as profitable. e.g.
On arm, this can transform:
vldr.32 s0, []
vstr.32 s0, []

to

ldr r12, []
str r12, []

rdar://8944252

llvm-svn: 124708
2011-02-02 01:06:55 +00:00
Bob Wilson
a233675b43 PR9081: Split up LDM instruction with deprecated use of both LR and PC.
This is completely untested but pretty straightforward, so hopefully I
got it right.

llvm-svn: 124694
2011-02-01 22:30:51 +00:00
Matt Beaumont-Gay
de874158f4 Take Bill Wendling's suggestion for structuring a couple of asserts.
llvm-svn: 124688
2011-02-01 22:12:50 +00:00
Anton Korobeynikov
323825cee4 Fix imm printing for logical instructions.
Patch by Brian G. Lucas!

llvm-svn: 124679
2011-02-01 20:22:53 +00:00
Jay Foad
89383f48ca Make SwitchInst::removeCase() more efficient.
llvm-svn: 124659
2011-02-01 09:22:34 +00:00
Duncan Sands
c03dbe4b1c Add a m_Undef pattern for convenience. This is so that code that uses
pattern matching can also pattern match undef, creating a more uniform
style.

llvm-svn: 124657
2011-02-01 09:06:20 +00:00
Duncan Sands
659237307a Add a m_SignBit pattern for convenience.
llvm-svn: 124656
2011-02-01 08:50:33 +00:00
Duncan Sands
06e82c76ee Have m_One also match constant vectors for which every element is 1.
llvm-svn: 124655
2011-02-01 08:39:12 +00:00
Carl Norum
667d5dbdcb Test commit - fix a double 'should' in a comment.
llvm-svn: 124652
2011-02-01 07:38:42 +00:00
Rafael Espindola
e60f9519d8 Correctly merge available_externally and regular definitions when they have
different visibilities.

llvm-svn: 124650
2011-02-01 05:33:52 +00:00
Evan Cheng
3689d1302d Fix bogus assert condition noticed by Csaba Raduly.
llvm-svn: 124645
2011-02-01 01:50:49 +00:00
Eric Christopher
f8b2388751 Reapply 124275 since the Dragonegg failure was unreproducible.
llvm-svn: 124641
2011-02-01 01:16:32 +00:00
Evan Cheng
0e8c521bbd Patches to build EFI with Clang/LLVM. By Carl Norum.
llvm-svn: 124639
2011-02-01 01:14:13 +00:00
Devang Patel
97c467ee47 Keep track of incoming argument's location while emitting LiveIns.
llvm-svn: 124611
2011-01-31 21:38:14 +00:00
Roman Divacky
254f2ab16a Enumerate .code16/32/64 instead of checking .code prefix. This
unbreaks some ARM tests.

llvm-svn: 124608
2011-01-31 21:19:43 +00:00
Roman Divacky
9a8a680ed2 Error on all .code* directives instead of just .code16 as they
all lead to a silent miscompilation of code.

llvm-svn: 124603
2011-01-31 20:56:49 +00:00
David Greene
0db8e64017 Fix vector sign extend to put the source and destination types in the
correct places.

llvm-svn: 124601
2011-01-31 20:39:01 +00:00
Chris Lattner
1d534245fc add a note, progress unblocked by PR8575 being fixed.
llvm-svn: 124599
2011-01-31 20:23:28 +00:00
Richard Osborne
11cdda2346 Fix bug where ReduceLoadWidth was creating illegal ZEXTLOAD instructions.
llvm-svn: 124587
2011-01-31 17:41:44 +00:00
Anton Korobeynikov
b31576ae4d Save a mapping between original and cloned constpool entries.
llvm-svn: 124570
2011-01-30 22:07:39 +00:00
Anton Korobeynikov
c608d67509 Clarify the LSDASection NULL check
llvm-svn: 124569
2011-01-30 22:07:31 +00:00
Anders Carlsson
f184e5de9a Recognize and simplify
(A+B) == A  ->  B == 0
A == (A+B)  ->  B == 0

llvm-svn: 124567
2011-01-30 22:01:13 +00:00
Jakob Stoklund Olesen
430d0693dc Respect the -tail-dup-size command line option even when optimizing for size.
This is similar to the -unroll-threshold option. There should be no change in
behavior when -tail-dup-size is not explicit on the llc command line.

llvm-svn: 124564
2011-01-30 20:38:12 +00:00
Duncan Sands
987c8bc759 Commit 124487 broke 254.gap. See if disabling the part that might be triggered
by PR9088 fixes things.

llvm-svn: 124561
2011-01-30 18:24:20 +00:00
Duncan Sands
ac01c21937 Transform (X/Y)*Y into X if the division is exact. Instcombine already knows how
to do this and more, but would only do it if X/Y had only one use.  Spotted as the
most common missed simplification in SPEC by my auto-simplifier, now that it knows
about nuw/nsw/exact flags.  This removes a bunch of multiplications from 447.dealII
and 483.xalancbmk.  It also removes a lot from tramp3d-v4, which results in much
more inlining.

llvm-svn: 124560
2011-01-30 18:03:50 +00:00
Benjamin Kramer
6b3c3de09a Teach DAGCombine to fold fold (sra (trunc (sr x, c1)), c2) -> (trunc (sra x, c1+c2) when c1 equals the amount of bits that are truncated off.
This happens all the time when a smul is promoted to a larger type.

On x86-64 we now compile "int test(int x) { return x/10; }" into
  movslq  %edi, %rax
  imulq $1717986919, %rax, %rax
  movq  %rax, %rcx
  shrq  $63, %rcx
  sarq  $34, %rax <- used to be "shrq $32, %rax; sarl $2, %eax"
  addl  %ecx, %eax

This fires 96 times in gcc.c on x86-64.

llvm-svn: 124559
2011-01-30 16:38:43 +00:00
Nick Lewycky
abfab6156c Fix 'fcmp one' constant folding. Noticed by inspection.
llvm-svn: 124557
2011-01-30 01:49:58 +00:00
Nick Lewycky
001e12d8d5 Fix some formatting and upgrade comments from llvm 1.x to 2.x syntax.
llvm-svn: 124556
2011-01-30 01:48:50 +00:00
Nick Lewycky
5259b6a6e2 Add the select optimization recently added to instcombine to constant folding.
This is the one where one of the branches of the select is another select on
the same condition.

llvm-svn: 124547
2011-01-29 20:35:06 +00:00
Francois Pichet
6aed3c72dc Unbreak the MSVC build.
The DEBUG() call at line 606 demands to see raw_ostream's definition. I have no idea why this seems to only break MSVC.

llvm-svn: 124545
2011-01-29 20:06:16 +00:00
Nick Lewycky
67acf52b2e Fix comment.
llvm-svn: 124544
2011-01-29 19:55:23 +00:00
Frits van Bommel
b1b70f2a44 Call SimplifyFDivInst() in InstCombiner::visitFDiv().
llvm-svn: 124535
2011-01-29 17:50:27 +00:00
Frits van Bommel
92dc04df67 Move InstCombine's knowledge of fdiv to SimplifyInstruction().
llvm-svn: 124534
2011-01-29 15:26:31 +00:00
Duncan Sands
0587f785bf Fix typo: should have been testing that X was odd, not V.
llvm-svn: 124533
2011-01-29 13:27:00 +00:00
Benjamin Kramer
4a40190f76 Add the missing sub identity "A-(A-B) -> B" to DAGCombine.
This happens e.g. for code like "X - X%10" where we lower the modulo operation
to a series of multiplies and shifts that are then subtracted from X, leading to
this missed optimization.

llvm-svn: 124532
2011-01-29 12:34:05 +00:00
Evan Cheng
20433f6339 Add a test for TCE return duplication.
llvm-svn: 124527
2011-01-29 04:53:35 +00:00
Evan Cheng
4af5487b74 Re-apply r124518 with fix. Watch out for invalidated iterator.
llvm-svn: 124526
2011-01-29 04:46:23 +00:00
Evan Cheng
1f943b9b13 Revert r124518. It broke Linux self-host.
llvm-svn: 124522
2011-01-29 02:43:04 +00:00
Evan Cheng
a1e4cb5f09 Re-commit r124462 with fixes. Tail recursion elim will now dup ret into unconditional predecessor to enable TCE on demand.
llvm-svn: 124518
2011-01-29 01:29:26 +00:00
Andrew Trick
72f17d97f3 Implementation of path profiling.
Modified patch by Adam Preuss.

This builds on the existing framework for block tracing, edge profiling and optimal edge profiling.
See -help-hidden for new flags.
For documentation, see the technical report "Implementation of Path Profiling..." in llvm.org/pubs.

llvm-svn: 124515
2011-01-29 01:09:53 +00:00
Roman Divacky
82612f08c2 Error on .code16 instead of producing wrong (32bit) code.
llvm-svn: 124498
2011-01-28 19:29:48 +00:00
Duncan Sands
07617615f4 This dyn_cast should be a cast. Pointed out by Frits van Bommel.
llvm-svn: 124497
2011-01-28 18:53:08 +00:00
Duncan Sands
e788a04c09 Thread divisions over selects and phis. This doesn't fire much and has basically
zero effect on the testsuite (it improves two Ada testcases).

llvm-svn: 124496
2011-01-28 18:50:50 +00:00
Bob Wilson
e7ac2389b2 PR9030: Fix disassembly of ARM "mov pc, lr" instruction.
Patch by Jyun-Yan You.

llvm-svn: 124492
2011-01-28 17:50:30 +00:00
Duncan Sands
1a18d8df96 My auto-simplifier noticed that ((X/Y)*Y)/Y occurs several times in SPEC
benchmarks, and that it can be simplified to X/Y.  (In general you can only
simplify (Z*Y)/Y to Z if the multiplication did not overflow; if Z has the
form "X/Y" then this is the case).  This patch implements that transform and
moves some Div logic out of instcombine and into InstructionSimplify.
Unfortunately instcombine gets in the way somewhat, since it likes to change
(X/Y)*Y into X-(X rem Y), so I had to teach instcombine about this too.
Finally, thanks to the NSW/NUW flags, sometimes we know directly that "Z*Y"
does not overflow, because the flag says so, so I added that logic too.  This
eliminates a bunch of divisions and subtractions in 447.dealII, and has good
effects on some other benchmarks too.  It seems to have quite an effect on
tramp3d-v4 but it's hard to say if it's good or bad because inlining decisions
changed, resulting in massive changes all over.

llvm-svn: 124487
2011-01-28 16:51:11 +00:00
Oscar Fuentes
7f369d093e Fix libffi usage when it is on a custom path.
llvm-svn: 124486
2011-01-28 16:49:05 +00:00
Roman Divacky
c6a20d1728 Add support for parsing .float
llvm-svn: 124485
2011-01-28 14:20:32 +00:00
Nick Lewycky
f9a384e203 Rename functions to follow coding standard. Also rejiggers comments. No
functionality change.

llvm-svn: 124482
2011-01-28 08:43:14 +00:00
Nick Lewycky
edbe62c10d Add a doxygen comment for this class.
llvm-svn: 124480
2011-01-28 08:19:00 +00:00
Nick Lewycky
28f2b64333 Reorder for readability. (Chris, is this what you meant?)
llvm-svn: 124479
2011-01-28 07:36:21 +00:00
Evan Cheng
5b6c72e549 Revert r124462. There are a few big regressions that I need to fix first.
llvm-svn: 124478
2011-01-28 07:12:38 +00:00
Nick Lewycky
744bd3872f Reduce the number of functions we look at in the first pass, and preallocate
the function equality set.

llvm-svn: 124475
2011-01-28 05:48:15 +00:00
Nick Lewycky
fdee464a16 Fix build with stdcxx by using llvm::next. Patch by Joerg Sonnenberger!
llvm-svn: 124472
2011-01-28 04:00:15 +00:00
Nick Lewycky
74dfcccec4 Fold select + select where both selects are on the same condition.
llvm-svn: 124469
2011-01-28 03:28:10 +00:00