Commit Graph

1821 Commits

Author SHA1 Message Date
Reid Spencer
b8f1c1657f Fix constant fold of div by zero and rem by zero to match IEEE 754
requirements. We must return NaN in some cases and correctly signed
infinity in other cases. Passes CFP2006 (not that that says much).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35277 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-23 05:33:23 +00:00
Dan Gohman
ecb7a77885 Change uses of Function::front to Function::getEntryBlock for readability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35265 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 16:38:57 +00:00
Reid Spencer
66123626ad Add the NoUnwind function attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35260 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 02:14:48 +00:00
Devang Patel
cbdfb8a9d5 DominanceFrontier::calculate().
Avoid recursion, Use iterative algorithm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35225 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 21:25:31 +00:00
Devang Patel
3b57b6f36e LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35221 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 20:18:12 +00:00
Chris Lattner
91857da2f5 Fix a nasty memory leak, caused by my revamp of the value symbol table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35195 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 00:18:10 +00:00
Reid Spencer
7fc44c8c5f Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as a
negative number. This is needed to fix test/Assembler/2007-03-19-NegValue.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35181 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 20:39:08 +00:00
Reid Spencer
590b3c559f For PR1258:
Radically simplify the SlotMachine. There is no need to keep Value planes
around any more. This change causes slot numbering to number all un-named,
non-void values starting at 0 and incrementing monotonically through the
function, regardless of type (including BasicBlocks). Getting slot numbers
is now a single lookup operation instead of a double lookup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35171 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 18:32:53 +00:00
Devang Patel
d46825c6a1 Speed Up Pass Manager.
- Check Immutableness before searching PreservedSet.
- Avoid unnecessary traversal while setting Last User.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35028 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 19:05:01 +00:00
Evan Cheng
afe1581557 Added ContainsRelocations() to check if a constant might only be resolvable at load time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35014 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-08 00:59:12 +00:00
Devang Patel
7b65dd91c1 Keep track of higher level analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 17:52:53 +00:00
Devang Patel
fe613905b3 Keep track of inherited analysis. For example, if a loop pass does not
preserve dominator info then it should update parent FPPassManager's
available analysis info to reflect this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34942 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 01:55:46 +00:00
Devang Patel
22a1cf9d3a Add preparePassManager() hook. This allows each pass to check whether
current active pass manager is appropriate or not.

A loop pass may consider current LPPassManager in appropraite if loop
pass is not preserving analysis information that is used by other
passes managed by current LPPassManager. In such situation, loop pass
can pop current LPPassManager from the PMStack using this  hook
and use new LPPassManager for itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34941 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 01:06:16 +00:00
Devang Patel
cf5fb2b614 Current pass manager, not the parent pass manager, assumes the role of
last user when one of the managed pass uses info provided by parent pass
manager.

This was exposed by LPPassManager work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34936 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 22:57:49 +00:00
Devang Patel
7f99761143 Avoid constructing std::strings unless pass debugging is ON.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34933 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 20:01:30 +00:00
Devang Patel
55d5ac7b5b Account for time consumed by releaseMemory() properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34932 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 18:20:51 +00:00
Jeff Cohen
ca5183d445 Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34917 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-05 00:00:42 +00:00
Reid Spencer
a188bbe7ac Fix constant folding of fp->int bitcast for vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34880 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 08:32:46 +00:00
Reid Spencer
cae5754619 Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 00:28:52 +00:00
Reid Spencer
0d54b7df4f Use the APInt versions of the bit-wise conversions of float/double to int
and back. While this is not strictly necessary, it does pave the way for
future changes in casting. It should now be possible to improve vector
casting to deal with un-equal fp/int sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34808 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 20:44:23 +00:00
Reid Spencer
bb9723bd98 Use modern variable name. ConstantUnsignedInt is long since dead. No
functional change with this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34806 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 20:27:41 +00:00
Reid Spencer
ef2185b4d2 Use a simpler constructor when constructing ConstantInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 19:31:12 +00:00
Reid Spencer
0050c737c5 Drop the ConstantInt(const Type&, const APInt&) constructor. It is
redundant and more verbose than the ConstantInt(const APInt&) constructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34792 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 19:30:34 +00:00
Reid Spencer
9e57414e69 Reduce #includage by taking a method out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34774 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 04:02:06 +00:00
Reid Spencer
3da43849f2 Provide an ICmpInst::makeConstantRange to generate a ConstantRange value
from a predicate and an APInt. This is removed from ConstantRange class
so that ConstantRange doesn't have to depend on lib/VMCore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34760 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 22:00:54 +00:00
Reid Spencer
f57fc81fae Implement a convenience method to construct a ConstantInt directly from an
APInt. The implied type is the integer type that corresponds to the bit
width of the APInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34757 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 19:50:21 +00:00
Reid Spencer
012d50b851 Pull out the stops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34703 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 23:33:03 +00:00
Reid Spencer
80f8481ef0 Remove some redundancy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34702 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 23:27:26 +00:00
Reid Spencer
914c3bca87 Adjust to changes in the APInt interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34681 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 20:25:25 +00:00
Reid Spencer
a5c7472726 For PR1205:
Implement review feedback:
1. Use new APInt::RoundDoubleToAPInt interface to specify the bit width so
   that we don't have to truncate or extend in constant folding.
