Commit Graph

48 Commits

Author SHA1 Message Date
Nick Lewycky
dd402588b5 Don't print address of ETNode. Print the DFSNumIn which uniquely identifies
the basic block and is stable across runs in gdb or valgrind.

Make Node::update handle edges which dominate and are tighter than
existing edges.

Replace makeEqual's "squeeze theorem" code. Fixes miscompilation.

Gate the calls to defToOps and opsToDef. Before this, we were getting IG
edges about values which weren't even defined in the dominated area. This
reduces the size of the IG by about half.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33236 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 14:30:07 +00:00
Nick Lewycky
0be7f47735 "Default context" blocks can occur after a non-default one. This meant
that properties were being applied where they didn't belong. Fixes crash
in new MiBench testcase.

Also mark debugging code as such in #ifdef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33177 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-13 02:05:28 +00:00
Nick Lewycky
28c5b1544a If we know that it's a constant being casted, propagate through the cast
instruction. Doesn't work the other way though (can't recover bits that
have been truncated).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33104 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 01:23:53 +00:00
Nick Lewycky
c2a7d097f9 Clean up logic after ConstantBool removal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33096 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 00:02:12 +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
Nick Lewycky
bc00fec835 Quiet compiler warning. The only reason the function is marked virtual
is so that it can be called from inside a debugger.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33067 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 02:38:21 +00:00
Nick Lewycky
419c6f5ac8 New predicate simplifier!
Please do not enable, there is still some known miscompile problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33066 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 02:32:38 +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
438e08e357 Convert more Statistic's over to STATISTIC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32692 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 21:49:03 +00:00
Bill Wendling
832171cb97 Removing even more <iostream> includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32320 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 20:04:42 +00:00
Chris Lattner
02fc40ebd3 add missing #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32280 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 18:14:47 +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
Jeff Cohen
97af751deb Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32113 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-02 02:22:01 +00:00
Nick Lewycky
565706b93e Update to new predicate simplifier VRP design. Fixes PR966 and PR967.
Remove predicate simplifier from default gcc3 pipeline. New design is too
slow to enable by default.
Add new testcases for problems encountered in development.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31895 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-22 23:49:16 +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
Nick Lewycky
8b2989ae91 Remove commented line from earlier debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31460 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-05 14:19:40 +00:00
Reid Spencer
0a783f783c For PR950:
Replace the REM instruction with UREM, SREM and FREM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31369 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-02 01:53:59 +00:00
Reid Spencer
1628cec4d7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31195 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-26 06:15:43 +00:00
Nick Lewycky
7043d00750 Fix 2006-10-25-AddSetCC. A relational operator (like setlt) can never
produce an EQ property.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31193 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-26 02:35:18 +00:00
Nick Lewycky
e63bf95a32 Resurrect r1.25.
Fix and comment the "or", "and" and "xor" transformations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31189 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-25 23:48:24 +00:00
Chris Lattner
b67e8f2263 hide symbols properly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31184 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-25 21:14:31 +00:00
Chris Lattner
ef2aa193d6 Revert back to r1.21, which was the last revision of predsimplify that
passes llvm-gcc bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31146 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-24 00:36:21 +00:00
Nick Lewycky
c17229d591 Remove the Backwards operation. Resolving now works at the time when a
property is added by running through the list of uses of the value and
adding resolved properties to the property set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31126 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-23 01:56:02 +00:00
Nick Lewycky
7e189d095e Fix similar missing optimization opportunity in XOR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31123 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-22 22:22:58 +00:00
Nick Lewycky
92a8b71dc1 Whoops! Add missing NULL check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31121 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-22 21:38:24 +00:00
Nick Lewycky
5062250f36 Handle "if ((x|y) != 0)" for ints like we do for bools. Fixes missed
optimization opportunity pointed out by Chris Lattner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31118 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-22 21:36:41 +00:00
Nick Lewycky
802fe27d3e AllocaInst can't return a null pointer. Fixes missed optimization
opportunity pointed out by Andrew Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31115 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-22 19:53:27 +00:00
Nick Lewycky
078ff41220 Replace custom dispatch code with two uses of InstVisitor. Improves
compile-time performance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30896 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-12 02:02:44 +00:00
Nick Lewycky
f938099aa1 Simplify logic further.
Ensure that we copy KnownProperties before calling visitBasicBlock, else
we may leak properties into blocks where they don't belong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30705 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-03 17:36:01 +00:00
Nick Lewycky
a73a654bb4 Simplify, now that predsimplify depends on break-crit-edges.
Fix SwitchInst where dest-block is the same as one of the cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30700 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-03 15:19:11 +00:00
Nick Lewycky
5c8c5d9ace Move break-crit-edges before the predicate simplifier. Allows us to
optimize in more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30699 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-03 14:52:23 +00:00
Chris Lattner
47811b76ca Eliminate ConstantBool::True and ConstantBool::False. Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30665 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-28 23:35:22 +00:00
Nick Lewycky
8f389d8cd4 Style changes only. Remove dead code, fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30588 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 15:13:08 +00:00
Nick Lewycky
009aa1d485 Don't rewrite ConstantExpr::get.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30552 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-21 01:05:35 +00:00
Nick Lewycky
af2f1fe94e Once we're down to "setcc type constant1, constant2", at least come up
with the right answer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30550 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 23:02:24 +00:00
Nick Lewycky
406fc0cb49 Use a total ordering to compare instructions.
Fixes infinite loop in resolve().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30540 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-20 17:04:01 +00:00
Nick Lewycky
025f4c0fad Walk down the dominator tree instead of the control flow graph. That means
that we can't modify the CFG any more, at least not until it's possible
to update the dominator tree (PR217).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30469 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-18 21:09:35 +00:00
Nick Lewycky
668a1d0fd2 Add some more consistency checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30305 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-13 19:32:53 +00:00
Nick Lewycky
977be254c6 Fix unionSets so that it can merge correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30304 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-13 19:24:01 +00:00
Nick Lewycky
cf2112a0a0 Erase dead instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30298 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-13 18:55:37 +00:00
Nick Lewycky
3fc68ccd83 Skip the linear search if the answer is already known.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30251 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-11 17:23:34 +00:00
Nick Lewycky
dc08cd56c4 Replace EquivalenceClasses with a custom-built data structure. Many common
operations (like findProperties) should be faster, at the expense of
unionSets being slower in cases that are rare in practise.

