Commit Graph

43292 Commits

Author SHA1 Message Date
Chris Lattner 75510d8d5c restructure the top level non-local ptr dep query to handle
the first block of a query specially.  This makes the "complete query
caching" subsystem more effective, avoiding predecessor queries.  This
speeds up GVN another 4%.

llvm-svn: 60752
2008-12-09 07:52:59 +00:00
Chris Lattner f903fe1df0 rename getNonLocalPointerDepInternal -> getNonLocalPointerDepFromBB
and split its inner loop out into a new GetNonLocalInfoForBlock
function.  No functionality change.

llvm-svn: 60751
2008-12-09 07:47:11 +00:00
Evan Cheng 75900bf5cd DisableGVCompilation should not abort on internal GlobalValue's.
llvm-svn: 60750
2008-12-09 07:31:49 +00:00
Mon P Wang 8a5366332f In LegalizeOp, don't change the result type of CONVERT_RNDSAT when promoting
one of its operand.

llvm-svn: 60749
2008-12-09 07:27:39 +00:00
Nick Lewycky f545749f2b It's easy to handle SLE/SGE when the loop has a unit stride.
llvm-svn: 60748
2008-12-09 07:25:04 +00:00
Chris Lattner aeaec0838b if we have two elements, insert both, don't use std::sort.
This speeds up the new GVN by another 3%

llvm-svn: 60747
2008-12-09 07:05:45 +00:00
Chris Lattner 4d1281cdf2 If we're only adding one new element to 'Cache', insert it into its known
position instead of using a full sort. This speeds up GVN by ~4% with the
new memdep stuff.

llvm-svn: 60746
2008-12-09 06:58:04 +00:00
Chris Lattner e8113a70fa convert a couple other places that use pred_iterator to use the caching
pred iterator.

llvm-svn: 60745
2008-12-09 06:44:17 +00:00
Chris Lattner 18e1da3e80 newline at end of phile
llvm-svn: 60744
2008-12-09 06:32:32 +00:00
Chris Lattner 768e5bcafc use hte new pred cache to speed up the new non-local memdep
queries.  This speeds up GVN using the new queries (not yet
checked in) by just over 10%.

llvm-svn: 60743
2008-12-09 06:28:49 +00:00
Chris Lattner 4c9bb5336a pred_iterator got a lot slower since use-diet landed. This is a
really simple cache class for these queries.  Hopefully this can
be removed if pred_iterator speeds back up.

llvm-svn: 60742
2008-12-09 06:27:07 +00:00
Scott Michel 02e2c2450e CellSPU:
- Fix call.ll and call_indirect.ll expected results, now that it's using a
  different pre-register allocation scheduler.

llvm-svn: 60741
2008-12-09 06:12:03 +00:00
Mon P Wang 4dd832d241 Fix getNode to allow a vector for the shift amount for shifts of vectors.
Fix the shift amount when unrolling a vector shift into scalar shifts.
Fix problem in getShuffleScalarElt where it assumes that the input of
a bit convert must be a vector.

llvm-svn: 60740
2008-12-09 05:46:39 +00:00
Chris Lattner 56b20ffc5f Fix a really subtle off-by-one bug that Duncan noticed with valgrind
on test/CodeGen/Generic/2007-06-06-CriticalEdgeLandingPad.

llvm-svn: 60739
2008-12-09 04:47:21 +00:00
Scott Michel 8deac5db5a CellSPU:
- Change default scheduling preference to list-burr, which produces somewhat
  better code than the default. Could also use list-tdrr, but need to ask
  dev list about the appropriate handy mnemonic before commiting.

llvm-svn: 60738
2008-12-09 03:37:19 +00:00
Bill Wendling 80b34b3f47 Add initial support for fast-isel of the [SU]ADDO intrinsics. It isn't
complete. For instance, it lowers the common case into this less-than-optimal
code:

        addl    %ecx, %eax
        seto    %cl
        testb   %cl, %cl
        jne     LBB1_2  ## overflow

instead of:

        addl    %ecx, %eax
        jo      LBB1_2  ## overflow

That will come in a future commit.

llvm-svn: 60737
2008-12-09 02:42:50 +00:00
Dan Gohman 16516ba7b3 Fix the name of ISD::TokenFactor in a comment. Thanks Gabor!
llvm-svn: 60736
2008-12-09 02:18:52 +00:00
Chris Lattner c3fbda4d19 remove two unneeded forward declarations, pointed out by Gabor.
llvm-svn: 60735
2008-12-09 02:10:10 +00:00
Dan Gohman 37c496979c Don't charge full latency for an anti-dependence, in this simplistic
pipeline model.

llvm-svn: 60733
2008-12-09 00:26:46 +00:00
Dan Gohman bc55c2a18f Fix a couple of mistaken switch case fall-throughs. Thanks to Bill
for spotting these!

llvm-svn: 60728
2008-12-08 23:50:06 +00:00
Devang Patel 5f769e2d40 Actually test something. Use PR3170 test case.
llvm-svn: 60727
2008-12-08 23:44:46 +00:00
Chris Lattner e598370ae9 remove DebugIterations option. Despite the accusations,
jump threading has been shown to only expose problems not
have bugs itself.  I'm sure it's completely bug free! ;-)

llvm-svn: 60725
2008-12-08 22:44:07 +00:00
Evan Cheng c654143258 Re-apply 60689 now my head is screwed on right.
llvm-svn: 60711
2008-12-08 19:29:03 +00:00
Dan Gohman f90d3b096a Fix the top-level comments, and fix some 80-column violations.
llvm-svn: 60707
2008-12-08 17:50:35 +00:00
Dan Gohman 1acbd9b2c8 Move the conversion to intptr_t to a separate statement. This
avoids GCC's warning even on 64-bit hosts.

