Commit Graph

607 Commits

Author SHA1 Message Date
Chris Lattner
dd9e956605 Preserve and update ETForest. Patch by Daniel Berlin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25203 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-11 05:11:13 +00:00
Robert Bocchino
b52ee7f5ff Added support for the extractelement operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25181 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-10 19:05:34 +00:00
Chris Lattner
baec98d00b Teach loopsimplify to update et-forest. Patch contributed by Daniel Berlin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25153 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-09 08:03:08 +00:00
Chris Lattner
8e75ee212f Fix SimplifyCFG/2005-12-03-IncorrectPHIFold.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24581 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-03 18:25:58 +00:00
Chris Lattner
36ba5006df Implement a refinement to the mem2reg algorithm for cases where an alloca
has a single def.  In this case, look for uses that are dominated by the def
and attempt to rewrite them to directly use the stored value.

This speeds up mem2reg on these values and reduces the number of phi nodes
inserted.  This should address PR665.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24411 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-18 07:31:42 +00:00
Chris Lattner
fed40df846 This needs proper dominance
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24410 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-18 07:29:44 +00:00
Nate Begeman
14b0529532 Add support alignment of allocation instructions.
Add support for specifying alignment and size of setjmp jmpbufs.

No targets currently do anything with this information, nor is it presrved
in the bytecode representation.  That's coming up next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24196 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-05 09:21:28 +00:00
Chris Lattner
cbbc6b74e3 Fix #include order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24044 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-27 16:34:00 +00:00
John Criswell
a115643357 Move some constant folding code shared by Analysis and Transform passes
into the LLVMAnalysis library.
This allows LLVMTranform and LLVMTransformUtils to be archives and linked
with LLVMAnalysis.a, which provides any missing definitions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24036 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-27 15:54:34 +00:00
John Criswell
e96a1a576b 1. Remove libraries no longer created from the list of libraries linked into the
SparcV9 JIT.
2. Make LLVMTransformUtils a relinked object file and always link it before
   LLVMAnalysis.a.  These two libraries have circular dependencies on each
   other which creates problem when building the SparcV9 JIT.  This change
   fixes the dependency on all platforms problems with a minimum of fuss.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24023 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-26 20:35:13 +00:00
Chris Lattner
f36aeedaa3 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23940 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-24 02:26:13 +00:00
Chris Lattner
ab0ed3592b Only build .a file versions of these libraries, instead of .a and .o versions.
This should speed up build times.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23933 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-24 01:59:48 +00:00
Jeff Cohen
66c5fd6c53 When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23888 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-23 04:37:20 +00:00
Chris Lattner
ab55698349 Fix DemoteRegToStack on an invoke. This fixes PR634.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23618 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-04 00:44:01 +00:00
Chris Lattner
7a66e686fe Clean up the code a bit. Use isInstructionTriviallyDead to be more aggressive
and more correct than use_empty().  This fixes PR635 and
SimplifyCFG/2005-10-02-InvokeSimplify.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23616 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-03 23:43:43 +00:00
Jeff Cohen
2aeaf4e839 Fix VC++ warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23579 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 03:57:14 +00:00
Chris Lattner
93e50ce04c Insert stores after phi nodes in the normal dest. This fixes
LowerInvoke/2005-08-03-InvokeWithPHI.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23525 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 17:44:20 +00:00
Chris Lattner
32643d8e05 Constant fold llvm.sqrt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23487 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 01:34:32 +00:00
Chris Lattner
5b3c70263b add a note about a way to improve this code further, that I won't be getting
to right now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23485 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 22:44:59 +00:00
Chris Lattner
4531371960 Avoid spilling stack slots... to stack slots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23478 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 21:33:12 +00:00
Chris Lattner
f4e6c3a69b Completely rewrite 'correct' eh support. This changes how setjmp insertion
is performed so it is only at most once per function that contains an invoke
instead of once per invoke in the function.  This patch has the following perks:

