Chris Lattner
25700676d4
rename SimplifyCompare -> SimplifyCmpInst and split it into
...
Simplify[IF]Cmp pieces. Add some predicates to CmpInst to
determine whether a predicate is fp or int.
llvm-svn: 86624
2009-11-09 23:28:39 +00:00
Chris Lattner
29db7d6abe
use instructionsimplify instead of a weak clone of ad-hoc folding stuff.
...
llvm-svn: 86616
2009-11-09 23:00:14 +00:00
Chris Lattner
8cb0f89bbd
stub out a new form of BasicBlock::RemovePredecessorAndSimplify which
...
simplifies instruction users of PHIs when the phi is eliminated. This
will be moved to transforms/utils after some other refactoring.
llvm-svn: 86603
2009-11-09 22:32:36 +00:00
Chris Lattner
fe6b17a13a
comment typos pointed out by Duncan
...
llvm-svn: 86497
2009-11-09 00:41:49 +00:00
Chris Lattner
3482ad7de0
reapply 86289, 86278, 86270, 86267, 86266 & 86264 plus a fix
...
(making pred factoring only happen if threading is guaranteed
to be successful).
This now survives an X86-64 bootstrap of llvm-gcc.
llvm-svn: 86355
2009-11-07 08:05:03 +00:00
Devang Patel
84b2af870e
Revert following patches to fix llvmgcc bootstrap.
...
86289, 86278, 86270, 86267, 86266 & 86264
Chris, please take a look.
llvm-svn: 86321
2009-11-07 01:32:59 +00:00
Jeffrey Yasskin
66008446d5
Avoid "ambiguous 'else'" warning from gcc.
...
llvm-svn: 86314
2009-11-07 00:26:47 +00:00
Chris Lattner
411461dd99
Fix a bug where we'd call SplitBlockPredecessors with a pred in the
...
set only once even if it has multiple edges to BB.
llvm-svn: 86299
2009-11-06 23:19:58 +00:00
Eli Friedman
98daf610fb
Remove function left over from other jump threading cleanup.
...
llvm-svn: 86289
2009-11-06 21:24:57 +00:00
Chris Lattner
93a3e74486
Fix a problem discovered on self host.
...
llvm-svn: 86278
2009-11-06 19:21:48 +00:00
Chris Lattner
17dc911808
remove more code subsumed by r86264
...
llvm-svn: 86270
2009-11-06 18:24:32 +00:00
Chris Lattner
8b677402d3
eliminate some more code subsumed by r86264
...
llvm-svn: 86267
2009-11-06 18:22:54 +00:00
Chris Lattner
79534a05af
remove now redundant code, r86264 handles this case.
...
llvm-svn: 86266
2009-11-06 18:20:58 +00:00
Chris Lattner
b688868418
Extend jump threading to support much more general threading
...
predicates. This allows us to jump thread things like:
_ZN12StringSwitchI5ColorE4CaseILj7EEERS1_RAT__KcRKS0_.exit119:
%tmp1.i24166 = phi i8 [ 1, %bb5.i117 ], [ %tmp1.i24165, %_Z....exit ], [ %tmp1.i24165, %bb4.i114 ]
%toBoolnot.i87 = icmp eq i8 %tmp1.i24166, 0 ; <i1> [#uses=1]
%tmp4.i90 = icmp eq i32 %tmp2.i, 6 ; <i1> [#uses=1]
%or.cond173 = and i1 %toBoolnot.i87, %tmp4.i90 ; <i1> [#uses=1]
br i1 %or.cond173, label %bb4.i96, label %_ZN12...
Where it is "obvious" that when coming from %bb5.i117 that the 'and' is always
false. This triggers a surprisingly high number of times in the testsuite,
and gets us closer to generating good code for doug's strswitch testcase.
This also make a bunch of other code in jump threading redundant, I'll rip
out in the next patch. This survived an enable-checking llvm-gcc bootstrap.
llvm-svn: 86264
2009-11-06 18:15:14 +00:00
Chris Lattner
903ae55e1c
remove a bunch of extraneous LLVMContext arguments
...
from various APIs, addressing PR5325.
llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Chris Lattner
a003aee613
improve DSE when TargetData is not around, based on work by
...
Hans Wennborg!
llvm-svn: 86067
2009-11-04 23:20:12 +00:00
Chris Lattner
8ae883b5f0
when folding duplicate conditions, delete the
...
now-probably-dead instruction tree feeding it.
llvm-svn: 83778
2009-10-11 18:39:58 +00:00
Chris Lattner
1832a32b78
implement a transformation in jump threading that is currently
...
done by condprop, but do it in a much more general form. The
basic idea is that we can do a limited form of tail duplication
in the case when we have a branch on a phi. Moving the branch
up in to the predecessor block makes instruction selection
much easier and encourages chained jump threadings.
llvm-svn: 83759
2009-10-11 07:24:57 +00:00
Chris Lattner
562cc63c29
restructure some code, no functionality change.
...
llvm-svn: 83756
2009-10-11 04:40:21 +00:00
Chris Lattner
b4e9fb6967
factor some code better and move a function, no functionality change.
...
llvm-svn: 83755
2009-10-11 04:33:43 +00:00
Chris Lattner
525c0272aa
make jump threading on a phi with undef inputs happen.
...
llvm-svn: 83754
2009-10-11 04:18:15 +00:00
Chris Lattner
75e5de9243
Change jump threading to use the new SSAUpdater class instead of
...
DemoteRegToStack. This makes it more efficient (because it isn't
creating a ton of load/stores that are eventually removed by a later
mem2reg), and more slightly more effective (because those load/stores
don't get in the way of threading).
llvm-svn: 83706
2009-10-10 09:05:58 +00:00
Nick Lewycky
d21c325f09
Instruction::clone does not need to take an LLVMContext&. Remove that and
...
update all the callers.
llvm-svn: 82889
2009-09-27 07:38:41 +00:00
Chris Lattner
5f54c5bd1c
eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861
...
llvm-svn: 80766
2009-09-02 06:11:42 +00:00
Owen Anderson
9df206d02d
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
d0e6352c97
Move getTrue() and getFalse() to 2.5-like APIs.
...
llvm-svn: 77685
2009-07-31 17:39:07 +00:00
Owen Anderson
93ccaf5c60
Move more code back to 2.5 APIs.
...
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Owen Anderson
0ce2151b36
Move ConstantExpr to 2.5 API.
...
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Daniel Dunbar
4a36d5dcfd
Remove Value::getName{Start,End}, the last of the old Name APIs.
...
llvm-svn: 77152
2009-07-26 09:48:23 +00:00
Daniel Dunbar
75a66c519b
Eliminate some uses of DOUT, cerr, and getNameStart().
...
llvm-svn: 77145
2009-07-26 07:49:05 +00:00
Owen Anderson
cc33e89571
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
...
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Dan Gohman
f1a01b8cc0
Convert several more passes to use getAnalysisIfAvailable<TargetData>()
...
instead of getAnalysis<TargetData>().
llvm-svn: 76982
2009-07-24 18:13:53 +00:00
Owen Anderson
cc287b28c9
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Owen Anderson
7f61f8dc30
Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
...
llvm-svn: 76598
2009-07-21 18:03:38 +00:00
Owen Anderson
4483fbda5e
Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
...
llvm-svn: 75863
2009-07-15 23:53:25 +00:00
Owen Anderson
8c85061ee6
Move EVER MORE stuff over to LLVMContext.
...
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Owen Anderson
49226b1075
This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
...
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Owen Anderson
121f736d9c
"LLVMContext* " --> "LLVMContext *"
...
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Owen Anderson
ad3229d281
Thread LLVMContext through the constant folding APIs, which touches a lot of files.
...
llvm-svn: 74844
2009-07-06 18:42:36 +00:00
Owen Anderson
6795819c9e
Second batch of passes using LLVMContext.
...
llvm-svn: 74753
2009-07-03 00:54:20 +00:00
Chris Lattner
3d8ec50f8a
fix inverted logic pointed out by John McCall, noticed by inspection.
...
This was considering vector intrinsics to have cost 2, but non-vector
intrinsics to have cost 1, which is backward.
llvm-svn: 74698
2009-07-02 15:39:39 +00:00
Dan Gohman
e89dc58a7e
Fix a bunch of other places that used operator[] to test whether
...
a key is present in a std::map or DenseMap to use find instead.
llvm-svn: 74676
2009-07-02 00:17:47 +00:00
Chris Lattner
8f6f044afd
make jump threading handle lexically identical compare instructions
...
as if they were multiple uses of the same instruction. This interacts
well with the existing loadpre that j-t does to open up many new jump
threads earlier.
llvm-svn: 73768
2009-06-19 16:27:56 +00:00
Nick Lewycky
a5f89b09c6
Teach jump threading to look at comparisons between phi nodes and non-constants.
...
llvm-svn: 73755
2009-06-19 04:56:29 +00:00
Chris Lattner
84cf4d62a8
fix some problems spotted by Duncan and Nicolas Geoffray
...
llvm-svn: 70872
2009-05-04 16:29:24 +00:00
Chris Lattner
6807ddd3d9
* Sink 4 duplicates of edge threading validity checks and DOUT prints into
...
ThreadEdge directly. This shares the code, but is just a refactoring.
* Make JumpThreading compute the set of loop headers and avoid threading
across them. This prevents jump threading from forming irreducible
loops (goodness) but also prevents it from threading in other cases that
are beneficial (see the comment above FindFunctionBackedges).
llvm-svn: 70820
2009-05-04 02:28:08 +00:00
Dale Johannesen
0e13f2b022
Fix a debug info dependency in jump threading.
...
llvm-svn: 67064
2009-03-17 00:38:24 +00:00
Chris Lattner
a66675581a
this wasn't intended to go in.
...
llvm-svn: 66252
2009-03-06 05:42:30 +00:00
Chris Lattner
1b05680d5f
Change various llvm utilities to use PrettyStackTraceProgram in
...
their main routines. This makes the tools print their argc/argv
commands if they crash.
llvm-svn: 66248
2009-03-06 05:34:10 +00:00
Chris Lattner
b88febb5cd
Fix PR3353, infinitely jump threading an infinite loop make from switches.
...
llvm-svn: 62529
2009-01-19 21:20:34 +00:00