1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

5339 Commits

Author SHA1 Message Date
Owen Anderson
a8ce571a68 Even more passes being LLVMContext'd.
llvm-svn: 74781
2009-07-03 19:42:02 +00:00
Nick Lewycky
b01a2dc7ba Add Static Single Information construction pass written by André Tavares!
Use it by requiring it through the pass manager, then calling its createSSI
method on the variables that you want in SSI form.

llvm-svn: 74780
2009-07-03 19:28:36 +00:00
Duncan Sands
1708a93077 Add newline at end of file.
llvm-svn: 74773
2009-07-03 15:30:58 +00:00
Owen Anderson
6795819c9e Second batch of passes using LLVMContext.
llvm-svn: 74753
2009-07-03 00:54:20 +00:00
Owen Anderson
7fb95ff5dd Convert the first batch of passes to use LLVMContext.
llvm-svn: 74748
2009-07-03 00:17:18 +00:00
Chris Lattner
3d8ec50f8a fix inverted logic pointed out by John McCall, noticed by inspection.
This was considering vector intrinsics to have cost 2, but non-vector
intrinsics to have cost 1, which is backward.

llvm-svn: 74698
2009-07-02 15:39:39 +00:00
Dan Gohman
e89dc58a7e Fix a bunch of other places that used operator[] to test whether
a key is present in a std::map or DenseMap to use find instead.

llvm-svn: 74676
2009-07-02 00:17:47 +00:00
Dan Gohman
499f79ba60 Request LCSSA after LoopSimplify. This fixes a problem in which the
PassManager was scheduling LCSSA before LoopSimplify, which does not
preserve LCSSA.

llvm-svn: 74661
2009-07-01 23:21:38 +00:00
Dan Gohman
e3b1f9e14b Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487.
llvm-svn: 74646
2009-07-01 21:38:46 +00:00
Owen Anderson
81b8dabb53 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Chris Lattner
4bdaace06e improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least).  Patch by Jay Foad!

llvm-svn: 74584
2009-07-01 04:13:31 +00:00
Dan Gohman
49c397bf4b Minor code simplification.
llvm-svn: 74491
2009-06-30 01:24:43 +00:00
Dan Gohman
28702fab4e Don't try to split a loop when the controlling icmp instruction
doesn't have an IV-based operand. This fixes PR4471.

llvm-svn: 74399
2009-06-27 22:58:27 +00:00
Dan Gohman
fcd5eedead Remove the block from the LoopInfo, rather than just the Loop.
LoopInfo will handle removing it from the Loop, as well as updating
its own tables.

llvm-svn: 74398
2009-06-27 22:32:36 +00:00
Dan Gohman
8d2a45fadb Teach LoopSimplify how to merge multiple loop exits into a single exit,
when one of them can be converted to a trivial icmp and conditional
branch.

This addresses what is essentially a phase ordering problem.
SimplifyCFG knows how to do this transformation, but it doesn't do so
if the primary block has any instructions in it other than an icmp and
a branch. In the given testcase, the block contains other instructions,
however they are loop-invariant and can be hoisted. SimplifyCFG doesn't
have LoopInfo though, so it can't hoist them. And, it's important that
the blocks be merged before LoopRotation, as it doesn't support
multiple-exit loops.

llvm-svn: 74396
2009-06-27 21:30:38 +00:00
Dan Gohman
a753bd44ff More minor code simplifications.
llvm-svn: 74395
2009-06-27 21:23:40 +00:00
Dan Gohman
4acfd5098d When a value is used multiple times within a single PHI, instructions
inserted to replace that value must dominate all of of the basic
blocks associated with the uses of the value in the PHI, not just
one of them.

llvm-svn: 74376
2009-06-27 05:16:57 +00:00
Dan Gohman
4f74e815f1 Incorporate the insertion point into the key of SCEVExpander's CSE map.
This helps it avoid reusing an instruction that doesn't dominate all
of the users, in cases where the original instruction was inserted
before all of the users were known.  This may result in redundant
expansions of sub-expressions that depend on loop-unpredictable values
in some cases, however this isn't very common, and it primarily impacts
IndVarSimplify, so GVN can be expected to clean these up.

This eliminates the need for IndVarSimplify's FixUsesBeforeDefs,
which fixes several bugs.