1. It fixes PR631, which complains about slowness.
2. If fixes PR240, which complains about non-volatile vars being live across
   setjmp/longjmps.
3. It improves (but does not fix) the jmpbuf alignment issue on itanium by not
   forcing the jmpbufs to always be 8-bytes off the alignment of the structure.
4. It speeds up 253.perlbmk from 338s to 13.70s (a 25x improvement!), making us
   now about 4% faster than GCC.

Further improvements are also possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23477 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 21:18:17 +00:00
Chris Lattner
6d7277b3b4 allow demotion to volatile values, add support for invoke
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23473 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 19:39:00 +00:00
Chris Lattner
c5f52e6da1 Move the ConstantFoldLoadThroughGEPConstantExpr function out of the InstCombine
pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23444 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:27:10 +00:00
Chris Lattner
b60e0815df remove some debugging code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23411 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 18:49:09 +00:00
Chris Lattner
263d1e469d Fold two consequtive branches that share a common destination between them.
This implements SimplifyCFG/branch-fold.ll, and is useful on ?:/min/max heavy
code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23410 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 18:47:20 +00:00
Chris Lattner
055dc102e9 simplify some logic further
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23408 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 07:23:18 +00:00
Chris Lattner
f58c1a578e pull a bunch of logic out of SimplifyCFG into a helper fn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23407 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 06:39:30 +00:00
Chris Lattner
e9487f0dc8 Start threading across blocks with code in them, so long as the code does
not define a value that is used outside of it's block.  This catches many
more simplifications, e.g. 854 in 176.gcc, 137 in vpr, etc.

This implements branch-phi-thread.ll:test3.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23397 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-20 01:48:40 +00:00
Chris Lattner
2e42e36698 Implement merging of blocks with the same condition if the block has multiple
predecessors.  This implements branch-phi-thread.ll::test1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23395 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-20 00:43:16 +00:00
Chris Lattner
9c88d98162 Reject a case we don't handle yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-19 23:57:04 +00:00
Chris Lattner
7e1ff8d2d9 remove debugging code :-/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23392 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-19 23:50:15 +00:00
Chris Lattner
eaba3a194c Implement SimplifyCFG/branch-phi-thread.ll, the most trivial case of threading
control across branches with determined outcomes.  More generality to follow.
This triggers a couple thousand times in specint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23391 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-19 23:49:37 +00:00
Chris Lattner
0ae380a8ac Teach SplitCriticalEdge to update LoopInfo if it is alive. This fixes
a problem in LoopStrengthReduction, where it would split critical edges
then confused itself with outdated loop information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22776 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 01:38:43 +00:00
Chris Lattner
8385393dc8 remove dead code. The exit block list is computed on demand, thus does not
need to be updated.  This code is a relic from when it did.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22775 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-13 01:30:36 +00:00
Chris Lattner
b01bfd49c3 Change break critical edges to not remove, then insert, PHI node entries.
Instead, just update the BB in-place.  This is both faster, and it prevents
split-critical-edges from shuffling the PHI argument list unneccesarily.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22765 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-12 21:58:07 +00:00
Chris Lattner
98599ba6c6 remove some trickiness that broke yacr2 and some other programs last night
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22751 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 17:15:20 +00:00
Chris Lattner
94f4032448 Make loop-simplify produce better loops by turning PHI nodes like X = phi [X, Y]
into just Y.  This often occurs when it seperates loops that have collapsed loop
headers.  This implements LoopSimplify/phi-node-simplify.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22746 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 02:07:32 +00:00
Chris Lattner
5e1b231921 This code can handle non-dominating instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22667 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-05 00:57:45 +00:00
Nate Begeman
a83ba0f5c9 Fix a fixme in CondPropagate.cpp by moving a PhiNode optimization into
BasicBlock's removePredecessor routine.  This requires shuffling around
the definition and implementation of hasContantValue from Utils.h,cpp into
Instructions.h,cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22664 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-04 23:24:19 +00:00
Chris Lattner
f1adce42b2 The correct fix for PR612, which also fixes
Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22628 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 18:51:44 +00:00
Chris Lattner
6e459bf0a7 When inserting code, make sure not to insert it before PHI nodes. This
fixes PR612 and Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22626 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 18:34:29 +00:00
Chris Lattner
6306d07aa8 Fix Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll, a problem that
occurred while bugpointing another testcase


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22621 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 17:59:45 +00:00
Chris Lattner
1aad921c18 Finally, add the required constraint checks to fix Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll
the right way


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22615 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:59:12 +00:00
Chris Lattner
dc88dbeafa Simplify some code, add the correct pred checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22613 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:38:27 +00:00
Chris Lattner
3b3efc7797 Refactor code out of PropagatePredecessorsForPHIs, turning it into a pure function with no side-effects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22612 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:29:26 +00:00
Chris Lattner
d423b8b6ca use splice instead of remove/insert to avoid some symtab operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22611 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:23:42 +00:00
Chris Lattner
2bdcb56146 move two functions up in the file, use SafeToMergeTerminators to eliminate
some duplicated code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22610 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:19:45 +00:00
Chris Lattner
7e66348cba Rip some code out of the main SimplifyCFG function into a subfunction and
call it from the only place it is live.  No functionality changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22609 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-03 00:11:16 +00:00
Chris Lattner
17de414965 Disable this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050801/027345.html