llvm-svn: 60706
2008-12-08 17:41:24 +00:00
Dan Gohman 64bc11e7ce Revert 60689. It caused many regressions on Darwin targets.
llvm-svn: 60705
2008-12-08 17:38:02 +00:00
Ted Kremenek 5946b1afc5 Use 'delete []' instead of 'delete' in OwningArray::reset().
llvm-svn: 60703
2008-12-08 17:28:11 +00:00
Devang Patel 2bb8a2f80f Fix spelling.
Thanks Duncan!

llvm-svn: 60702
2008-12-08 17:07:24 +00:00
Devang Patel 1c469d36b0 Undo previous patch.
llvm-svn: 60701
2008-12-08 17:02:37 +00:00
Duncan Sands 0b45f17bf2 Fix comment typo.
llvm-svn: 60698
2008-12-08 14:10:36 +00:00
Duncan Sands 714ffa36d3 Fix comment typo.
llvm-svn: 60697
2008-12-08 14:01:59 +00:00
Dan Gohman 4c31524bec Factor out the code for sign-extending/truncating gep indices
and use it in x86 address mode folding. Also, make
getRegForValue return 0 for illegal types even if it has a
ValueMap for them, because Argument values are put in the
ValueMap. This fixes PR3181.

llvm-svn: 60696
2008-12-08 07:57:47 +00:00
Chris Lattner 5ed409edfa add another level of caching for non-local pointer queries, keeping
track of whether the CachedNonLocalPointerInfo for a block is specific
to a block.  If so, just return it without any pred scanning.  This is
good for a 6% speedup on GVN (when it uses this lookup method, which
it doesn't right now).

llvm-svn: 60695
2008-12-08 07:31:50 +00:00
Chris Lattner 911c4348c6 consistency
llvm-svn: 60694
2008-12-08 07:21:39 +00:00
Chris Lattner e50d835625 introduce a new RoundUpAlignment helper function, use it to
remove some more 64-bit divs and rems from the StructLayout 
ctor.

llvm-svn: 60692
2008-12-08 07:11:56 +00:00
Dan Gohman 8214fc12a3 Make ConstantAggregateZero::get return a ConstantAggregateZero*,
as suggested in PR3182.

llvm-svn: 60691
2008-12-08 07:10:54 +00:00
Dan Gohman 2be8b919b1 Update CPP backend for PrintModulePass API changes.
llvm-svn: 60690
2008-12-08 07:07:24 +00:00
Evan Cheng 50fcc67a8b Perform cheap checks first.
llvm-svn: 60689
2008-12-08 06:52:43 +00:00
Chris Lattner 63c38a6630 Speed up getABITypeSize by turning a i64 mul and div into an
AND.  This is speedup on any reasonable target, but particularly
on 32-bit targets where this often turns into a libcall like udivdi3.

We know that alignments are a power of two but the compiler doesn't.

llvm-svn: 60688
2008-12-08 06:50:51 +00:00
Chris Lattner 2f9d8458c8 Some minor optimizations for isObjectSmallerThan.
llvm-svn: 60687
2008-12-08 06:28:54 +00:00
Dan Gohman 7a1dab52a9 Clarify a comment.
llvm-svn: 60685
2008-12-08 04:54:58 +00:00
Dan Gohman 91dfc08809 Move createVirtualRegister out-of-line.
llvm-svn: 60684
2008-12-08 04:54:11 +00:00
Dan Gohman 9de2ac8e8b Clarify some comments.
llvm-svn: 60683
2008-12-08 04:53:23 +00:00
Dan Gohman 414cf50234 Generalize bugpoint's concept of a "safe" backend, and add options
to allow the "safe" backend to be run with a different path, and/or
with different command-line options.

This enables the following use cases:
 - bugpoint llc against an llc command from a different build
 - bugpoint llc against the same llc with different command-line options
 - and more...

Also, document the existing "custom" interpreter options.

llvm-svn: 60681
2008-12-08 04:02:47 +00:00
Nick Lewycky d745adedd7 Fixes for Visual Studio users. Patch by OvermindDL1 on llvm-dev!
llvm-svn: 60679
2008-12-08 00:45:02 +00:00
Dan Gohman 14aa673e70 Use bool instead of int, now that it no longer evokes a warning.
llvm-svn: 60678
2008-12-07 21:33:27 +00:00
Dan Gohman d9f833be34 Use intptr_t instead of unsigned here, which is more appropriate
in a really obscure way, but more importantly has the side effect
of avoiding a GCC warning in the case that IntType is bool.

llvm-svn: 60677
2008-12-07 21:28:00 +00:00
Chris Lattner fdb8843133 add an assert. the cast<> below would catch this but a message is more
useful.

llvm-svn: 60674
2008-12-07 18:45:15 +00:00
Chris Lattner 82b7034753 factor some code better.
llvm-svn: 60673
2008-12-07 18:42:51 +00:00
Chris Lattner de4440c24b factor some code, fixing some fixme's.
llvm-svn: 60672
2008-12-07 18:39:13 +00:00
Chris Lattner dea735e257 fix a typo duncan noticed!
llvm-svn: 60671
2008-12-07 18:21:37 +00:00
Oscar Fuentes 8c78391c8a CMake: Added Tool.cpp to tools/llvmc/driver.
llvm-svn: 60670
2008-12-07 17:01:16 +00:00
Mikhail Glushenkov bd53583426 Man page update.
llvm-svn: 60669
2008-12-07 16:48:07 +00:00
Mikhail Glushenkov c0fc34660b Describe recent changes in the documentation.
llvm-svn: 60668
2008-12-07 16:47:42 +00:00
Mikhail Glushenkov 7f1bef5a55 Make 'extern' an option property.
Makes (forward) work better.

llvm-svn: 60667
2008-12-07 16:47:12 +00:00
Mikhail Glushenkov 2804af0929 Plugin updates: support more options.
llvm-svn: 60666
2008-12-07 16:46:23 +00:00
Mikhail Glushenkov ce31b34a6f Join tools couldn't be used in the middle of the toolchain.
llvm-svn: 60665
2008-12-07 16:45:37 +00:00
Mikhail Glushenkov 4cc945da6e Better error message.
llvm-svn: 60664
2008-12-07 16:45:12 +00:00
Mikhail Glushenkov 395cb25ac7 Re-apply Cedric's changes.
Use B instead of Beg (for consistency), but NodeA and NodeB instead of A
and B.

llvm-svn: 60663
2008-12-07 16:44:47 +00:00
Mikhail Glushenkov 203cad7326 Add some clarifying comments.
llvm-svn: 60662
2008-12-07 16:44:15 +00:00
Mikhail Glushenkov 8e1507d7c6 Enable the Clang plugin by default.
This will eventually replace `ccc`. The command `llvmc -clang` now uses
the Clang toolchain instead of `llvm-gcc`.

llvm-svn: 60661
2008-12-07 16:43:42 +00:00
Mikhail Glushenkov 385691b1bd Update plugins to use (actions).
llvm-svn: 60660
2008-12-07 16:43:17 +00:00
Mikhail Glushenkov 0d88271490 Try to guess when the auto-generated cl::Sink option should be marked 'extern'.
This would be much easier to do if the CommandLine library didn't use
global state. Global state is evil.

llvm-svn: 60659
2008-12-07 16:42:47 +00:00
Mikhail Glushenkov 35a46f808b Add a (progn)-like construct for (actions). Implemented as a DAG list.
llvm-svn: 60658
2008-12-07 16:42:22 +00:00
Mikhail Glushenkov 7429d925f0 Add tests for tblgen's LLVMC backend.
llvm-svn: 60657
2008-12-07 16:41:50 +00:00
Mikhail Glushenkov 85467c71d2 Use (actions) instead of option properties, support external options.
Also includes a major refactoring. See documentation for more
information.

llvm-svn: 60656
2008-12-07 16:41:11 +00:00
Chris Lattner a28355de14 add support for caching pointer dependence queries. Nothing uses this yet
so it "can't" break anything.  That said, it does appear to work.

llvm-svn: 60654
2008-12-07 08:50:20 +00:00
Chris Lattner f50d7f76c6 fix a bug I introduced in simplifycfg handling single entry phi
nodes. FoldSingleEntryPHINodes deletes the PHI, so there is no
need to delete it afterward.

llvm-svn: 60653
2008-12-07 07:22:45 +00:00
Owen Anderson 12679470bf Switch to top-down mode and fix a crasher this exposed caused by an error in the
live interval updating.

llvm-svn: 60652
2008-12-07 05:33:18 +00:00
Nick Lewycky f9e2394009 Fix typo, psuedo -> pseudo.
llvm-svn: 60651
2008-12-07 03:49:52 +00:00
Chris Lattner 7564a3b81b Some internal refactoring to make it easier to cache results.
llvm-svn: 60650
2008-12-07 02:56:57 +00:00
Chris Lattner 2faa2c724a Introduce a new MemDep::getNonLocalPointerDependency
method.  This will eventually take over load/store dep
queries from getNonLocalDependency.  For now it works
fine, but is incredibly slow because it does no caching.
Lets not switch GVN to use it until that is fixed :)

