Commit Graph

697 Commits

Author SHA1 Message Date
Chris Lattner
79066fa6ac Adjust #includes to match movement of constant folding code from transformutils to libanalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33680 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:46:24 +00:00
Chris Lattner
5520732b24 move a bunch of constant folding code f rom Transforms/Utils/Local.cpp into
libanalysis/ConstantFolding.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33679 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:45:45 +00:00
Chris Lattner
4973190b07 remove now-dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33678 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:29:47 +00:00
Chris Lattner
1dfdf8255e The inliner/cloner can now optionally take TargetData info, which can be
used by constant folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:22:39 +00:00
Chris Lattner
9fa038dc21 Change constant folding APIs to take an optional TargetData, and change
ConstantFoldInstOperands/ConstantFoldCall to take a pointer to an array
of operands + size, instead of an std::vector.

In some cases, switch to using a SmallVector instead of a vector.
This allows us to get rid of some special case gross code that was there
to avoid the cost of constructing a vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33670 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:13:49 +00:00
Reid Spencer
5cbf985dcb For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:08:39 +00:00
Reid Spencer
26f238589f For PR761:
The Module::setEndianness and Module::setPointerSize methods have been
removed. Instead you can get/set the DataLayout. Adjust thise accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33530 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 08:11:39 +00:00
Devang Patel
4d447f5121 Inherit BasicBlockPass directly from Pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33511 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 23:23:25 +00:00
Reid Spencer
c10305743c For PR1043:
This is the final patch for this PR. It implements some minor cleanup
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask -> IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120.

Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 21:13:56 +00:00
Chris Lattner
42a7551725 rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 02:27:26 +00:00
Chris Lattner
4d5f508318 Eliminate calls to isInteger, generalizing code and tightening checks as needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33218 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 01:55:30 +00:00
Chris Lattner
caed0e3d71 Fix Analysis/Dominators/2006-10-02-BreakCritEdges.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33210 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 00:15:09 +00:00
Chris Lattner
9fa58b5f66 Fix PR1110 and Analysis/Dominators/2007-01-14-BreakCritEdges.ll by being
more careful about unreachable code when updating dominator info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33204 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-14 18:33:35 +00:00
Reid Spencer
579dca12c2 Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 04:24:46 +00:00
Reid Spencer
4fe16d607d Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 18:21:29 +00:00
Zhou Sheng
6b6b6ef167 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 12:24:14 +00:00
Chris Lattner
b76efb71d4 Change the interface to Module::getOrInsertFunction to be easier to use,to resolve PR1088, and to help PR411.
This simplifies many clients also


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 08:12:01 +00:00
Chris Lattner
a121fddf3c prepare for adjustment to getOrInsertFunction method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32985 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 07:54:34 +00:00
Reid Spencer
78d033e086 For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32956 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 07:24:44 +00:00
Reid Spencer
c5b206b6be For PR950:
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int   -> Int32
4. [U]Long  -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
   and other methods related to signedness. In a few places this warranted
   identifying the signedness information from other sources.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32785 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 05:48:39 +00:00