This breaks real programs and only fixes an obscure regression testcase.  A
real fix is in development.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22606 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 23:31:38 +00:00
Chris Lattner
f5e982daa8 Change a place to use an arbitrary value instead of null, when possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22605 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 23:29:23 +00:00
Chris Lattner
1593ac259d This code was very close, but not quite right. It did not take into
consideration the case where a reference in an unreachable block could
occur.  This fixes Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll,
something I ran into while bugpoint'ing another pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22584 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 03:24:05 +00:00
Jeff Cohen
00b16889ab Eliminate all remaining tabs and trailing spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:12:32 +00:00
Chris Lattner
6cfd1ebcd3 Fix PR590 and Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll.
The optimization for locally used allocas was not safe for allocas that
were read before they were written.  This change disables that optimization
in that case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22318 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-30 07:29:44 +00:00
Andrew Lenharth
94cd87f658 prevent DCE of vaarg intrinsics. This should take care of most regressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22263 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-19 14:41:20 +00:00
Chris Lattner
0289929c62 Don't crash on: X = phi (X, X).
This fixes PR584 and Transforms/SimplifyCFG/2005-06-16-PHICrash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22232 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-17 01:45:53 +00:00
Chris Lattner
71fae1022e Fix a 64-bit problem, passing (int)0 through ... instead of (void*)0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22206 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-09 03:32:54 +00:00
Chris Lattner
42eb7524ef Fix Transforms/SimplifyCFG/switch-simplify-crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22158 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-20 22:19:54 +00:00
Chris Lattner
16d0db2da8 Make sure to preserve the calling convention when changing an invoke into
a call.  This fixes Prolangs-C++/deriv2, kimwitu++, and Misc-C++/bigfib
on X86 with -enable-x86-fastcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22023 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 12:21:56 +00:00
Chris Lattner
efd9168eae When lowering invokes to calls, amke sure to preserve the calling conv. This
fixes Ptrdist/anagram with x86 llcbeta


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21925 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 06:27:02 +00:00
Chris Lattner
1381dd8a6e Prefer int 0 instead of long 0 for GEP arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21924 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 06:10:12 +00:00
Chris Lattner
c154cef9a1 wrap long lines, preserve calling conventions when cloning functions and
turning calls into invokes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21797 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 01:04:34 +00:00
Chris Lattner
3799ed83b4 BAD typeo which caused many testsuite failures last night. Note to self, do
not change code after testing it without retesting!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21741 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 17:13:16 +00:00
Chris Lattner
a9e9211bbb Preserve tail marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21737 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:48:21 +00:00
Chris Lattner
1b49141821 Implement Transforms/Inline/inline-tail.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21736 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 06:47:52 +00:00
Chris Lattner
ec710c5b12 DCE intrinsic instructions without side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21719 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-06 05:27:34 +00:00
John Criswell
fe3706a12b Fixed a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21653 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-02 14:47:42 +00:00
Reid Spencer
df4945bcb5 Remove optimizations that don't require both operands to be constant. These
are moved to simplify-libcalls pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21614 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-29 05:55:35 +00:00
Reid Spencer
1d3b71846b * Add constant folding for additional floating point library calls such as
sinh, cosh, etc.
* Make the name comparisons for the fp libcalls a little more efficient by
  switching on the first character of the name before doing comparisons.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21611 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-28 23:01:59 +00:00
