Commit Graph

66988 Commits

Author SHA1 Message Date
Chris Lattner 4e3e930743 fix a bug I introduced with my 'instcombine builder' refactoring
changes: SimplifyDemandedBits can't use the builder yet because it
has the wrong insertion point.  This fixes a crash building
MultiSource/Benchmarks/PAQ8p

llvm-svn: 80537
2009-08-31 04:36:22 +00:00
Chris Lattner 2f2110affa simplify some code by making the SCCNodes set contain Function*'s
instead of CallGraphNode*'s.  This also papers over a callgraph
problem where a pass (in this case, MemCpyOpt) introduces a new
function into the module (llvm.memset.i64) but doesn't add it to
the call graph (nor should it, since it is a function pass).

While it might be a good idea for MemCpyOpt to not synthesize 
functions in a runOnFunction(), there is no need for FunctionAttrs
to be boneheaded, so fix it there.  This fixes an assertion building
176.gcc.

llvm-svn: 80535
2009-08-31 04:09:04 +00:00
Chris Lattner edcbfe8529 only print the override triple if it exists!
llvm-svn: 80534
2009-08-31 03:22:35 +00:00
Chris Lattner 081375bb08 Fix PR4834, a tricky case where the inliner would resolve an
indirect function pointer, inline it, then go to delete the body.
The problem is that the callgraph had other references to the function,
though the inliner had no way to know it, so we got a dangling pointer
and an invalid iterator out of the deal.

The fix to this is pretty simple: stop the inliner from deleting the
function by knowing that there are references to it.  Do this by making
CallGraphNodes contain a refcount.  This requires moving deletion of 
available_externally functions to the module-level cleanup sweep where
it belongs.

llvm-svn: 80533
2009-08-31 03:15:49 +00:00
Chris Lattner 4275cf2efa use an accessor instead of poking internals of a node.
llvm-svn: 80532
2009-08-31 02:24:20 +00:00
Oscar Fuentes c6db3ee94b CMake: updated library dependencies.
llvm-svn: 80531
2009-08-31 01:58:50 +00:00
Jim Grosbach ce713134b8 PR4747
Shared landing pads run into trouble with SJLJ, as the dispatch table is
mapped to call sites, and merging the pads will throw that off. There needs
to be a one-to-one mapping of landing pad exception table entries to invoke
call points.

Detecting the shared pad during lowering of SJLJ info insn't sufficient, as
the dispatch function may still need separate destinations to properly
handle phi-nodes.

llvm-svn: 80530
2009-08-31 01:35:03 +00:00
Steve Naroff 1054e60334 More fleshing out the C-based indexing API (under construction).
llvm-svn: 80529
2009-08-31 00:59:03 +00:00
Chris Lattner b1c3df239d update unit test for previous change.
llvm-svn: 80528
2009-08-31 00:28:46 +00:00
Chris Lattner 305b115a87 Fix some nasty callgraph dangling pointer problems in
argpromotion and structretpromote.  Basically, when replacing
a function, they used the 'changeFunction' api which changes
the entry in the function map (and steals/reuses the callgraph
node).

This has some interesting effects: first, the problem is that it doesn't
update the "callee" edges in any callees of the function in the call graph.
Second, this covers for a major problem in all the CGSCC pass stuff, which 
is that it is completely broken when functions are deleted if they *don't*
reuse a CGN.  (there is a cute little fixme about this though :).

This patch changes the protocol that CGSCC passes must obey: now the CGSCC 
pass manager copies the SCC and preincrements its iterator to avoid passes
invalidating it.  This allows CGSCC passes to mutate the current SCC.  However
multiple passes may be run on that SCC, so if passes do this, they are now
required to *update* the SCC to be current when they return.

Other less interesting parts of this patch are that it makes passes update
the CG more directly, eliminates changeFunction, and requires clients of
replaceCallSite to specify the new callee CGN if they are changing it.