llvm-svn: 74352
2009-06-26 22:53:46 +00:00
Devang Patel
4f5d296df0 Remove unused routines.
llvm-svn: 74351
2009-06-26 22:53:22 +00:00
Owen Anderson
2bcd131128 Constify this value.
llvm-svn: 74330
2009-06-26 21:39:56 +00:00
Douglas Gregor
6d9b0e8c19 Fix linking of llvm-ld and lli with CMake, from Xerxes Rånby
llvm-svn: 74285
2009-06-26 15:37:00 +00:00
Devang Patel
84a8914a4a Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprograms
and llvm.dbg.global_variables.

llvm-svn: 74251
2009-06-26 01:49:18 +00:00
Dan Gohman
71b1c43d91 Change this code to a form about which VC++ reportedly isn't unhappy.
llvm-svn: 74243
2009-06-26 00:35:12 +00:00
Dan Gohman
ba8760719f Fix LCSSA to avoid emitting a PHI node for the unwind destination of
an invoke instruction, since the value isn't really live across that
edge.

llvm-svn: 74242
2009-06-26 00:31:13 +00:00
Dan Gohman
3983d5070b Minor code simplification.
llvm-svn: 74240
2009-06-26 00:26:03 +00:00
Dan Gohman
68902a1ad2 Reword a few comments.
llvm-svn: 74146
2009-06-25 00:22:44 +00:00
Dan Gohman
c2c1e1ff38 When inserting code into a loop preheader, insert it before the
terminator, instead of after the last phi. This fixes a bug
exposed by ScalarEvolution analyzing more kinds of loops.
This fixes PR4436.

llvm-svn: 74072
2009-06-24 14:31:06 +00:00
Dan Gohman
4f4bda36df Extend ScalarEvolution's multiple-exit support to compute exact
trip counts in more cases.

Generalize ScalarEvolution's isLoopGuardedByCond code to recognize
And and Or conditions, splitting the code out into an
isNecessaryCond helper function so that it can evaluate Ands and Ors
recursively, and make SCEVExpander be much more aggressive about
hoisting instructions out of loops.

test/CodeGen/X86/pr3495.ll has an additional instruction now, but
it appears to be due to an arbitrary register allocation difference.

llvm-svn: 74048
2009-06-24 01:18:18 +00:00
Dan Gohman
1eb6954545 Don't emit a redundant BitCastInst if the value to be defined in the
preheader is already an instruction.

llvm-svn: 74031
2009-06-24 00:28:59 +00:00
Dan Gohman
b4f58ad636 Fix a few minor issues that were exposed by the removal of SCEVHandle.
llvm-svn: 73910
2009-06-22 22:08:45 +00:00
Owen Anderson
c023151c9f SCEVHandle is no more!
llvm-svn: 73906
2009-06-22 21:39:50 +00:00
Dan Gohman
8426522d55 Fix this code to correctly handle loops with multiple exits. Until
now, this hasn't mattered, because ScalarEvolution hasn't been able
to compute trip counts for loops with multiple exits. But it will
soon.

llvm-svn: 73864
2009-06-22 00:15:15 +00:00
Dan Gohman
1a33c92bb2 Rename a variable for consistency with the ExitBlock vs ExitingBlock
terminology that LoopInfo uses.

llvm-svn: 73863
2009-06-21 23:48:38 +00:00
Dan Gohman
a81541945b Fix a typo in a comment that Frits von Bommel noticed.
llvm-svn: 73796
2009-06-19 23:41:37 +00:00
Dan Gohman
651faa1905 Re-apply r73718, now that the fix in r73787 is in, and add a
hand-crafted testcase which demonstrates the bug that was exposed
in 254.gap.

llvm-svn: 73793
2009-06-19 23:23:27 +00:00
Dan Gohman
9bd151655f Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,
which it isn't prepared to handle.

llvm-svn: 73787
2009-06-19 23:03:46 +00:00
Evan Cheng
b90241ac42 Revert 73718. It's breaking 254.gap.
llvm-svn: 73783
2009-06-19 21:15:06 +00:00
Chris Lattner
8f6f044afd make jump threading handle lexically identical compare instructions
as if they were multiple uses of the same instruction.  This interacts
well with the existing loadpre that j-t does to open up many new jump
threads earlier.

