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

159 Commits

Author SHA1 Message Date
Nick Lewycky
6705f7577b Fix typo and indentation.
llvm-svn: 50706
2008-05-06 04:03:18 +00:00
Dale Johannesen
3453a89a31 (re)fix handling of UGT. Pointed out by Nick Lewycky.
llvm-svn: 49991
2008-04-20 16:58:57 +00:00
Chris Lattner
f390d62b7f Switch to using Simplified ConstantFP::get API.
llvm-svn: 49977
2008-04-20 00:41:09 +00:00
Dale Johannesen
c1b7e0b477 Fix a scalar evolution bug. Reversing everything
does not work because of 0; 2>0 but -2U is also >0.

llvm-svn: 49928
2008-04-18 21:38:31 +00:00
Dan Gohman
5c71910cf6 In the special case, call the comparison function instead of
manually performing the comparison. This allows the special
case to work correctly even in the case where someone is
experimenting with a different comparison function :-).

llvm-svn: 49670
2008-04-14 18:23:56 +00:00
Devang Patel
f15fe34521 Restore isCFGOnly property of various analysis passes.
llvm-svn: 48579
2008-03-20 02:25:21 +00:00
Devang Patel
5e8cbbea65 PassInfo keep tracks whether a pass is an analysis pass or not.
llvm-svn: 48554
2008-03-19 21:56:59 +00:00
Evan Cheng
e283043860 Temporarily reverting 46959.
llvm-svn: 47542
2008-02-25 03:57:32 +00:00
Nick Lewycky
3df036a7bf Simplify this code, no functionality change.
llvm-svn: 47434
2008-02-21 09:14:53 +00:00
Nick Lewycky
5f7dc506e1 GlobalValues are Constants, remove redundant code. Also fix typo in a comment.
llvm-svn: 47433
2008-02-21 08:34:02 +00:00
Anton Korobeynikov
0c5e186924 Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Nick Lewycky
4df6c66b42 Use getConstant for ConstantInts.
llvm-svn: 47361
2008-02-20 06:58:55 +00:00
Nick Lewycky
0b6cdd1eff Add 'umax' similar to 'smax' SCEV. Closes PR2003.
Parse reversed smax and umax as smin and umin and express them with negative
or binary-not SCEVs (which are really just subtract under the hood).

Parse 'xor %x, -1' as (-1 - %x).

Remove dead code (ConstantInt::get always returns a ConstantInt).

Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets
passed into a uint64_t. Instead, create the -1 directly from
ConstantInt::getAllOnesValue().

llvm-svn: 47360
2008-02-20 06:48:22 +00:00
Wojciech Matyjewicz
a62f8557d9 Fix typo. Thanks to Duncan for noticing.
llvm-svn: 47062
2008-02-13 12:21:32 +00:00
Wojciech Matyjewicz
86032c3a2f Add comments as per review feedback.
llvm-svn: 47061
2008-02-13 11:51:34 +00:00
Wojciech Matyjewicz
b6e6dacc60 Fix PR2002. Suppose n is the initial value for the induction
variable (with step 1) and m is its final value. Then, the correct trip 
count is SMAX(m,n)-n. Previously, we used SMAX(0,m-n), but m-n may 
overflow and can't in general be interpreted as signed.

Patch by Nick Lewycky.

llvm-svn: 47007
2008-02-12 15:09:36 +00:00
Wojciech Matyjewicz
2874a19254 If the LHS of the comparison is a loop-invariant we also want to move it
to the RHS. This simple change allows to compute loop iteration count 
for loops with condition similar to the one in the testcase (which seems 
to be quite common).

llvm-svn: 46959
2008-02-11 18:37:34 +00:00
Wojciech Matyjewicz
76c2b22ee4 Fix PR1798 - an error in the evaluation of SCEVAddRecExpr at an
arbitrary iteration.

The patch:
1) changes SCEVSDivExpr into SCEVUDivExpr,
2) replaces PartialFact() function with BinomialCoefficient(); the 
computations (essentially, the division) in BinomialCoefficient() are 
performed with the apprioprate bitwidth necessary to avoid overflow; 
unsigned division is used instead of the signed one.

Computations in BinomialCoefficient() require support from the code 
generator for APInts. Currently, we use a hack rounding up the 
neccessary bitwidth to the nearest power of 2. The hack is easy to turn 
off in future.

One remaining issue: we assume the divisor of the binomial coefficient 
formula can be computed accurately using 16 bits. It means we can handle 
AddRecs of length up to 9. In future, we should use APInts to evaluate 
the divisor.

Thanks to Nicholas for cooperation!

llvm-svn: 46955
2008-02-11 11:03:14 +00:00
Dan Gohman
562ed58408 Avoid unnecessarily casting away const, fixing a FIXME.
llvm-svn: 46591
2008-01-31 01:05:10 +00:00
Nick Lewycky
ea4de32234 Don't be rude, emit debugging info where asked to.
llvm-svn: 45485
2008-01-02 02:49:20 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
5ca42cd342 Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe.  While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".