llvm-svn: 60649
2008-12-07 02:15:47 +00:00
Chris Lattner 5a78604e39 push the "pointer case" up the analysis stack a bit. This causes
duplication of logic (in 2 places) to determine what pointer a 
load/store touches.  This will be addressed in a future commit.

llvm-svn: 60648
2008-12-07 01:50:16 +00:00
Chris Lattner ed494f791e make clients have to know how to call getCallSiteDependencyFrom
instead of making getDependencyFrom do it.

llvm-svn: 60647
2008-12-07 01:21:14 +00:00
Chris Lattner ccb9c3370a rename some variables for consistency
llvm-svn: 60644
2008-12-07 00:39:19 +00:00
Chris Lattner e2069a6949 I love how using out of scope variables is not an error with GCC, no really I do.
llvm-svn: 60643
2008-12-07 00:38:27 +00:00
Chris Lattner 056c090c67 Rename getCallSiteDependency -> getCallSiteDependencyFrom to
emphasize the scanning and make it more similar to 
getDependencyFrom
 

llvm-svn: 60642
2008-12-07 00:35:51 +00:00
Chris Lattner d4d9588abc a memdep query on a volatile load/store will always return
clobber with the current implementation.  Instead of returning
a "precise clobber" just return a fuzzy one.  This doesn't 
matter to any clients anyway and should speed up analysis time
very very slightly.

llvm-svn: 60641
2008-12-07 00:28:02 +00:00
Chris Lattner 5df5b4cc2e don't bother touching volatile stores, they will just return clobber on
everything interesting anyway.

llvm-svn: 60640
2008-12-07 00:25:15 +00:00
Chris Lattner f5891941b4 remove the ability to get memdep info for vaarg. I don't think the
original impl was correct and noone actually makes the query anyway.

