Jim Laskey
28fec74f1b
Remove redundant <cmath>.
...
llvm-svn: 31561
2006-11-08 19:16:44 +00:00
Reid Spencer
da1f5b882a
For PR950:
...
This patch converts the old SHR instruction into two instructions,
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.
llvm-svn: 31542
2006-11-08 06:47:33 +00:00
Reid Spencer
7af6c17de0
Remove unused variables.
...
llvm-svn: 31375
2006-11-02 08:18:15 +00:00
Reid Spencer
1abf69e923
For PR950:
...
Replace the REM instruction with UREM, SREM and FREM.
llvm-svn: 31369
2006-11-02 01:53:59 +00:00
Reid Spencer
6833ffe8b8
For PR950:
...
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.
llvm-svn: 31195
2006-10-26 06:15:43 +00:00
Reid Spencer
d414793dbc
For PR950:
...
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.
llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Chris Lattner
5cd4ac0a79
Fix another dtor issue. The function local statics in this function were
...
being destroyed at inconvenient times. Switch to using non-local ManagedStatic
objects, which actually also speeds up ConstRules::get.
llvm-svn: 30931
2006-10-13 17:22:21 +00:00
Chris Lattner
c00ee152c9
Eliminate ConstantBool::True and ConstantBool::False. Instead, provideConstantBool::getTrue() and ConstantBool::getFalse().
...
llvm-svn: 30664
2006-09-28 23:34:49 +00:00
Chris Lattner
8aa718b0ed
Add new SetCondInst::isRelational/isEquality methods. Rename
...
Instruction::isRelational to Instruction::isComparison.
llvm-svn: 30444
2006-09-17 19:14:47 +00:00
Chris Lattner
33bd5dcfb7
s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
...
llvm-svn: 29911
2006-08-27 12:54:02 +00:00
Chris Lattner
11f1b29308
Use hidden visibility to reduce the sizes of some .o files. This chops 60K off a release llvm-dis.
...
llvm-svn: 28969
2006-06-28 21:38:54 +00:00
Chris Lattner
66d23312b5
Add more anonymous namespaces to make it clear that these are private classes
...
llvm-svn: 28901
2006-06-21 18:13:36 +00:00
Chris Lattner
14b19acd56
Add shufflevector support, todo, implement better constant folding.
...
llvm-svn: 27510
2006-04-08 01:18:18 +00:00
Chris Lattner
8c5ac50fb4
Constant fold extractelement(zero, x) -> zero
...
llvm-svn: 27479
2006-04-07 04:44:06 +00:00
Chris Lattner
3aa0246b4a
Constant fold casts from things like <4 x int> -> <4 x uint>, likewise int<->fp.
...
llvm-svn: 27336
2006-04-02 01:38:28 +00:00
Chris Lattner
8e584affdb
constant fold extractelement with undef operands.
...
llvm-svn: 27301
2006-03-31 18:31:40 +00:00
Robert Bocchino
4e3d87a0dc
VMCore support for the insertelement operation.
...
llvm-svn: 25408
2006-01-17 20:07:22 +00:00
Robert Bocchino
472e42d3cc
Added constant folding support for the extractelement operation.
...
llvm-svn: 25187
2006-01-10 20:03:46 +00:00
Chris Lattner
ee327e57d2
Implement a few symbolic constant folding things. X ? Y : Y is Y.
...
Fold:
seteq ({ short }* cast (int 1 to { short }*), { short }* null)
setlt ({ short }* cast (int 1 to { short }*), { short }* cast (int 2 to { short }*))
to false/true. These last two commonly occur in the output of compilers that
tag integers, like cozmic's scheme compiler.
Tested by Regression/Assembler/ConstantExprFold.llx
llvm-svn: 25112
2006-01-05 07:49:30 +00:00
Chris Lattner
253796d43f
fix some formatting problems
...
llvm-svn: 25110
2006-01-05 07:19:51 +00:00
Chris Lattner
cbb7c27b51
implement constant folding of ==/!= on constant packed, simplify some code.
...
llvm-svn: 25074
2006-01-04 02:20:54 +00:00
Chris Lattner
00a5bdbb95
implement constant folding for the element-wise binary operations
...
llvm-svn: 25073
2006-01-04 02:15:02 +00:00
Chris Lattner
fffcbfffa6
don't crash when trying to constant fold packed expressions.
...
llvm-svn: 25072
2006-01-04 02:03:29 +00:00
Jeff Cohen
d33e8df701
Use ANSI-approved way of getting the value infinity (otherwise VC++ won't compile it)
...
llvm-svn: 21662
2005-05-03 03:13:01 +00:00
Andrew Lenharth
d46211fc03
fold fp div by 0 to inf, the way gcc does. This is legal according to the FP spec
...
llvm-svn: 21655
2005-05-02 21:25:47 +00:00
Reid Spencer
c206223e65
Shut GCC 4.0 up about classes with virtual functions but no virtual
...
destructor.
llvm-svn: 21510
2005-04-24 22:27:20 +00:00
Misha Brukman
53e199440e
Remove trailing whitespace
...
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Chris Lattner
f893f17907
Fix a nasty thinko in my previous commit.
...
llvm-svn: 19881
2005-01-28 23:17:27 +00:00
Chris Lattner
f24ea9cf5e
Fix ConstProp/2005-01-28-SetCCGEP.ll: indexing over zero sized elements does
...
not change the address.
llvm-svn: 19874
2005-01-28 19:09:51 +00:00
Chris Lattner
97d3bf5049
No need to pessimize current code for future possibilities.
...
llvm-svn: 19311
2005-01-06 16:26:38 +00:00
Chris Lattner
7647235f0f
Fix test/Regression/CFrontend/2003-11-01-EmptyStructCrash.c
...
llvm-svn: 18115
2004-11-22 19:15:27 +00:00
Chris Lattner
5a2ce1faab
Generalize this code to turn any cast-to-first-element-of into a gep constexpr
...
llvm-svn: 17914
2004-11-17 17:59:35 +00:00
Chris Lattner
c088680a5f
fold gep undef, ... -> undef
...
This comes up many times in perlbmk and probably others.
llvm-svn: 17100
2004-10-17 21:54:55 +00:00
Chris Lattner
e5aa085c1d
Fix constant folding relational operators with undef operands.
...
llvm-svn: 17077
2004-10-17 04:01:51 +00:00
Chris Lattner
8c86882a99
Implement constant folding of undef values.
...
llvm-svn: 17070
2004-10-16 23:31:32 +00:00
Chris Lattner
63ba63bb56
Allow creation of GEP constantexprs with a vector of value* operands as
...
well as a vector of constant*'s. It turns out that this is more efficient
and all of the clients want to do that, so we should cater to them.
llvm-svn: 16923
2004-10-11 22:52:25 +00:00
Chris Lattner
f8380b953a
If we are trying to create a ConstantExpr cast that is really a GEP to the
...
first element of an array, return a GEP instead of a cast. This allows us
to transparently fold this:
int* getelementptr (int* cast ([100 x int]* %Gbody to int*), int 40)
into this:
int* getelementptr ([100 x int]* %Gbody, int 0, int 40)
llvm-svn: 16911
2004-10-11 03:57:30 +00:00
Reid Spencer
bc38cd572f
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
llvm-svn: 14927
2004-07-17 23:47:01 +00:00
Chris Lattner
d1b726d18f
Implement folding of expressions like 'uint cast (int* getelementptr (int*
...
null, uint 1) to uint)' to a constant integer. We can only do this with
primitive LLVM types, because other types have target-specific sizes.
llvm-svn: 14837
2004-07-15 01:16:59 +00:00
Chris Lattner
006aea24ff
When folding constant expr gep's, don't force the use of long indices.
...
llvm-svn: 14658
2004-07-07 04:45:13 +00:00
Chris Lattner
0cd29ae2cd
Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
...
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Reid Spencer
d98738fe4d
Fix a bug that Chris asserts emphatically is a bug. The changed clause
...
would always return false because the Type of a type value is always
Type::TypeTY and can never be a floating point type.
llvm-svn: 13902
2004-05-30 01:19:48 +00:00
Chris Lattner
226ea8166e
Add a missing break, which caused a crash in an obscure situation
...
llvm-svn: 12825
2004-04-11 01:29:30 +00:00
Chris Lattner
9236135e8f
Support getelementptr instructions which use uint's to index into structure
...
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.
llvm-svn: 12653
2004-04-05 01:30:19 +00:00
Chris Lattner
f0a39f27e0
Teach the constant folder how to do select instructions
...
llvm-svn: 12321
2004-03-12 05:53:32 +00:00
Chris Lattner
38c2e1d1df
Implement test/Regression/Assembler/2004-03-07-FunctionAddressAlignment.llx
...
llvm-svn: 12218
2004-03-08 06:17:35 +00:00
Chris Lattner
727748b382
Get all instruction definitions
...
llvm-svn: 11706
2004-02-22 06:25:38 +00:00
Chris Lattner
11c0e5b684
Move the folding of gep null, 0, 0, 0 to a place where it can be shared and
...
enjoyed by all, fixing a fixme. Add an assert
llvm-svn: 11505
2004-02-16 20:46:13 +00:00
Chris Lattner
831561989c
Fix a crasher bug in my constant folding rewrite
...
llvm-svn: 11044
2004-02-01 01:23:19 +00:00
Chris Lattner
807e401607
Implement a bunch of symbolic constant folding opportunities. This implements
...
testcase test/Regression/Assembler/ConstantExprFold.llx
Note that these kinds of things only rarely show up in source code, but are
exceedingly common in the intermediate stages of algorithms like SCCP. By
folding things (especially relational operators) that use symbolic constants,
we are able to speculatively fold more conditional branches, which can
lead to some big simplifications.
It would be easy to add a lot more special cases here, so if you notice
SCCP missing anything "obvious", you know what to make smarter. :)
llvm-svn: 10812
2004-01-13 05:51:55 +00:00