llvm-svn: 44817
2007-12-10 22:53:04 +00:00
Nick Lewycky
1536b3f230 Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
llvm-svn: 44319
2007-11-25 22:41:31 +00:00
Chris Lattner
cdc6bbd519 simplify some code.
llvm-svn: 44295
2007-11-23 22:36:49 +00:00
Chris Lattner
ac2de0424b Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type.  This fixes
PR1814.

llvm-svn: 44286
2007-11-23 08:46:22 +00:00
Nick Lewycky
aff0962501 Instead of calculating constant factors, calculate the number of trailing
bits. Patch from Wojciech Matyjewicz.

llvm-svn: 44268
2007-11-22 07:59:40 +00:00
Nick Lewycky
bb69ad8a1b Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
"setcc" -> "icmp op" in comments. No functionality change.

llvm-svn: 44249
2007-11-20 08:44:50 +00:00
Nick Lewycky
f1d30ded71 Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
llvm-svn: 44248
2007-11-20 08:24:44 +00:00
Anton Korobeynikov
c9ab2516fa Reverted r44163 per request
llvm-svn: 44177
2007-11-15 18:33:16 +00:00
Nick Lewycky
6690b9499b Fix handling of overflow in loop calculation by adding new UDiv SCEV. This SCEV
is disabled in the sense that it will refuse to create one from a UDiv
instruction, until the code is better tested.

llvm-svn: 44163
2007-11-15 06:30:50 +00:00
Dan Gohman
68fc6d7395 Move the SCEV object factors from being static members of the individual
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.

llvm-svn: 43224
2007-10-22 18:31:58 +00:00
Nick Lewycky
a44e458ddc Build the correct range for loops with unusual bounds. Fix from Jay Foad.
llvm-svn: 42394
2007-09-27 14:12:54 +00:00
Dale Johannesen
86f367a6b7 Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double.  Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)

llvm-svn: 41747
2007-09-06 18:13:44 +00:00
Devang Patel
f06e667e9c Use SmallVector instead of std::vector.
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Nick Lewycky
04447caa7b Let scalar-evolution analyze loops with an unsigned comparison for the exit
condition. Fixes 1597.

llvm-svn: 40867
2007-08-06 19:21:00 +00:00
Nick Lewycky
071a2c6a5e Don't assume it's safe to transform a loop just because it's dominated by any
comparison. Fixes bug 1598.

llvm-svn: 40866
2007-08-06 18:33:46 +00:00
Nick Lewycky
43e5fd5be7 Handle decrementing loops properly. Fixes PR1533.
Always pass the constant as the second parameter to HowManyLessThans.

Remove obsolete "isSigned" parameter.

llvm-svn: 39893
2007-07-16 02:08:00 +00:00
Dan Gohman
4e45063081 Move the APInt form of SCEVUnknown::getIntegerSCEV to SCEVConstant::get, and
use SCEVConstant::get instead of SCEVUnknown::get when constructing a SCEV
for a ConstantInt.

llvm-svn: 38457
2007-07-09 15:25:17 +00:00
Dan Gohman
bb705e230a Rename ScalarEvolution::deleteInstructionFromRecords to
deleteValueFromRecords and loosen the types to all it to accept
Value* instead of just Instruction*, since this is what
ScalarEvolution uses internally anyway. This allows more flexibility
for future uses.

llvm-svn: 37657
2007-06-19 14:28:31 +00:00
Dan Gohman
5db3ad4b32 In SCEVAddExpr::get, skip over any cast operands before looking for nested
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.

llvm-svn: 37628
2007-06-18 19:30:09 +00:00
Dan Gohman
838ba27094 Add a SCEV class and supporting code for sign-extend expressions.
This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.

llvm-svn: 37591
2007-06-15 14:38:12 +00:00
Nick Lewycky
2897eb89d0 Optimize this test. Firstly, only Instructions may use other Instructions.
Secondly, checking whether removal succeeded tells you whether it was in
the map to begin with.

llvm-svn: 37469
2007-06-06 11:26:20 +00:00
Nick Lewycky
c667323382 Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll
llvm-svn: 37459
2007-06-06 04:12:20 +00:00
Devang Patel
cd45427a87 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
8ee9065162 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Lauro Ramos Venancio
57d03e112b Fix build error.
llvm-svn: 36648
2007-05-02 20:37:47 +00:00
Devang Patel
38a66bc82e Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Reid Spencer
85f055a567 Revert last patch. It was already fixed.
llvm-svn: 36102
2007-04-16 02:24:41 +00:00
Reid Spencer
e411fd1f10 For PR1336:
Fix a div-by-zero bug noticed by APInt. This fixes:
test/Transforms/IndVarsSimplify/exit_value_tests.llx

llvm-svn: 36099
2007-04-16 01:48:37 +00:00
Chris Lattner
c2762b5d83 Fix a nasty bug introduced when apint'ified. This fixes
Transforms/IndVarsSimplify/exit_value_tests.llx

llvm-svn: 36081
2007-04-15 19:52:49 +00:00