llvm-svn: 60639
2008-12-07 00:21:18 +00:00
Chris Lattner b098a7883f make getDependencyFrom private.
llvm-svn: 60637
2008-12-07 00:16:50 +00:00
Chris Lattner a163568c03 improve a note.
llvm-svn: 60636
2008-12-07 00:15:10 +00:00
Chris Lattner da93063acc some more PRE/GVN/DSE related notes.
llvm-svn: 60633
2008-12-06 22:52:12 +00:00
Chris Lattner 527dd60430 add a note
llvm-svn: 60632
2008-12-06 22:49:05 +00:00
Chris Lattner 543d6c65fa some random notes.
llvm-svn: 60624
2008-12-06 19:28:22 +00:00
Nick Lewycky 1f6a7b5002 Minor cleanup. Use dyn_cast, not isa/cast pairs. No functionality change.
llvm-svn: 60623
2008-12-06 17:57:05 +00:00
Evan Cheng ab85feb91c Clean up some ARM GV asm printing out; minor fixes to match what gcc does.
llvm-svn: 60621
2008-12-06 02:00:55 +00:00
Chris Lattner 57e91eaf61 Reimplement the inner loop of DSE. It now uniformly uses getDependence(),
doesn't do its own local caching, and is slightly more aggressive about
free/store dse (see testcase).  This eliminates the last external client 
of MemDep::getDependenceFrom().

llvm-svn: 60619
2008-12-06 00:53:22 +00:00
Dan Gohman 35e2cfccaf Don't use plain %x to print pointer values. I had changed it from %p
since %p isn't formatted consistently, but obviously plain %x is wrong.
PRIxPTR with a cast to uintptr_t would work here, but that requires
inconvenient build-system changes. %lu works on all current and
foreseable future hosts.

llvm-svn: 60616
2008-12-05 23:39:24 +00:00
Dale Johannesen 0733759b5a Fix test to pass on Linux.
llvm-svn: 60614
2008-12-05 22:38:21 +00:00
Dale Johannesen b49d7cf19e Forgot a file.
llvm-svn: 60609
2008-12-05 21:55:35 +00:00
Dale Johannesen 9efd2ce55b Make LoopStrengthReduce smarter about hoisting things out of
loops when they can be subsumed into addressing modes.

Change X86 addressing mode check to realize that
some PIC references need an extra register.
(I believe this is correct for Linux, if not, I'm sure
someone will tell me.)

llvm-svn: 60608
2008-12-05 21:47:27 +00:00
Chris Lattner 0e3d6337c6 Make a few major changes to memdep and its clients:
1. Merge the 'None' result into 'Normal', making loads
   and stores return their dependencies on allocations as Normal.
2. Split the 'Normal' result into 'Clobber' and 'Def' to
   distinguish between the cases when memdep knows the value is
   produced from when we just know if may be changed.
3. Move some of the logic for determining whether readonly calls
   are CSEs into memdep instead of it being in GVN.  This still
   leaves verification that the arguments are hte same to GVN to
   let it know about value equivalences in different contexts.
4. Change memdep's call/call dependency analysis to use 
   getModRefInfo(CallSite,CallSite) instead of doing something 
   very weak.  This only really matters for things like DSA, but
   someday maybe we'll have some other decent context sensitive
   analyses :)
5. This reimplements the guts of memdep to handle the new results.
6. This simplifies GVN significantly:
   a) readonly call CSE is slightly simpler
   b) I eliminated the "getDependencyFrom" chaining for load 
      elimination and load CSE doesn't have to worry about 
      volatile (they are always clobbers) anymore.
   c) GVN no longer does any 'lastLoad' caching, leaving it to 
      memdep.
7. The logic in DSE is simplified a bit and sped up.  A potentially
   unsafe case was eliminated.

llvm-svn: 60607
2008-12-05 21:04:20 +00:00
Dan Gohman 7f079aabed Demangle and pretty-print symbols in internal backtraces. Patch by
Wesley Peck, with a few fixes by me.

llvm-svn: 60605
2008-12-05 20:12:48 +00:00
Anton Korobeynikov 24600bf05a Revert invalid r60393. It causes llvm-gcc bootstrap fails in release builds.
See PR3160 for details

llvm-svn: 60604
2008-12-05 19:38:49 +00:00
Evan Cheng 7a15646d69 This test also requires -mattr=+sse41.
llvm-svn: 60601
2008-12-05 19:26:37 +00:00
Chris Lattner eda6432beb Make it illegal to call getDependency* on non-memory instructions
like binary operators.

llvm-svn: 60600
2008-12-05 18:46:19 +00:00
Evan Cheng 43c0891838 Reason #3 from 60595 doesn't hold true. If we can fold a PIC load from constpool into a use, the rewrite happens at time of spill (not in VirtRegMap). Later on, if the GlobalBaseReg is spilled, the spiller can see the use uses GlobalBaseReg and do the right thing.
llvm-svn: 60596
2008-12-05 17:41:31 +00:00
Evan Cheng fd8c4d5975 Effectively undo 60461 in PIC mode which simply transform V_SET0 / V_SETALLONES into a load from constpool in order to fold into restores. This is not safe to do when PIC base is being used for a number of reasons:
1. GlobalBaseReg may have been spilled.
2. It may not be live at the use.
3. Spiller doesn't know this is happening so it won't prevent GlobalBaseReg from being spilled later (That by itself is a nasty hack. It's needed because we don't insert the reload until later).

llvm-svn: 60595
2008-12-05 17:23:48 +00:00
Chris Lattner c100828026 Fix test/Transforms/GVN/pre-load.ll
llvm-svn: 60594
2008-12-05 17:04:12 +00:00
Evan Cheng 994faaf218 Fix comment.
llvm-svn: 60592
2008-12-05 17:00:16 +00:00
Cedric Venet af333378c9 The use of the construct:
for(Type1 B = ...;;) { Type2 B ; ... }
is bad: code is hard to read and VS VS don't like it (it ignore the second declaration of B).
This patch fix the problem in tablegen. Please don't write code like this. 

llvm-svn: 60590
2008-12-05 13:37:30 +00:00
Chris Lattner d2a653af0c Make IsValueFullyAvailableInBlock safe.
llvm-svn: 60588
2008-12-05 07:49:08 +00:00
Chris Lattner 6c425556f2 add a new pop_back_val method which returns the value popped. This is
heretical from a STL standpoint, but is oh-so-useful for things that 
can't throw exceptions when copied, like, well, everything in LLVM.

