Owen Anderson
23a7866a06
Fix a subtle bug when removing instructions from memdep. In very specific
...
circumstances we could end up remapping a dependee to the same instruction
that we're trying to remove. Handle this properly by just falling back to
a conservative solution.
llvm-svn: 54132
2008-07-28 16:00:58 +00:00
Nate Begeman
ce064348d9
Fix minor issues with VICmp/VFCmp constant expressions
...
llvm-svn: 54030
2008-07-25 17:35:37 +00:00
Nick Lewycky
cc7b41c130
Revert r53812 -- premature. LegalizeTypes isn't actually on yet!
...
llvm-svn: 53816
2008-07-21 04:03:00 +00:00
Nick Lewycky
ea4a155439
Switch on the use of arbitrary precision integers in scalar evolution. This will
...
bail after 256-bits to avoid producing code that the backends can't handle.
Previously, we capped it at 64-bits, preferring to miscompile in those cases.
This change also reverts much of r52248 because the invariants the code was
expecting are now being met.
llvm-svn: 53812
2008-07-21 02:51:31 +00:00
Wojciech Matyjewicz
f9ef4917c9
This header isn't necessary now.
...
llvm-svn: 53811
2008-07-20 17:35:32 +00:00
Wojciech Matyjewicz
eea926ec20
Fix PR2088. Use modulo linear equation solver to compute loop iteration
...
count.
llvm-svn: 53810
2008-07-20 15:55:14 +00:00
Matthijs Kooijman
96d9bcbdf6
Don't use ++idx_begin when I actually mean idx_begin + 1, especially since we
...
also use *idx_begin in the same expression, giving unpredictable results.
This fixes this bug: http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-July/015877.html
llvm-svn: 53670
2008-07-16 10:47:35 +00:00
Nick Lewycky
0d582485f9
Correct this inversion!
...
I swear that didn't show up in svn diff...
llvm-svn: 53587
2008-07-15 03:47:44 +00:00
Nick Lewycky
ac8e34e574
Fix up comments.
...
llvm-svn: 53586
2008-07-15 03:40:27 +00:00
Nick Lewycky
df9e9f0b0e
Stop creating extraneous smax/umax in SCEV. This removes a regression where we
...
started complicating many loops ('for' loops, in fact).
llvm-svn: 53508
2008-07-12 07:41:32 +00:00
Dan Gohman
fee8b04935
Fix spelling of "hierarchy" in comments.
...
llvm-svn: 53489
2008-07-11 22:51:32 +00:00
Dan Gohman
d1342570f2
Use find instead of lower_bound.
...
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Nick Lewycky
86adf455bd
Remove getValueRange from SCEV. It wasn't doing anything there anyways, and a
...
more complete version is now available from the LoopVR pass.
llvm-svn: 53269
2008-07-09 03:21:51 +00:00
Nick Lewycky
9cecc07bec
Expand SCEVUDiv of power of 2 to a lshr instruction.
...
llvm-svn: 53217
2008-07-08 05:05:37 +00:00
Nick Lewycky
5b1024c386
Handle 'lshr' instruction with SCEVUDiv object.
...
Comment the xor %x, -1 case.
llvm-svn: 53167
2008-07-07 06:15:49 +00:00
Devang Patel
f3ca5b9a8b
Keep track of inherited analysis (e.g. dominator tree).
...
llvm-svn: 53088
2008-07-03 07:02:30 +00:00
Owen Anderson
5747d627e0
A better fix for PR2503 that doesn't pessimize GVN in the presence of unreachable blocks.
...
llvm-svn: 53032
2008-07-02 17:20:16 +00:00
Devang Patel
0fc2badc38
Fix typos in comments.
...
Thanks for the feedback!
llvm-svn: 52978
2008-07-01 19:50:56 +00:00
Devang Patel
1e1f4a0bdd
Add dom info verifier.
...
llvm-svn: 52967
2008-07-01 17:44:24 +00:00
Owen Anderson
99a71c6ac6
Properly handle cases where a predecessor of the block being queried on is unreachable.
...
This fixes PR2503, though we should also fix other passes not to emit this kind of code.
llvm-svn: 52946
2008-07-01 00:40:58 +00:00
Evan Cheng
2005804de6
- Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an empty string for ConstantAggregateZero case which surprises selectiondag.
...
- Correctly handle memcpy from constant string which is zero-initialized.
llvm-svn: 52891
2008-06-30 07:31:25 +00:00
Nick Lewycky
d63159dcd4
Add a value range analysis that lazily computes ranges using ScalarEvolutions.
...
llvm-svn: 52885
2008-06-30 00:04:21 +00:00
Anton Korobeynikov
6f260767ec
Revert (52748 and friends):
...
Move GetConstantStringInfo to lib/Analysis. Remove
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.
This unbreaks llvm-gcc bootstrap.
llvm-svn: 52884
2008-06-29 17:57:03 +00:00
Chris Lattner
090d81df5e
Add back the capability to include nul characters in strings with
...
GetConstantStringInfo. This will hopefully restore llvm-gcc to
happy bootstrap land.
llvm-svn: 52851
2008-06-28 05:33:32 +00:00
Chris Lattner
98b286ff98
Tighten up checking.
...
llvm-svn: 52850
2008-06-28 04:37:04 +00:00
Chris Lattner
c94b39d65c
fix the regressions from Eric's patch by making GetConstantStringInfo
...
tolerate a non-nul-terminated string, and handling a direct global
reference.
llvm-svn: 52813
2008-06-27 03:36:51 +00:00
Owen Anderson
8c36469880
Reserve the size we'll need in advance.
...
llvm-svn: 52763
2008-06-26 04:47:41 +00:00
Eric Christopher
4f05c48718
Move GetConstantStringInfo to lib/Analysis. Remove
...
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.
llvm-svn: 52748
2008-06-26 00:31:12 +00:00
Dan Gohman
90894ac18b
Generalize createSCEV to be able to form SCEV expressions from
...
ConstantExprs.
llvm-svn: 52615
2008-06-22 19:56:46 +00:00
Dan Gohman
81c83d9a1d
Use SCEVAddRecExpr::isAffine.
...
llvm-svn: 52614
2008-06-22 19:23:09 +00:00
Dan Gohman
311865bd24
Move a few more SCEVExpander methods out-of-line.
...
llvm-svn: 52612
2008-06-22 19:09:18 +00:00
Chris Lattner
76d8bbc7c2
fix warning when assertions disabled.
...
llvm-svn: 52589
2008-06-21 19:48:22 +00:00
Duncan Sands
054b82d555
Fix some warnings reported by gcc-4.3. Hopefully
...
this still compiles on windows - I can't test!
llvm-svn: 52488
2008-06-19 08:47:31 +00:00
Dan Gohman
606a60ad68
Move SCEVExpander::visitAddExpr out-of-line.
...
llvm-svn: 52464
2008-06-18 16:37:11 +00:00
Dan Gohman
82f9df016e
Move LSR's private isZero function to a public SCEV member
...
function, and make use of it in several places.
llvm-svn: 52463
2008-06-18 16:23:07 +00:00
Matthijs Kooijman
dd18157e57
Use a SmallVector instead of an array, since auto_ptr doesn't handle arrays
...
properly.
llvm-svn: 52390
2008-06-17 08:24:37 +00:00
Matthijs Kooijman
2ba9a750dd
Make BuildSubAggregate use FindInsertedElement again to prevent it from
...
inserting extractvalues. In particular, this prevents the insertion of
extractvalues that can't be folded away later. Also add an example of when this
stuff is needed.
llvm-svn: 52328
2008-06-16 14:13:46 +00:00
Matthijs Kooijman
544c9b2fb0
Make the InsertBefore argument to FindInsertedValue optional, so you can find an inserted value without modifying the code.
...
llvm-svn: 52319
2008-06-16 13:28:31 +00:00
Matthijs Kooijman
238b1e8d69
Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.
...
llvm-svn: 52318
2008-06-16 13:13:08 +00:00
Matthijs Kooijman
dedcf00fcc
80 column fixes.
...
llvm-svn: 52316
2008-06-16 12:57:37 +00:00
Matthijs Kooijman
1dd7d9cdc1
Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. While
...
I'm at it, rename it to FindInsertedValue.
The only functional change is that newly created instructions are no longer
added to instcombine's worklist, but that is not really necessary anyway (and
I'll commit some improvements next that will completely remove the need).
llvm-svn: 52315
2008-06-16 12:48:21 +00:00
Chris Lattner
0bc9e4aa8f
simplify some code by using a helper function. This really really
...
wants a 'nocapture' predicate.
llvm-svn: 52304
2008-06-16 06:38:26 +00:00
Chris Lattner
35be1f6c83
move a bunch of predicates up into their own section
...
in this file, no other changes.
llvm-svn: 52303
2008-06-16 06:30:22 +00:00
Chris Lattner
12453dd555
Other parts of this code treat noalias arguments as objects for
...
the purposes of escape analysis.
llvm-svn: 52302
2008-06-16 06:28:01 +00:00
Chris Lattner
e987a3bdd1
If we are checking to see if the result of a call aliases a
...
pointer derived from a local allocation, if the local allocation
never escapes, the pointers can't alias. This implements PR2436
llvm-svn: 52301
2008-06-16 06:19:11 +00:00
Chris Lattner
4e38446b34
Refactor basicaa's main alias function somethin' fierce.
...
This fixes several minor bugs (such as returning noalias
for comparisons between external weak functions an null) but
is mostly a cleanup.
llvm-svn: 52299
2008-06-16 06:10:11 +00:00
Wojciech Matyjewicz
58f5cc8864
Fix PR2434. When scanning for exising binary operator to reuse don't
...
take into account the instrucion pointed by InsertPt. Thanks to it,
returning the new value of InsertPt to the InsertBinop() caller can be
avoided. The bug was, actually, in visitAddRecExpr() method which wasn't
correctly handling changes of InsertPt. There shouldn't be any
performance regression, as -gvn pass (run after -indvars) removes any
redundant binops.
llvm-svn: 52291
2008-06-15 19:07:39 +00:00
Wojciech Matyjewicz
f66a7fe9de
Change 'while' loop to 'do' loop.
...
Add a safety measure. It isn't safe to assume in ScalarEvolutionExpander that
all loops are in canonical form (but it should be safe for loops that have
AddRecs).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
llvm-svn: 52275
2008-06-14 16:48:22 +00:00
Nick Lewycky
0aa53f2b52
Crash less. The i64 restriction in BinomialCoefficient caused some problems
...
with code that was expecting different bit widths for different values.
Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.
llvm-svn: 52248
2008-06-13 04:38:55 +00:00
Chris Lattner
67a5a4eba8
Expose a public interface to this pass.
...
llvm-svn: 52029
2008-06-05 23:45:18 +00:00