llvm-svn: 80527
2009-08-31 00:19:58 +00:00
Erick Tryzelaar a64b1c1d4c Fix header comment for bindings/ocaml/llvm/Makefile.
llvm-svn: 80526
2009-08-30 23:41:20 +00:00
Erick Tryzelaar f34cb0cab4 Make sure we specify no arguments for context functions.
llvm-svn: 80525
2009-08-30 23:38:06 +00:00
Chris Lattner 69349a55e7 add a dump() method on callgraph.
llvm-svn: 80524
2009-08-30 22:24:32 +00:00
Chris Lattner 394b95c005 rename test
llvm-svn: 80523
2009-08-30 22:14:17 +00:00
Chris Lattner 71d51a2d79 merge all sinking tests into one and convert them to filecheck.
llvm-svn: 80522
2009-08-30 22:13:26 +00:00
Chris Lattner 362654f51c convert scalar_promote to filecheck style and merge 2003-12-13-VolatilePromote.ll into it.
llvm-svn: 80521
2009-08-30 22:08:19 +00:00
Chris Lattner b284f7b1d9 eliminate some uses of prcontext. Any help here would be appreciated :)
llvm-svn: 80520
2009-08-30 21:45:23 +00:00
Chris Lattner 2d3e0a35bd rename test so that name reflects what it is testing for.
llvm-svn: 80519
2009-08-30 21:36:39 +00:00
Chris Lattner c7d5796af8 convert to filecheck format.
llvm-svn: 80518
2009-08-30 21:36:06 +00:00
Chris Lattner 9e371f4b8b suck a bunch more gep tests into getelementptr.ll and filecheckize them all.
llvm-svn: 80517
2009-08-30 21:31:34 +00:00
Daniel Dunbar 60745fe8e6 Tweak comment.
llvm-svn: 80516
2009-08-30 21:14:05 +00:00
Daniel Dunbar bf75ffd1e2 Fix some possible-use-of-uninitialized warnings.
llvm-svn: 80515
2009-08-30 21:13:58 +00:00
Chris Lattner 89a9bb77e2 consolodate various GEP tests into getelementptr.ll using filecheck.
llvm-svn: 80514
2009-08-30 21:02:36 +00:00
Chris Lattner 2708a312db another huge testcase, this time from 'gs' in llvm-test.
llvm-svn: 80513
2009-08-30 21:02:02 +00:00
Chris Lattner 3e1b67f62f remove another poorly-reduced testcase which came from ldecod in llvm-test.
llvm-svn: 80512
2009-08-30 21:01:14 +00:00
Chris Lattner 8a2905e132 this testcase is 500 lines long and is distilled from bzip2, just
remove it.

llvm-svn: 80511
2009-08-30 21:00:11 +00:00
Chris Lattner 4698e19cba convert to filecheck
llvm-svn: 80510
2009-08-30 20:48:15 +00:00
Chris Lattner 73913f4cd3 Fix PR4748: don't fold gep(bitcast(x)) into bitcast(gep) when x
is itself a bitcast.  Since we have gep(bitcast(bitcast(y))) in this
case, just wait for the two bitcasts to get zapped.  This prevents
instcombine from confusing some aliasing stuff, and allows it to
directly eliminate the load in the testcase.

llvm-svn: 80508
2009-08-30 20:38:21 +00:00
Chris Lattner c2f2cf896e misc cleanup
llvm-svn: 80507
2009-08-30 20:36:46 +00:00
Chris Lattner a3e620caba add getPointerAddressSpace() to GEP instruction, use the method
in a few scalar xforms to simplify things.

llvm-svn: 80506
2009-08-30 20:06:40 +00:00
Chris Lattner c856539edf eliminate InsertCastBefore, use the builder instead.
llvm-svn: 80505
2009-08-30 20:01:10 +00:00
Chris Lattner 606da5fed8 eliminate InsertBitCastBefore, just use the builder instead.
llvm-svn: 80504
2009-08-30 19:47:22 +00:00
Chris Lattner ce3b538a7b add a "getPointerAddressSpace" helper method to LoadInst and StoreInst.
llvm-svn: 80503
2009-08-30 19:45:21 +00:00
Anton Korobeynikov 3681144bd8 Add missed pattern
llvm-svn: 80502
2009-08-30 19:06:39 +00:00
Chris Lattner 5966341a2e convert a bunch more calls to InsertNewInstBefore to use
the new Instcombine builder.