llvm-svn: 60587
2008-12-05 07:11:05 +00:00
Dan Gohman d24be45d99 Drop the reg argument to isRegReDefinedByTwoAddr, which was redundant.
llvm-svn: 60586
2008-12-05 05:45:42 +00:00
Dan Gohman 67840c9803 Update comments. There is no getArgumentAccesses.
llvm-svn: 60585
2008-12-05 05:35:21 +00:00
Dan Gohman 9bb56443a1 Teach StackSlotColoring to update MachineMemOperands when
changing the stack slots on an instruction, to keep them
consistent with the actual memory addresses.

llvm-svn: 60584
2008-12-05 05:31:14 +00:00
Dan Gohman c1dee225d0 Ignore IMPLICIT_DEF instructions when computing physreg liveness.
While they appear to provide a normal clobbering def, they don't
in the case of the awkward IMPLICIT_DEF+INSERT_SUBREG idiom. It
would be good to change INSERT_SUBREG; until then, this change
allows post-regalloc scheduling to cope in a mildly conservative
way.

llvm-svn: 60583
2008-12-05 05:30:02 +00:00
Evan Cheng 2a03c7e977 Re-did 60519. It turns out Darwin's handling of hidden visibility symbols are a bit more complicate than I expected. Both declarations and weak definitions still need a stub indirection. However, the stubs are in data section and they contain the addresses of the actual symbols.
llvm-svn: 60571
2008-12-05 01:06:39 +00:00
Scott Michel 6ce01ab378 CellSPU: Add new directory under tests/CodeGen/CellSPU to retain tests that
aren't part of the test suite but are generally useful nonetheless, and can
be expanded later to test the backend against the actual Cell SPU system.

There's basically no other good place to put this code, so put it here for
the time being.

- vecoperations.c: Vector shuffles for all supported vector types, tests
  for v16i8 add and multiply.

llvm-svn: 60566
2008-12-05 00:01:00 +00:00
Ted Kremenek 123a35a81c Have raw_fd_ostream keep track of the position in the file to make tell() go faster by not requiring a flush().
llvm-svn: 60560
2008-12-04 22:51:11 +00:00
Devang Patel 8c84d28250 Enable LoopIndexSplit pass.
llvm-svn: 60555
2008-12-04 21:40:31 +00:00
Devang Patel c56423b500 Rewrite code that 1) filters loops and 2) calculates new loop bounds.
This fixes many bugs. I will add more test cases in a separate check-in.

Some day, the code that manipulates CFG and updates dom. info could use refactoring help.

llvm-svn: 60554
2008-12-04 21:38:42 +00:00
Owen Anderson 0bcbe8f6a8 Factor out some common code.
llvm-svn: 60553
2008-12-04 21:20:30 +00:00
Scott Michel ea3c49d43d CellSPU: Fix bug 3055
- Add v4f32, v2f64 to LowerVECTOR_SHUFFLE
- Look for vector rotate in shuffle elements, generate a vector rotate
  instead of a full-blown shuffle when opportunity presents itself.
- Generate larger test harness and fix a few interesting but obscure bugs.

llvm-svn: 60552
2008-12-04 21:01:44 +00:00
Duncan Sands 471a654711 When allocating a stack temporary, use the correct
number of bytes for types such as i1 which are not
a multiple of 8 bits in length.

llvm-svn: 60543
2008-12-04 18:08:40 +00:00
Scott Michel 187250bd94 Missing closing brace and reverse conditional condition on NDEBUG
llvm-svn: 60541
2008-12-04 17:16:59 +00:00
Chris Lattner 8f723670ce Start simplifying a switch that has a successor that is a switch.
llvm-svn: 60534
2008-12-04 06:31:07 +00:00
Chris Lattner 5cee4626b8 This code is apparently quite confused. In the meantime,
get it building when NDEBUG is set.

llvm-svn: 60532
2008-12-04 06:14:27 +00:00
Bill Wendling 6949f6135b Temporarily revert r60519. It was causing a bootstrap failure:
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -DHAVE_CONFIG_H -I. -I../../../llvm-gcc.src/libgomp -I. -I../../../llvm-gcc.src/libgomp/config/posix -I../../../llvm-gcc.src/libgomp -Wall -pthread -Werror -O2 -g -O2 -MT barrier.lo -MD -MP -MF .deps/barrier.Tpo -c ../../../llvm-gcc.src/libgomp/barrier.c  -fno-common -DPIC -o .libs/barrier.o
checking for sys/file.h... /var/folders/zG/zGE-ZJOGFiGjv0B5cs5oYE+++TM/-Tmp-//cc34Jg5P.s:13:non-relocatable subtraction expression, "_gomp_tls_key" minus "L1$pb"
/var/folders/zG/zGE-ZJOGFiGjv0B5cs5oYE+++TM/-Tmp-//cc34Jg5P.s:13:symbol: "_gomp_tls_key" can't be undefined in a subtraction expression
make[4]: *** [barrier.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -DHAVE_CONFIG_H -I. -I../../../llvm-gcc.src/libgomp -I. -I../../../llvm-gcc.src/libgomp/config/posix -I../../../llvm-gcc.src/libgomp -Wall -pthread -Werror -O2 -g -O2 -MT alloc.lo -MD -MP -MF .deps/alloc.Tpo -c ../../../llvm-gcc.src/libgomp/alloc.c -o alloc.o >/dev/null 2>&1
yes
checking for sys/param.h... make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libgomp] Error 2
make[1]: *** Waiting for unfinished jobs....