Jeff Cohen
9d80930e95 Eliminate tabs and trailing spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21480 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-23 21:38:35 +00:00
Misha Brukman
fd93908ae8 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21427 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:48:37 +00:00
Chris Lattner
0f67dd6237 Improve doxygen documentation, patch contributed by Evan Jones!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:04:49 +00:00
Chris Lattner
bf5d4fb7d8 Teach simplifycfg that setcc is cheap and non-trapping, so that it can
convert this:

        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        br bool %tmp.1, label %shortcirc_done, label %shortcirc_next

shortcirc_next:         ; preds = %entry
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        br label %shortcirc_done

shortcirc_done:         ; preds = %shortcirc_next, %entry
        %shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ]         ; <bool> [#uses=1]

to this:
        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        %shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]

... which is later simplified by instcombine into an or.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 05:31:13 +00:00
Chris Lattner
151c80be81 Get rid of this for_each loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21253 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12 18:51:33 +00:00
Alkis Evlogimenos
ab7ada3ed6 Rename createPromoteMemoryToRegister() to
createPromoteMemoryToRegisterPass() to be consistent with other pass
creation functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20885 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-28 02:01:12 +00:00
Chris Lattner
cec5b8831d Enhance loopsimplify to preserve alias analysis instead of clobbering it.
This prevents crashes on some programs when using -ds-aa -licm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20831 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-25 06:37:22 +00:00
Chris Lattner
5b3a4553c1 Fix the missing symbols problem Bill was hitting. Patch contributed by
Bill Wendling!!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20649 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-17 15:38:16 +00:00
Chris Lattner
e4d5c441e0 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 04:54:21 +00:00
Chris Lattner
fee3411379 trivial simplification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20494 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-06 21:35:38 +00:00
Chris Lattner
7acff25f7f second argument to Value::setName is now gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20463 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-05 19:05:20 +00:00
Chris Lattner
5f792c2c53 Add an optional argument to lower to a specific constant value instead of
to a "sizeof" expression.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20414 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-03 01:03:43 +00:00
Chris Lattner
da895d6337 Fix spelling, patch contributed by Gabor Greif!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20343 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27 06:18:25 +00:00
Chris Lattner
be54dcc8a9 remove extraneous cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20334 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-26 18:33:28 +00:00
Chris Lattner
623369ac56 Implement Transforms/SimplifyCFG/switch_thread.ll
This does a simple form of "jump threading", which eliminates CFG edges that
are provably dead.  This triggers 90 times in the external tests, and
eliminating CFG edges is always always a good thing! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-24 06:17:52 +00:00
Chris Lattner
5551706b0f Adjust to changes in instruction interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19900 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 00:39:08 +00:00
Chris Lattner
378805969e switchinst ctor now takes a hint for the number of cases that it will have.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19898 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 00:38:26 +00:00
Chris Lattner
13b2f764c0 Implement SimplifyCFG/DeadSetCC.ll
SimplifyCFG is one of those passes that we use for final cleanup: it should
not rely on other passes to clean up its garbage.  This fixes the "why are
trivially dead setcc's in the output of gccas" problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19212 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01 16:02:12 +00:00
Chris Lattner
de97b5788c Get rid of getSizeOf, using ConstantExpr::getSizeOf instead.
do not insert a prototype for malloc of: void* malloc(uint): on 64-bit u
targets this is not correct.  Instead of prototype it as void *malloc(...),
and pass the correct intptr_t through the "...".