Reid Spencer
e4d87aa2de For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 06:05:41 +00:00
Chris Lattner
d216e8ba60 switch more statistics over to STATISTIC, eliminating static ctors. Also,
delete some dead ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32694 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:17:40 +00:00
Bill Wendling
5c7e326585 Added an automatic cast to "std::ostream*" etc. from OStream. We then can
rework the hacks that had us passing OStream in. We pass in std::ostream*
instead, check for null, and then dispatch to the correct print() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32636 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-17 05:15:13 +00:00
Reid Spencer
7b06bd532d Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32521 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 00:50:17 +00:00
Reid Spencer
daa8e3c263 Fix the casting for the computation of the Malloc size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32477 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 09:17:08 +00:00
Reid Spencer
4da49122f3 Change inferred getCast into specific getCast. Passes all tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32469 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 05:05:00 +00:00
Bill Wendling
e81561909d Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 01:30:32 +00:00
Chris Lattner
ac0b6ae358 Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 17:46:33 +00:00
Reid Spencer
3da59db637 For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-27 01:05:10 +00:00
Bill Wendling
0d45a096cf Remove #include <iostream> and use llvm_* streams instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31925 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-26 10:17:54 +00:00
Chris Lattner
822a879983 Do not convert massive blocks on phi nodes into select statements. Instead
only do these transformations if there are a small number of phi's.
This speeds up Ptrdist/ks from 2.35s to 2.19s on my mac pro.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31853 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-18 19:19:36 +00:00
Jim Laskey
d6c3422e31 Remove redundant <cmath>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31561 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-08 19:16:44 +00:00
Reid Spencer
3822ff5c71 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31542 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-08 06:47:33 +00:00
Jeff Cohen
d41b30def3 Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31464 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-05 19:31:28 +00:00
Reid Spencer
3ed469ccd7 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-02 20:25:50 +00:00
Chris Lattner
cbea67f55b generalize the fix for PR977 to also fix
Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31317 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-31 18:56:48 +00:00
Chris Lattner
1753faee81 Fix PR977 and Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31315 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-31 17:52:18 +00:00
Chris Lattner
120bc21576 Fix SimplifyCFG/2006-10-29-InvokeCrash.ll, a crash compiling QT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31284 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-29 21:21:20 +00:00
Chris Lattner
b57de3328d add option to isCriticalEdge
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31258 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-28 06:58:17 +00:00
Chris Lattner
27e1f90d85 Expose a smarter way to break critical edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31256 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-28 06:44:56 +00:00
Reid Spencer
b83eb6447b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 07:07:24 +00:00
Chris Lattner
b74b181630 Fix SimplifyCFG/2006-10-19-UncondDiv.ll by disabling a bad xform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31061 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 00:42:07 +00:00
Chris Lattner
3a15503c82 This case isn't implemented yet. It seems unlikely to be needed, but if it
ever is, we want to get an assert instead of silent bad codegen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30716 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-04 04:58:58 +00:00
Chris Lattner
86f7b2100c Fix PR932 and Analysis/Dominators/2006-10-02-BreakCritEdges.ll:
The critical edge block dominates the dest block if the destblock dominates
all edges other than the one incoming from the critical edge.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30696 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-03 07:02:02 +00:00
Chris Lattner
40d31ecb29 simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30656 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-28 22:58:25 +00:00
Chris Lattner
120fce5540 Be far more careful when splitting a loop header, either to form a preheader
or when splitting loops with a common header into multiple loops.  In particular
the old code would always insert the preheader before the old loop header.  This
is disasterous in cases where the loop hasn't been rotated.  For example, it can
produce code like:

        .. outside the loop...
        jmp LBB1_2      #bb13.outer
LBB1_1: #bb1
        movsd 8(%esp,%esi,8), %xmm1
        mulsd (%edi), %xmm1
        addsd %xmm0, %xmm1
        addl $24, %edi
        incl %esi
        jmp LBB1_3      #bb13
LBB1_2: #bb13.outer
        leal (%edx,%eax,8), %edi
        pxor %xmm1, %xmm1
        xorl %esi, %esi
LBB1_3: #bb13
        movapd %xmm1, %xmm0
        cmpl $4, %esi
        jl LBB1_1       #bb1

Note that the loop body is actually LBB1_1 + LBB1_3, which means that the
loop now contains an uncond branch WITHIN it to jump around the inserted
loop header (LBB1_2).  Doh.

This patch changes the preheader insertion code to insert it in the right
spot, producing this code:

        ... outside the loop, fall into the header ...
LBB1_1: #bb13.outer
        leal (%edx,%eax,8), %esi
        pxor %xmm0, %xmm0
        xorl %edi, %edi
        jmp LBB1_3      #bb13
LBB1_2: #bb1
        movsd 8(%esp,%edi,8), %xmm0
        mulsd (%esi), %xmm0
        addsd %xmm1, %xmm0
        addl $24, %esi
        incl %edi
LBB1_3: #bb13
        movapd %xmm0, %xmm1
        cmpl $4, %edi
        jl LBB1_2       #bb1

Totally crazy, no branch in the loop! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30587 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 08:19:21 +00:00
Chris Lattner
c3984578be Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not
reachable, making it general purpose enough for use by InsertPreheaderForLoop.
Eliminate custom dominfo updating code in InsertPreheaderForLoop, using
UpdateDomInfoForRevectoredPreds instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30586 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 07:40:52 +00:00
Chris Lattner
a4646b61e4 Second half of the fix for Transforms/Inline/inline_cleanup.ll
This folds unconditional branches that are often produced by code
specialization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30307 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-13 21:27:00 +00:00
Chris Lattner
33bb3c8be3 Implement the first half of Transforms/Inline/inline_cleanup.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30303 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-13 19:23:57 +00:00
Chris Lattner
97d2dbd100 Fix Duraid's changes to work when TLI is null. This fixes the failing
lowerinvoke regtests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30115 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-05 17:48:07 +00:00