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

5329 Commits

Author SHA1 Message Date
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
Eli Friedman
b3947071ff PR3439: Correct a silly mistake in the SimplifyDemandedUseBits code for
SRem.

llvm-svn: 73598
2009-06-17 02:57:36 +00:00
Dan Gohman
54bbef1525 Generalize a few more instcombines to be vector/scalar-independent.
llvm-svn: 73541
2009-06-16 19:55:29 +00:00
Chris Lattner
574c5de9f8 Generalize instcombine's isSafeToLoadUnconditionally() function
to ignore readonly calls, and factor it out of instcombine so
that it can be used by other passes.  Patch by Frits van Bommel!

llvm-svn: 73506
2009-06-16 17:23:12 +00:00
Dan Gohman
992bf87a6f Use Type::getScalarType.
llvm-svn: 73451
2009-06-16 00:20:26 +00:00
Dan Gohman
2e737ac21f Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.

llvm-svn: 73431
2009-06-15 22:12:54 +00:00
Dale Johannesen
2d0be306fb Fix the crash in this test. This is basically the same
problem addressed in 31284, but the patch there only
addressed the case where an invoke is the first thing in
a block.

llvm-svn: 73416
2009-06-15 20:59:27 +00:00
Owen Anderson
9a8f02a7d5 Merge PartialInliner changes.
llvm-svn: 73412
2009-06-15 20:50:26 +00:00
Dan Gohman
59c4088e16 Make the EnableLoadPRE variable static.
llvm-svn: 73398
2009-06-15 18:30:15 +00:00
Dan Gohman
111f127d23 Fix old-style type names in comments.
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Dan Gohman
d895ed43c8 Convert several parts of the ScalarEvolution framework to use
SmallVector instead of std::vector.

llvm-svn: 73357
2009-06-14 22:47:23 +00:00