llvm-svn: 60527
2008-12-04 04:07:00 +00:00
Scott Michel 40f54d2257 CellSPU:
- First patch from Nehal Desai, a new contributor at Aerospace. Nehal's patch
  fixes sign/zero/any-extending loads for integers and floating point. Example
  code, compiled w/o debugging or optimization where he first noticed the bug:

  int main(void) {
    float a = 99.0;
    printf("%d\n", a);
    return 0;
  }

  Verified that this code actually works on a Cell SPU.

Changes by Scott Michel:
- Fix bug in the value type list constructed by SPUISD::LDRESULT to include
  both the load result's result and chain, not just the chain alone.
- Simplify LowerLOAD and remove extraneous and unnecessary chains.
- Remove unused SPUISD pseudo instructions.

llvm-svn: 60526
2008-12-04 03:02:42 +00:00
Dan Gohman 44f57df254 Use register names instead of numbers in debug output.
llvm-svn: 60525
2008-12-04 02:15:26 +00:00
Dan Gohman 30cad9c192 Make debug output more informative.
llvm-svn: 60524
2008-12-04 02:14:57 +00:00
Evan Cheng 011c4fa8a1 Visibility hidden GVs do not require extra load of symbol address from the GOT or non-lazy-ptr.
llvm-svn: 60519
2008-12-04 01:56:50 +00:00
Dan Gohman 3aab10b932 Add minimal support for disambiguating memory references. Currently
the main thing this covers is spills to distinct spill slots.

llvm-svn: 60517
2008-12-04 01:35:46 +00:00
Chris Lattner 75c2661d24 add a debugging option to help track down j-t problems.
llvm-svn: 60514
2008-12-04 00:07:59 +00:00
Dan Gohman 84efaf6a63 Rewrite the liveness bookkeeping code to fix a bunch of
issues with subreg operands and tied operands.

llvm-svn: 60510
2008-12-03 23:07:27 +00:00
Dale Johannesen 941c37c2f6 Make the debugging dump be a full line.
llvm-svn: 60509
2008-12-03 22:45:31 +00:00
Dale Johannesen 4e9e6ea604 Remove an unused field.
llvm-svn: 60508
2008-12-03 22:43:56 +00:00
Dan Gohman ee1cd1781a Have PseudoSourceValue override Value::dump, so that it works
on PseudoSourceValue values. This also fixes a FIXME in
lib/VMCode/AsmWriter.cpp.

llvm-svn: 60507
2008-12-03 21:37:21 +00:00
Dale Johannesen f7a588b909 Fix a misspelled function name.
llvm-svn: 60506
2008-12-03 20:56:12 +00:00
Chris Lattner dc3f6f2c12 Factor some code into a new FoldSingleEntryPHINodes method.
llvm-svn: 60501
2008-12-03 19:44:02 +00:00
Dan Gohman 0c91a5f56c Fix an inconsistency in a comment.
llvm-svn: 60500
2008-12-03 19:38:38 +00:00
Evan Cheng 1339e72d97 Use mmx (punpckldq VR64, (mmx_v_set0)) to clear high 32-bits of a VR64 register.
llvm-svn: 60499
2008-12-03 19:38:05 +00:00
Dan Gohman 434a3ca8e9 Don't charge the full latency for anti and output dependencies. This is
an area where eventually it would be good to use target-dependent
information.

llvm-svn: 60498
2008-12-03 19:37:34 +00:00
Dale Johannesen 5d84f685a8 A step towards geting linux ppc to work (see PR 3099)
llvm-svn: 60497
2008-12-03 19:33:10 +00:00
Dan Gohman 444baea236 When looking for anti-dependences on the critical path, don't bother
examining non-anti-dependence edges.

llvm-svn: 60496
2008-12-03 19:32:26 +00:00
Dan Gohman 1a32dda4aa Add a comment about callee-saved registers.
llvm-svn: 60495
2008-12-03 19:30:13 +00:00
Dale Johannesen d49ceff6ba Fix a really wrong comment.
llvm-svn: 60494
2008-12-03 19:25:46 +00:00
Chris Lattner 8820ca5560 fix a really incorrect comment.
llvm-svn: 60492
2008-12-03 19:18:54 +00:00
Dan Gohman 3f86b51333 Split foldMemoryOperand into public non-virtual and protected virtual
parts, and add target-independent code to add/preserve
MachineMemOperands.

llvm-svn: 60488
2008-12-03 18:43:12 +00:00
Dan Gohman 69cc2cbbff Rename isSimpleLoad to canFoldAsLoad, to better reflect its meaning.
llvm-svn: 60487
2008-12-03 18:15:48 +00:00
Dan Gohman 78407ac8e5 Extend X86's addFrameReference to add a MachineMemOperand for
the frame reference. This will help post-RA scheduling determine
that spills to distinct stack slots are independent.

llvm-svn: 60486
2008-12-03 18:11:40 +00:00
Rafael Espindola 74dc32d422 Fix some tests. The grep for "il" was matching "file".
llvm-svn: 60485
2008-12-03 17:14:56 +00:00
Dan Gohman 810daf7e93 Update a comment.
llvm-svn: 60484
2008-12-03 17:10:41 +00:00
Duncan Sands f52e518d05 Only check that the result of the mapping was not
a new node if the node was actually remapped.

llvm-svn: 60482
2008-12-03 12:36:16 +00:00
Rafael Espindola cda011b5ad Fix bug 3140.
Print a single parameter .file directive if we have an ELF target.