llvm-svn: 80501
2009-08-30 18:50:58 +00:00
Chris Lattner 8326d529da fix typo
llvm-svn: 80500
2009-08-30 17:53:59 +00:00
Chris Lattner 947365f73f hopefully unbreak the build by making this-> explicit for dependent
base class lookup.

llvm-svn: 80499
2009-08-30 17:44:10 +00:00
Anton Korobeynikov eab572a8ff EXTRACT_VECTOR_ELEMENT can have result type different from element type.
Remove the assertion and generalize the code for ARM NEON stuff.

llvm-svn: 80498
2009-08-30 17:14:54 +00:00
Torok Edwin e14d4cdb5f Add regular expression matching support, based on OpenBSD regexec()/regcomp()
implementation.

llvm-svn: 80493
2009-08-30 08:24:09 +00:00
Chris Lattner 022a582de2 give instcombine a custom IRBuilder that adds new instructions to the
workslist and is set to insert new instructions before the current one.
Convert a bunch of stuff that used to call InsertNewInstBefore over to
use it, greatly simplifying code and making it more natural.

There is still a lot more to go, but this is a good start.

llvm-svn: 80492
2009-08-30 07:44:24 +00:00
Anders Carlsson b533df02b5 More missing member goodness.
llvm-svn: 80491
2009-08-30 07:09:50 +00:00
Daniel Dunbar 03686805e8 Update test.
llvm-svn: 80490
2009-08-30 07:01:09 +00:00
Anders Carlsson 0d2a51b61f Improve missing error messages as suggested by Doug.
llvm-svn: 80489
2009-08-30 06:49:43 +00:00
Chris Lattner a0c89ee1da add a new InstCombineWorklist::AddValue method that works even
if the operand is not an instruction.

Simplify most uses of AddOperandsToWorkList to use AddValue and
inline it into the one remaining callsite.

llvm-svn: 80488
2009-08-30 06:27:41 +00:00
Chris Lattner bacd05c2eb move AddUsersToWorkList to the worklist processing class, make the
argument stronger typed.

llvm-svn: 80487
2009-08-30 06:22:51 +00:00
Chris Lattner 795bfdbb55 rename AddUsesToWorkList -> AddOperandsToWorkList. The
former looks too much like AddUsersToWorkList and keeps
confusing me.

Remove AddSoonDeadInstToWorklist and change its two callers
to do the same thing in a simpler way.

llvm-svn: 80486
2009-08-30 06:20:05 +00:00
Daniel Dunbar 6e8b1a2530 llvm-mc/X86: Encode constant MCValue's correctly.
llvm-svn: 80485
2009-08-30 06:17:49 +00:00
Daniel Dunbar 6a715dccdf llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now.
- Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency).

llvm-svn: 80484
2009-08-30 06:17:16 +00:00
Chris Lattner 905976b1db inline the trivial AddToWorkList/RemoveFromWorkList methods
into their callers.  simplify ReplaceInstUsesWith.  Make
EraseInstFromFunction only add operands to the worklist if
there aren't too many of them (this was a scalability win
for crazy programs that was only infrequently enforced).
Switch more code to using EraseInstFromFunction instead of
duplicating it inline.  Change some fcmp/icmp optimizations
to modify fcmp/icmp in place instead of creating a new one
and deleting the old one just to change the predicate.

llvm-svn: 80483
2009-08-30 06:13:40 +00:00
Chris Lattner 93ad6170fd fix a bug I introduced in r80478 found by the build bot.
llvm-svn: 80482
2009-08-30 05:56:44 +00:00