Finally, fix Regression/CodeGen/SparcV9/2004-12-13-MallocCrash.ll, by not
forming constantexpr casts from pointer to uint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18908 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 20:00:02 +00:00
Chris Lattner
284d1b8827 The split bb is really the exit of the old function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 16:59:54 +00:00
Chris Lattner
7613437db9 Fix Regression/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll,
and the failure on make_dparser last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18766 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 17:42:31 +00:00
Reid Spencer
791a959e57 For PR387:\
Add doInitialization method to avoid overloaded virtuals


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18602 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-07 08:11:36 +00:00
Chris Lattner
0f535c6fa8 Squelch warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18381 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 07:47:34 +00:00
Chris Lattner
5a85d9c664 Fix test/Regression/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llx
This only fails on darwin or on X86 under valgrind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18377 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 07:01:15 +00:00
Chris Lattner
6f9e571529 Alkis noticed that this variable is dead. Thanks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18369 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 04:01:44 +00:00
Chris Lattner
37dc938bbe If we have something like this:
if (x) {
    code
    ...
  } else {
    code
    ...
  }

Turn it into:

  code
  if (x) {
    ...
  } else {
    ...
  }

This reduces code size and in some common cases allows us to completely
eliminate the conditional.  This turns several if/then/else blocks in loops
into straightline code in 179.art, turning the loops into single basic blocks
(good for modsched even!).

Maybe now brg will leave me alone ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18366 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 00:29:14 +00:00
Misha Brukman
e74c73cf46 Allow constructor parameter to override aggregating args; fix spacing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18028 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 02:20:27 +00:00
Chris Lattner
0c3b390a54 Lazily create the abort message, so only translation units that use unwind
will actually get it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17700 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 19:07:32 +00:00
Chris Lattner
9ecc046184 Fix: CodeExtractor/2004-11-12-InvokeExtract.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17699 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 00:06:45 +00:00
Chris Lattner
68c311aac6 Fix a bug where the code extractor would get a bit confused handling invoke
instructions, setting DefBlock to a block it did not have dom info for.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17697 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 23:50:44 +00:00
Chris Lattner
44c94b9671 Simplify handling of constant initializers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17696 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 22:42:57 +00:00
Chris Lattner
bfd3e52701 Do not compute the predecessor list for a block unless we need it.
This speeds up simplifycfg on this program, from 44.87s to 0.29s (with
a profiled build):

 #define CL0(a) case a: goto c;
 #define CL1(a) CL0(a##0) CL0(a##1) CL0(a##2) CL0(a##3) CL0(a##4) CL0(a##5) \
 CL0(a##6) CL0(a##7) CL0(a##8) CL0(a##9)
 #define CL2(a) CL1(a##0) CL1(a##1) CL1(a##2) CL1(a##3) CL1(a##4) CL1(a##5) \
 CL1(a##6) CL1(a##7) CL1(a##8) CL1(a##9)
 #define CL3(a) CL2(a##0) CL2(a##1) CL2(a##2) CL2(a##3) CL2(a##4) CL2(a##5) \
 CL2(a##6) CL2(a##7) CL2(a##8) CL2(a##9)
 #define CL4(a) CL3(a##0) CL3(a##1) CL3(a##2) CL3(a##3) CL3(a##4) CL3(a##5) \
 CL3(a##6) CL3(a##7) CL3(a##8) CL3(a##9)

 void f();

 void a() {
     int b;
  c: switch (b) {
         CL4(1)
     }
 }

This testcase is contrived to expose N^2 behavior, but this patch should speedup
simplifycfg on any programs that use large switch statements.  This testcase
comes from GCC PR17895.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17389 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-01 06:53:58 +00:00