Nick Lewycky
a2b0965613
Dust off tail recursion elimination. Fix a fixme by applying CaptureTracking
...
and add a .ll to demo the new capability.
llvm-svn: 86349
2009-11-07 07:10:01 +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
6a31c1141c
remove some more Context arguments.
...
llvm-svn: 86235
2009-11-06 05:59:53 +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
Dan Gohman
54aa68b309
Teach LSR to avoid calling SplitCriticalEdge on edges with indirectbr.
...
llvm-svn: 86193
2009-11-05 23:34:59 +00:00
Dan Gohman
6a3eefbfeb
LoopDeletion depends on loops having dedicated exits.
...
llvm-svn: 86180
2009-11-05 21:47:04 +00:00
Dan Gohman
3c155aa3cd
Update various Loop optimization passes to cope with the possibility that
...
LoopSimplify form may not be available.
llvm-svn: 86175
2009-11-05 21:11:53 +00:00
Dan Gohman
0c3b2f8419
Call getAnalysis<LoopInfo> the normal way, instead of asking passed-in
...
LoopPassManager for it.
llvm-svn: 86163
2009-11-05 19:43:25 +00:00
Benjamin Kramer
a38019a3de
Teach SimplifyLibCalls to fold memcmp calls with constant arguments.
...
llvm-svn: 86141
2009-11-05 17:44:22 +00:00
Benjamin Kramer
f10e3edefb
Do map insert+find in one step. TODO -= 2.
...
llvm-svn: 86133
2009-11-05 14:33:27 +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
4864198071
Fix an iterator invalidation bug that happens when a hashtable
...
resizes in IPSCCP. This fixes PR5394.
llvm-svn: 86036
2009-11-04 18:57:42 +00:00
Chris Lattner
d8ab8fbe9f
move two functions up higher in the file. Delete a useless argument
...
to EmitGEPOffset.
Implement some new transforms for optimizing
subtracts of two pointer to ints into the same vector. This happens
for C++ iterator idioms for example, stringmap takes a const char*
that points to the start and end of a string. Once inlined, we want
the pointer difference to turn back into a length.
This is rdar://7362831.
llvm-svn: 86021
2009-11-04 08:05:20 +00:00
Chris Lattner
b634c6cdb5
reimplement multiple return value handling in IPSCCP, making it
...
more aggressive an correct. This survives building llvm in 64-bit
mode with optimizations and the built llvm passes make check.
llvm-svn: 85973
2009-11-03 23:40:48 +00:00
Chris Lattner
10c341e8fa
finish half thunk thought
...
llvm-svn: 85937
2009-11-03 20:52:57 +00:00
Chris Lattner
2aa5962af6
fix an IPSCCP bug I introduced when I changed IPSCCP to start working on
...
functions that don't have local linkage. Basically, we need to be more
careful about propagating argument information to functions whose results
we aren't tracking. This fixes a miscompilation of
LLVMCConfigurationEmitter.cpp when built with an llvm-gcc that has ipsccp
enabled.
llvm-svn: 85923
2009-11-03 19:24:51 +00:00
Chris Lattner
bfe755788f
fix a subtle bug I introduced when refactoring SCCP. Testcase
...
to follow.
llvm-svn: 85903
2009-11-03 16:50:11 +00:00
Chris Lattner
b1dfdadabd
turn IPSCCP back on now that the iterator invalidation bug is fixed.
...
llvm-svn: 85858
2009-11-03 03:42:51 +00:00
Chris Lattner
00c9eb665d
fix a nasty iterator invalidation bug from my conversion from
...
std::map to DenseMap, exposed on release llvm-gcc bootstrap.
llvm-svn: 85840
2009-11-02 23:25:39 +00:00
Chris Lattner
6f515d4ba8
revert r8579[56], which are causing unhappiness in buildbot land.
...
llvm-svn: 85818
2009-11-02 19:31:10 +00:00
Chris Lattner
a1776913ab
disable IPSCCP support for multiple return values, it is buggy, so just
...
disable it until I can fix it.
llvm-svn: 85810
2009-11-02 18:22:51 +00:00
Chris Lattner
f1afb57935
improve IPSCCP to be able to propagate the result of "!mayBeOverridden"
...
function to calls of that function, regardless of whether it has local
linkage or has its address taken. Not escaping should only affect
whether we make an aggressive assumption about the arguments to a
function, not whether we can track the result of it.
llvm-svn: 85795
2009-11-02 07:33:59 +00:00
Chris Lattner
c9279a9b4d
don't mark the arguments of prototype overdefined, they will never be queried.
...
llvm-svn: 85793
2009-11-02 06:34:04 +00:00
Chris Lattner
9c7e443b07
restore some code I removed in r85788, refactor it into
...
a shared place instead of duplicating it 4 times.
llvm-svn: 85792
2009-11-02 06:28:16 +00:00
Chris Lattner
23f5603692
remove some confused code that dates from when we had
...
"multiple return values" but not "first class aggregates"
llvm-svn: 85791
2009-11-02 06:17:06 +00:00
Chris Lattner
c670f866ce
avoid redundant lookups in BBExecutable, and make it a SmallPtrSet.
...
llvm-svn: 85790
2009-11-02 06:11:23 +00:00
Chris Lattner
16b825e51f
Use the libanalysis 'ConstantFoldLoadFromConstPtr' function
...
instead of reinventing SCCP-specific logic. This gives us
new powers.
llvm-svn: 85789
2009-11-02 06:06:14 +00:00
Chris Lattner
32acebedf7
switch the main 'ValueState' map from being an std::map to being
...
a DenseMap. Doing this required being aware of subtle iterator
invalidation issues, but it provides a big speedup. In a
release-asserts build, this sped up optimizing 403.gcc from
1.34s -> 0.79s (IPSCCP) and 1.11s -> 0.44s (SCCP).
This commit also conflates in a bunch of general cleanups, sorry.
llvm-svn: 85788
2009-11-02 05:55:40 +00:00
Chris Lattner
7e74831e52
only IPSCCP incoming arguments if the function is executable, this fixes
...
an assertion on the buildbot.
llvm-svn: 85784
2009-11-02 03:25:55 +00:00
Chris Lattner
0a8c553eb2
add a new ValueState::getConstantInt() helper, use it to
...
simplify some code.
llvm-svn: 85783
2009-11-02 03:21:36 +00:00
Chris Lattner
4372b58329
tidy up some more: remove some extraneous inline specifiers, return harder.
...
llvm-svn: 85780
2009-11-02 03:03:42 +00:00
Chris Lattner
1c8cb53667
eliminate the SCCPSolver::getValueMapping method.
...
llvm-svn: 85778
2009-11-02 02:54:24 +00:00
Chris Lattner
f02562df08
fix failures introduced in r85774
...
llvm-svn: 85777
2009-11-02 02:48:17 +00:00
Chris Lattner
d4f286cb0c
factor duplicated code into a new DeleteInstructionInBlock
...
function, eliminate temporary (and pointless) smallvector.
llvm-svn: 85776
2009-11-02 02:47:51 +00:00
Chris Lattner
a806b18c99
Chris used to use '...' instead of proper grammar.
...
llvm-svn: 85775
2009-11-02 02:33:50 +00:00
Chris Lattner
37dc1cb0fb
remove some extraneous llvmcontext stuff.
...
llvm-svn: 85774
2009-11-02 02:30:06 +00:00
Chris Lattner
28db47c45a
change LatticeVal to use PointerIntPair to save some space.
...
llvm-svn: 85773
2009-11-02 02:20:32 +00:00
Chris Lattner
b94afb778c
fix instcombine to only do store sinking when the alignments
...
of the two loads agree. Propagate that onto the new store.
llvm-svn: 85772
2009-11-02 02:06:37 +00:00
Chris Lattner
f3c2039dde
when merging two loads, make sure to take the min of their alignment,
...
not the max. This didn't matter until the previous patch because
instcombine would refuse to sink loads with differenting alignments.
llvm-svn: 85738
2009-11-01 20:07:07 +00:00
Chris Lattner
e7b1e067e9
split load sinking out to its own function, like gep sinking.
...
llvm-svn: 85737
2009-11-01 20:04:24 +00:00
Chris Lattner
b3fe1009a5
fix a bug noticed by inspection: when instcombine sinks loads through
...
phis, it didn't preserve the alignment of the load. This is a missed
optimization of the alignment is high and a miscompilation when the
alignment is low.
llvm-svn: 85736
2009-11-01 19:50:13 +00:00
Chris Lattner
ad2926bbb4
remove a bunch of locking from LLVMContextImpl. Since only one thread
...
can be banging on a context at a time, this isn't needed. Owen, please
review.
llvm-svn: 85728
2009-11-01 18:42:03 +00:00