llvm-svn: 60480
2008-12-03 11:01:37 +00:00
Richard Osborne feece7edab Add support for ISD::TRAP to the XCore backend
llvm-svn: 60479
2008-12-03 10:59:16 +00:00
Evan Cheng 501089f6f4 Refactor code. No functionality change.
llvm-svn: 60478
2008-12-03 08:38:43 +00:00
Bill Wendling f8d1ef9842 CC should only be a ConstantSDNode at this point. Just use 'cast' instead of 'dyn_cast'.
llvm-svn: 60477
2008-12-03 08:32:02 +00:00
Evan Cheng b5a97ff651 Fix test.
llvm-svn: 60476
2008-12-03 08:20:45 +00:00
Chris Lattner 350fc5721d testcase for br undef folding.
llvm-svn: 60471
2008-12-03 07:48:27 +00:00
Chris Lattner 595c7279bd Teach jump threading some more simple tricks:
1) have it fold "br undef", which does occur with
   surprising frequency as jump threading iterates.
2) teach j-t to delete dead blocks.  This removes the successor
   edges, reducing the in-edges of other blocks, allowing 
   recursive simplification.
3) Fold things like:
     br COND, BBX, BBY
  BBX:
     br COND, BBZ, BBW

   which also happens because jump threading iterates.

llvm-svn: 60470
2008-12-03 07:48:08 +00:00
Chris Lattner 37e0136fef third time is the charm.
llvm-svn: 60469
2008-12-03 07:45:15 +00:00
Chris Lattner c04a1ffa9a fix assertion.
llvm-svn: 60468
2008-12-03 07:43:05 +00:00
Chris Lattner 50532410d1 don't spew tons of stuff to the output. This testcase is *not* for
loop deletion (it is for a ton of passes), which is very bad.

llvm-svn: 60465
2008-12-03 06:41:50 +00:00
Chris Lattner 7eb270ed03 Rename DeleteBlockIfDead to DeleteDeadBlock and make it
unconditionally delete the block.  All likely clients will
do the checking anyway.

llvm-svn: 60464
2008-12-03 06:40:52 +00:00
Chris Lattner bcc904a67c Factor some code out of SimplifyCFG, forming a new
DeleteBlockIfDead method.

llvm-svn: 60463
2008-12-03 06:37:44 +00:00
Dan Gohman cc78cdf275 Mark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
foldMemoryOperand how to "fold" them, by converting them into constant-pool
loads. When they aren't folded, they use xorps/cmpeqd, but for example when
register pressure is high, they may now be folded as memory operands, which
reduces register pressure.

Also, mark V_SET0 isAsCheapAsAMove so that two-address-elimination will
remat it instead of copying zeros around (V_SETALLONES was already marked).

llvm-svn: 60461
2008-12-03 05:21:24 +00:00
Bill Wendling e3402692d8 Change label to 'carry' for unsigned adds.
llvm-svn: 60460
2008-12-03 02:43:12 +00:00
Dan Gohman ae3ba45eb2 Add a sanity-check to tablegen to catch the case where isSimpleLoad
is set but mayLoad is not set. Fix all the problems this turned up.

Change code to not use isSimpleLoad instead of mayLoad unless it
really wants isSimpleLoad.

llvm-svn: 60459
2008-12-03 02:30:17 +00:00
Dan Gohman ac5392c596 Fix a missing #include.
llvm-svn: 60458
2008-12-03 02:10:00 +00:00
Dan Gohman a3d9eb0131 Add an explicit keyword.
llvm-svn: 60457
2008-12-03 01:55:47 +00:00
Dan Gohman 9810e76b30 Replace a #include with a forward-declaration.
llvm-svn: 60456
2008-12-03 01:53:18 +00:00
Dan Gohman 0c8df671ac Fix this comment to reflect that it applies to types other
than just i32.

llvm-svn: 60455
2008-12-03 01:39:44 +00:00
Dan Gohman 5d3d1f69e1 Fix byval arguments in the fastcc calling convention. The fastcc convention
delegates to the regular x86-32 convention which handles byval, but only
after it handles a few cases, and it's necessary to handle byval before
handling those cases. This fixes PR3122 (and rdar://6400815), llvm-gcc
miscompiling LLVM.

llvm-svn: 60453
2008-12-03 01:28:04 +00:00
Dan Gohman 971c88f3b2 Add nounwind attributes to this test.
llvm-svn: 60451
2008-12-03 01:10:18 +00:00
Dale Johannesen b43a689520 testcases for recent dag combiner changes
llvm-svn: 60449
2008-12-03 00:52:41 +00:00
Chris Lattner 0a12e95362 Fix isIntN to work with APInts > 64 bits. This method is only
used by clang apparently.

llvm-svn: 60446
2008-12-02 23:33:29 +00:00
Evan Cheng e62150cae4 Remove a (what appears to be) overly strict assertion. Here is what happened:
1. ppcf128 select is expanded to f64 select's.
2. f64 select operand 0 is an i1 truncate, it's promoted to i32 zero_extend.
3. f64 select is updated. It's changed back to a "NewNode" and being re-analyzed.
4. f64 select operands are being processed. Operand 0 is a "NewNode". It's being expunged out of ReplacedValues map.
5. ExpungeNode tries to remap f64 select and notice it's a "NewNode" and assert.
Duncan, please take a look. Thanks.

llvm-svn: 60443
2008-12-02 21:57:09 +00:00
Dale Johannesen 4d2ecb8f68 Minor rewrite per review feedback.
llvm-svn: 60442
2008-12-02 21:17:11 +00:00
Scott Michel 9b0b28e021 Non-functional change: make custom lowering for truncate stylistically
consistent with the way it's generally done in other places.

llvm-svn: 60439
2008-12-02 19:55:08 +00:00
Scott Michel 7364025ff8 CellSPU:
- Incorporate Tilmann Scheller's ISD::TRUNCATE custom lowering patch
- Update SPU calling convention info, even if it's not used yet (but can be
  at some point or another)
- Ensure that any-extended f32 loads are custom lowered, especially when
  they're promoted for use in printf.