llvm-svn: 73768
2009-06-19 16:27:56 +00:00
Nick Lewycky
a5f89b09c6 Teach jump threading to look at comparisons between phi nodes and non-constants.
llvm-svn: 73755
2009-06-19 04:56:29 +00:00
Chris Lattner
8ddc06469c Improve tail call elim to move loads above readonly calls
when it allows forming a tail call.  Patch by Frits van
Bommel.  This implements PR4323.

llvm-svn: 73752
2009-06-19 04:22:16 +00:00
Chris Lattner
3a683c551f part of PR4405: disable a contentious optimization for
strcmp -> memcmp when the lengths of the strings are unknown.

Patch by Nick Lewycky!

llvm-svn: 73751
2009-06-19 04:17:36 +00:00
Dan Gohman
da82dc2ec1 Generalize LSR's OptimizeSMax to handle unsigned max tests as well
as signed max tests. Along with r73717, this helps CodeGen avoid
emitting code for a maximum operation for this class of loop.

llvm-svn: 73718
2009-06-18 20:23:18 +00:00
Anton Korobeynikov
fed9dcc88c Revert IRBuilder CC propagation. Fix SimplifyLibCalls instead.
llvm-svn: 73715
2009-06-18 20:05:31 +00:00
Dan Gohman
fd857b0406 Remove the code from IVUsers that attempted to handle
casted induction variables in cases where the cast
isn't foldable. It ended up being a pessimization in
many cases. This could be fixed, but it would require
a bunch of complicated code in IVUsers' clients. The
advantages of this approach aren't visible enough to
justify it at this time.

llvm-svn: 73706
2009-06-18 16:54:06 +00:00
Dan Gohman
dc884a7830 Generalize the zext(trunc(t) & C) instcombine to work even with
C is not a low-bits mask, and add a similar instcombine for
zext((trunc(t) & C) ^ C).

llvm-svn: 73705
2009-06-18 16:30:21 +00:00
Dan Gohman
1530824138 Instcombine zext(trunc(x) & mask) to x&mask, even if the trunc has
multiple users.

llvm-svn: 73656
2009-06-17 23:17:05 +00:00
Dale Johannesen
26f0dd9021 This fixes a bug introduced in 72661, which can
move loads back past a check that the load address
is valid, see new testcase.  The test that went
in with 72661 has exactly this case, except that
the conditional it's moving past is checking
something else; I've settled for changing that
test to reference a global, not a pointer.  It
may be possible to scan all the tests you pass and
make sure none of them are checking any component
of the address, but it's not trivial and I'm not
trying to do that here.

llvm-svn: 73632
2009-06-17 20:48:23 +00:00
Torok Edwin
09a9b85420 Add debug message about non-local loads being clobbered.
llvm-svn: 73625
2009-06-17 18:48:18 +00:00
Dan Gohman
c7dfa0d7c0 Update comments to use doxygen syntax.
llvm-svn: 73621
2009-06-17 17:51:33 +00:00
Sanjiv Gupta
6d9a123c1d >> What if my global variable was into a different address space than stack?
>>     
>
> It doesn't matter in terms of semantics: because AnalyzeGlobal
> returned false, we're guaranteed the address of the global is never
> taken.  I wouldn't be surprised if we end up generating invalid IR in
> some cases, though, because of the semantics of replaceAllUsesWith.
> Do you have a testcase that breaks?
>
>   
The problem is replaceAllUsesWith asserts for type mismatch here. Try attached .bc with llvm-ld.

assert(New->getType() == getType() &&
        "replaceAllUses of value with new value of different type!");

Since stack is always on address space zero, I don't think that type of GV in a different address space is ever going to match.
The other way is to allow replaceAllUsesWith to ignore address spaces while comparing types. (do we have  a way to do that ?).
But then such an optimization may fail the entire idea of user wanting to place a variable into different memory space. The original idea of user might be to save on the stack space (data memory) and hence he asked the variable to be placed into different memory space (program memory). So the best bet here is to deny this optimization by checking

GV->getType()->getAddressSpace() == 0. 

llvm-svn: 73605
2009-06-17 06:47:15 +00:00