Commit Graph

5351 Commits

Author SHA1 Message Date
Owen Anderson
333c400965 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 23:48:35 +00:00
Owen Anderson
a547b4708b A little bit more LLVMContextification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 18:36:20 +00:00
Nick Lewycky
89f43a5c70 There's no need to consider PHI nodes in the same block as the instruction
we're inserting sigma/phi functions for. Patch by Andre Tavares.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 15:59:27 +00:00
Nick Lewycky
6ca7f41f5b Add some statistics to SSI so we can see what it's up to.
Add an -ssi-everything pass which calls createSSI on everything in the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75135 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 15:33:14 +00:00
Owen Anderson
d1fbd14294 Push LLVMContext _back_ through IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 20:50:47 +00:00
Dan Gohman
85ebb0f66c Tell ScalarEvolution to forget a loop before starting to delete it.
This way ScalarEvolution can examine the loop to determine what state
it needs to update, if it chooses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75029 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 19:14:29 +00:00
Owen Anderson
e9b11b4313 Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 19:03:57 +00:00
Nick Lewycky
7f6aa2b162 Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 03:04:38 +00:00
Owen Anderson
3d29df3e8a Push LLVMContext through GlobalVariables and IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:26:06 +00:00
Dan Gohman
0bba49cebc Change all SCEV* to SCEV *.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74918 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 17:06:11 +00:00
Owen Anderson
07cf79ef53 "LLVMContext* " --> "LLVMContext *"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74878 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 23:00:19 +00:00
Owen Anderson
76f600b205 Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's through the ValueTracking API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74873 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 22:37:39 +00:00
Owen Anderson
508955156a Thread LLVMContext through the constant folding APIs, which touches a lot of files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 18:42:36 +00:00
Owen Anderson
14ce9ef2e9 More LLVMContext-ification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 01:34:54 +00:00
Owen Anderson
0a205a4598 More LLVMContext-ification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-05 22:41:43 +00:00
Mike Stump
9d1a81daaa Fix build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 22:11:58 +00:00
Owen Anderson
fa5cbd6d0f Even more passes being LLVMContext'd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 19:42:02 +00:00
Nick Lewycky
715029478c 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 19:28:36 +00:00
Duncan Sands
d5f50da7f0 Add newline at end of file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74773 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 15:30:58 +00:00
Owen Anderson
1ff50b380e Second batch of passes using LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74753 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 00:54:20 +00:00
Owen Anderson
d672ecb017 Convert the first batch of passes to use LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 00:17:18 +00:00
Chris Lattner
62c762f329 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.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 15:39:39 +00:00
Dan Gohman
f530c92cd5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 00:17:47 +00:00
Dan Gohman
62476cceee Request LCSSA after LoopSimplify. This fixes a problem in which the
PassManager was scheduling LCSSA before LoopSimplify, which does not
preserve LCSSA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:21:38 +00:00
Dan Gohman
6cc18fedf8 Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:38:46 +00:00
Owen Anderson
8b477ed579 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:58:40 +00:00
Chris Lattner
0fd38069cb 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 04:13:31 +00:00
Dan Gohman
2aa93efa0c Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74491 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 01:24:43 +00:00
Dan Gohman
f7ca1611e2 Don't try to split a loop when the controlling icmp instruction
doesn't have an IV-based operand. This fixes PR4471.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 22:58:27 +00:00
Dan Gohman
a1baee20c4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 22:32:36 +00:00
Dan Gohman
4b35f83b91 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 21:30:38 +00:00
Dan Gohman
cfb32203bc More minor code simplifications.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74395 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 21:23:40 +00:00
Dan Gohman
de53dc03f5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 05:16:57 +00:00
Dan Gohman
667d787c0a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:53:46 +00:00
Devang Patel
acec7b35aa Remove unused routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:53:22 +00:00
Owen Anderson
afe0a083c1 Constify this value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:39:56 +00:00
Douglas Gregor
8947881444 Fix linking of llvm-ld and lli with CMake, from Xerxes Rånby
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 15:37:00 +00:00
Devang Patel
13e16b65dd Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprograms
and llvm.dbg.global_variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 01:49:18 +00:00
Dan Gohman
e1047fbb97 Change this code to a form about which VC++ reportedly isn't unhappy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74243 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:35:12 +00:00
Dan Gohman
6b9c959c61 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:31:13 +00:00
Dan Gohman
30d670f51f Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 00:26:03 +00:00
Dan Gohman
cc4e605721 Reword a few comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74146 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 00:22:44 +00:00
Dan Gohman
32a81a3f6d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 14:31:06 +00:00
Dan Gohman
40a5a1b39e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 01:18:18 +00:00
Dan Gohman
ea080be986 Don't emit a redundant BitCastInst if the value to be defined in the
preheader is already an instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:28:59 +00:00
Dan Gohman
469f3cdc13 Fix a few minor issues that were exposed by the removal of SCEVHandle.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73910 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 22:08:45 +00:00
Owen Anderson
372b46cad9 SCEVHandle is no more!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 21:39:50 +00:00
Dan Gohman
03ad6982c4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73864 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 00:15:15 +00:00
Dan Gohman
5392dce881 Rename a variable for consistency with the ExitBlock vs ExitingBlock
terminology that LoopInfo uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 23:48:38 +00:00
Dan Gohman
224a19c490 Fix a typo in a comment that Frits von Bommel noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 23:41:37 +00:00