llvm-svn: 60438
2008-12-02 19:53:53 +00:00
Dan Gohman 7e9daef644 Fix a typo in a comment.
llvm-svn: 60434
2008-12-02 19:27:20 +00:00
Owen Anderson ecd5b5f2b2 Add support for folding spills into preceding defs when doing pre-alloc splitting.
llvm-svn: 60433
2008-12-02 18:53:47 +00:00
Dale Johannesen 54bdec238a One more transformation.
llvm-svn: 60432
2008-12-02 18:40:40 +00:00
Dale Johannesen 70060013d2 Make the code do what the comment says it does.
llvm-svn: 60431
2008-12-02 18:40:09 +00:00
Chris Lattner 027d726f10 Comment typeo fix, thanks Duncan!
llvm-svn: 60429
2008-12-02 18:33:11 +00:00
Tilmann Scheller 318ccb0e62 make it possible to custom lower TRUNCATE (needed for the CellSPU target)
llvm-svn: 60409
2008-12-02 12:12:25 +00:00
Chris Lattner 1db9bbe802 Implement PRE of loads in the GVN pass with a pretty cheap and
straight-forward implementation.  This does not require any extra
alias analysis queries beyond what we already do for non-local loads.

Some programs really really like load PRE.  For example, SPASS triggers
this ~1000 times, ~300 times in 255.vortex, and ~1500 times on 403.gcc.

The biggest limitation to the implementation is that it does not split
critical edges.  This is a huge killer on many programs and should be
addressed after the initial patch is enabled by default.

The implementation of this should incidentally speed up rejection of 
non-local loads because it avoids creating the repl densemap in cases 
when it won't be used for fully redundant loads.

This is currently disabled by default.
Before I turn this on, I need to fix a couple of miscompilations in
the testsuite, look at compile time performance numbers, and look at
perf impact.  This is pretty close to ready though.

llvm-svn: 60408
2008-12-02 08:16:11 +00:00
Nick Lewycky 4d9966dd2d Add a new SCEV representing signed division.
llvm-svn: 60407
2008-12-02 08:05:48 +00:00
Mon P Wang 6e1c6ad127 Removed some unnecessary code in widening.
llvm-svn: 60406
2008-12-02 07:35:08 +00:00
Chris Lattner 9c1b5027e7 add a little helper function that does PHI translation.
llvm-svn: 60405
2008-12-02 07:16:45 +00:00
Chris Lattner 0cdc0bbb8a add a note
llvm-svn: 60404
2008-12-02 06:32:34 +00:00
Bill Wendling 87beb9b909 Remove some errors that crept in. No functionality change.
llvm-svn: 60403
2008-12-02 06:24:20 +00:00
Bill Wendling 790b4bf9a9 Merge two if-statements into one.
llvm-svn: 60402
2008-12-02 06:22:04 +00:00
Bill Wendling 5635295266 More styalistic changes. No functionality change.
llvm-svn: 60401
2008-12-02 06:18:11 +00:00
Chris Lattner 734e72fb51 add densemap range insertion method.
llvm-svn: 60400
2008-12-02 06:08:04 +00:00
Bill Wendling 85de4b35ca - Remove the buggy -X/C -> X/-C transform. This isn't valid when X isn't a
constant. If X is a constant, then this is folded elsewhere.

- Added a note to Target/README.txt to indicate that we'd like to implement
  this when we're able.

llvm-svn: 60399
2008-12-02 05:12:47 +00:00
Bill Wendling 5369db5917 Improve comment.
llvm-svn: 60398
2008-12-02 05:09:00 +00:00
Bill Wendling 21716dff5e - Reduce nesting.
- No need to do a swap on a canonicalized pattern.

No functionality change.

llvm-svn: 60397
2008-12-02 05:06:43 +00:00
Chris Lattner ead1a61b47 some random comment improvements.
llvm-svn: 60395
2008-12-02 04:52:26 +00:00
Owen Anderson 35bd70c07a Add a test for my previous PRE fix.
llvm-svn: 60394
2008-12-02 04:25:42 +00:00
Owen Anderson d930420ccf Fix an issue that Chris noticed, where local PRE was not properly instantiating
a new value numbering set after splitting a critical edge.  This increases
the number of instances of PRE on 403.gcc from ~60 to ~570.

llvm-svn: 60393
2008-12-02 04:09:22 +00:00
Evan Cheng 1718fd4375 Fix PR3124: overly strict assert.
llvm-svn: 60392
2008-12-02 02:15:36 +00:00
Dale Johannesen 8c76670b5a Add a few more transformations.
llvm-svn: 60391
2008-12-02 01:30:54 +00:00
Bill Wendling 30e9dc81c8 Second stab at target-dependent lowering of everyone's favorite nodes: [SU]ADDO
- LowerXADDO lowers [SU]ADDO into an ADD with an implicit EFLAGS define. The
  EFLAGS are fed into a SETCC node which has the conditional COND_O or COND_C,
  depending on the type of ADDO requested.

- LowerBRCOND now recognizes if it's coming from a SETCC node with COND_O or
  COND_C set.

llvm-svn: 60388
2008-12-02 01:06:39 +00:00
Bill Wendling 122c515809 Reapply r60382. This time, don't mark "ADC" nodes with "implicit EFLAGS".
llvm-svn: 60385
2008-12-02 00:07:05 +00:00
Bill Wendling 351b6659ad Temporarily revert r60382. It caused CodeGen/X86/i2k.ll and others to fail.
llvm-svn: 60383
2008-12-01 23:44:08 +00:00
Bill Wendling a435b1aebc - Have "ADD" instructions return an implicit EFLAGS.
- Add support for seto, setno, setc, and setnc instructions.

llvm-svn: 60382
2008-12-01 23:30:42 +00:00