Don't erase a dead Instruction. This fixes a memory corruption issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30235 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-10 02:27:07 +00:00
Nick Lewycky
a3a68bde21 Improve handling of SelectInst.
Reorder operations to remove duplicated work.
Fix to leave floating-point types out of the optimization.
Add tests to predsimplify.ll for SwitchInst and SelectInst handling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30055 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-02 19:40:38 +00:00
Nick Lewycky
7218c28822 Don't confuse canonicalize and lookup. Fixes predsimplify.reg4.ll. Also
corrects missing optimization opportunity removing cases from a switch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30009 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-01 03:26:35 +00:00
Nick Lewycky
6e39c7ed1e Properties where both Values weren't in the union (as being equal to
another Value) weren't being found by findProperties.

This fixes predsimplify.ll test6, a missed optimization opportunity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29991 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-31 00:39:16 +00:00
Nick Lewycky
3947a76e21 Move to using the EquivalenceClass ADT. Removes SynSets.
If a branch's condition has become a ConstantBool, simplify it immediately.
Removing the edge saves work and exposes up more optimization opportunities
in the pass.
Add support for SelectInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29970 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-30 02:46:48 +00:00
Nick Lewycky
05450ae128 Add PredicateSimplifier pass. Collapses equal variables into one form
and simplifies expressions. This implements the optimization described
in PR807.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29947 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-28 22:44:55 +00:00