2. Fix a pasteo in SDiv that prevented a check for overflow.
3. Fix the shift operators: undef happens when the shift amount is equal
   to the bitwidth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34677 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 19:29:54 +00:00
Devang Patel
84da80d10b Make getPassManagerType() const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34669 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 15:00:39 +00:00
Reid Spencer
940685ecf5 Allow the AsmWriter to print out arbitrary precision integers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34664 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 08:34:09 +00:00
Reid Spencer
8374db81a8 Correct the implelmentation of ConstantInt::getAllOnesValue() for bit
widths > 64 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 07:57:53 +00:00
Reid Spencer
9472c373a3 For PR1205:
Implement constant folding via APInt instead of uint64_t.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34660 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 06:23:51 +00:00
Chris Lattner
92f6feaf79 ConstantFolding.cpp/h -> ConstantFold.cpp/h to avoid confusion with
lib/Analysis/ConstantFolding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34653 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 03:05:06 +00:00
Reid Spencer
532d0ce208 For PR1205:
Implement the first step towards arbitrary precision integer support in
LLVM. The APInt class provides arbitrary precision arithmetic and value
representation. This patch changes ConstantInt to use APInt as its value
representation without supporting bit widths > 64 yet. That change will
come after ConstantFolding handles bit widths > 64 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34647 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 23:54:03 +00:00
Chris Lattner
00f23ec5c2 reapply my previous patch with a bugfix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34627 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 05:02:39 +00:00
Chris Lattner
e2c2b76c8a revert my previous change, something strange is happening.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-26 04:43:19 +00:00
Chris Lattner
1cf5574636 Rework GlobalValue::removeDeadConstantUsers to always remove dead constant
exprs hanging off a global, even if the global is not otherwise dead.  This
requires some tricky iterator gymnastics.

This implements Transforms/GlobalOpt/constantexpr-dangle.ll by deleting a
constantexpr that made it appear that the address of the function was taken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34608 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 21:06:13 +00:00
Chris Lattner
3f3098c8ca disable some noisy debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34606 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-25 20:42:59 +00:00
Chris Lattner
6b178a3801 Fix Transforms/ConstProp/2007-02-23-sdiv.ll and PR1215
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34548 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-24 01:19:50 +00:00
Chris Lattner
910c80a075 Refactor the setName stuff, moving it down the inheritance hierarchy, to
solve a crash in -instcombine -debug that was hit while investigating PR1217


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34544 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-24 00:55:48 +00:00
Evan Cheng
e811636f33 This cast broke lots of tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 21:30:56 +00:00
Chris Lattner
9b4ee0c1bd switch ConstantFP's from ValueMap to DenseMap, which is much faster to query
and is more memory efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 07:17:17 +00:00
Chris Lattner
6b6f6ba66c cleanup ConstantInt to use a single DenseMap for uniquing instead of the
heavy-weight ValueMap class.  This reduces mem usage bc reading kc++ by 29K,
even though it only creates 2955 constant ints!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34445 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 06:39:57 +00:00
Chris Lattner
d1afbd02ef Make ConstantInt::getTrue/getFalse be llvm_shutdown safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 06:11:36 +00:00
Chris Lattner
eb41bddfdf Clean up the internals of the ConstantInt machinery
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:55:46 +00:00
Chris Lattner
e0e769607c simplify some code that was not llvm_shutdown safe
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34440 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:46:39 +00:00
Chris Lattner
f00c6add97 remove dead method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34436 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:29:47 +00:00
Chris Lattner
f9021ff740 llvm-gcc issue fixed, revert reversal :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34425 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 20:01:23 +00:00