Commit Graph

54049 Commits

Author SHA1 Message Date
Chris Lattner 3e308fb0ee remove condprop testcases.
llvm-svn: 86804
2009-11-11 05:25:16 +00:00
Daniel Dunbar 74bb710227 Add StringRef::split(StringRef), to complement StringRef::split(char).
llvm-svn: 86803
2009-11-11 05:19:11 +00:00
Rafael Espindola cd6291506b Remove dead code.
llvm-svn: 86802
2009-11-11 04:10:24 +00:00
Sandeep Patel 598825e832 Show command-line args and features passed into backend in debug output. Approved by Evan Cheng.
llvm-svn: 86797
2009-11-11 03:23:46 +00:00
Daniel Dunbar 6a77f51520 Add missing run line. Devang, please check.
llvm-svn: 86795
2009-11-11 03:10:03 +00:00
Daniel Dunbar 75b4d3562c Fix -Asserts warning.
llvm-svn: 86794
2009-11-11 03:09:50 +00:00
Jim Grosbach 8d92ec45c7 The TBB and TBH instructions for Thumb2 are really handy for jump tables, but
can only branch forward. To best take advantage of them, we'd like to adjust
the basic blocks around a bit when reasonable. This patch puts basics in place
to do that, with a super-simple algorithm for backwards jump table targets that
creates a new branch after the jump table which branches backwards. Real
heuristics for reordering blocks or other modifications rather than inserting
branches will follow.

llvm-svn: 86791
2009-11-11 02:47:19 +00:00
Chris Lattner fde1f8d0d8 stub out some LazyValueInfo interfaces, and have JumpThreading
start using them in a trivial way when -enable-jump-threading-lvi
is passed.  enable-jump-threading-lvi will be my playground for 
awhile.

llvm-svn: 86789
2009-11-11 02:08:33 +00:00
Bill Wendling d656f8ec4c Fix test to work on every platform.
llvm-svn: 86786
2009-11-11 01:44:22 +00:00
Bill Wendling 5831283cb5 Fix test to work on every platform.
llvm-svn: 86785
2009-11-11 01:41:32 +00:00
Devang Patel b90dac093a XFAIL for now.
llvm-svn: 86784
2009-11-11 01:41:10 +00:00
Bill Wendling 676f44062e Make sure that the exception handling data has the same visibility as the
function it's generated for.

llvm-svn: 86779
2009-11-11 01:24:59 +00:00
Daniel Dunbar 9169a37daf Add Triple::str() which returns the contents of the Triple as a string, as a more readable alternative to getTriple().
llvm-svn: 86773
2009-11-11 00:43:14 +00:00
Devang Patel 78319c67ca Do not assume first function scope seen represents current function.
llvm-svn: 86771
2009-11-11 00:31:36 +00:00
Daniel Dunbar 9806e4ab20 Add From arguments to StringRef search functions, and tweak doxyments.
Also, add unittests for find_first_of and find_first_not_of.

llvm-svn: 86770
2009-11-11 00:28:53 +00:00
Daniel Dunbar bc299f0092 llvm-gcc/clang don't (won't?) need this hack.
llvm-svn: 86769
2009-11-11 00:28:38 +00:00
Chris Lattner 6e960c8657 oops, didn't mean to commit this, no harm, but add a todoops, didn't mean to commit this, no harm, but add a todoo
llvm-svn: 86768
2009-11-11 00:27:54 +00:00
Chris Lattner 741c94c719 Stub out a new lazy value info pass, which will eventually
vend value constraint information to the optimizer.

llvm-svn: 86767
2009-11-11 00:22:30 +00:00
Chris Lattner 3a2ae908fe add a fixme
llvm-svn: 86766
2009-11-11 00:21:58 +00:00
Chris Lattner c4e03b7ac7 remove redundant foward declaration. This function is already in
Analysis/Passes.h

llvm-svn: 86765
2009-11-11 00:21:21 +00:00
Devang Patel 4450f26621 While creating DbgScopes, do not forget parent scope.
llvm-svn: 86763
2009-11-11 00:18:40 +00:00
Evan Cheng 12f146d8f7 Block terminator may be a switch.
llvm-svn: 86761
2009-11-11 00:00:21 +00:00
Chris Lattner 3835610902 jump threading does everything that condprop does any more. This passes
bootstrap on darwin i386.

llvm-svn: 86758
2009-11-10 23:54:10 +00:00
Chris Lattner 0169fd7c62 add a note
llvm-svn: 86756
2009-11-10 23:47:45 +00:00
Chris Lattner 8ff26038ef I did this a week or two ago
llvm-svn: 86754
2009-11-10 23:40:49 +00:00
Devang Patel cdb7d44d6d Ignore variable if scope info is not available.
llvm-svn: 86753
2009-11-10 23:20:04 +00:00
Bill Wendling 47739b20fd Test this on Darwin only.
llvm-svn: 86752
2009-11-10 23:18:33 +00:00
Dale Johannesen 6f7d5b22bb Emit correct code when making a ConstantPool entry for a vector
constant whose component type is not a legal type for the target.
(If the target ConstantPool cannot handle this type either, it has
an opportunity to merge elements.  In practice any target with
8-bit bytes must support i8 *as data*).  7320806 (partial).

llvm-svn: 86751
2009-11-10 23:16:41 +00:00
Devang Patel f6eeaebd76 Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Chris Lattner a5056f5b2b in -dot-cfg and -dot-cfg-only, when rendering switch instructions,
put the switch value in the successor boxes like we put T/F for branches.

llvm-svn: 86747
2009-11-10 22:56:15 +00:00
Chris Lattner 9518fbb54e implement a TODO by teaching jump threading about "xor x, 1".
llvm-svn: 86739
2009-11-10 22:39:16 +00:00
Chris Lattner 852d6d64ff move some generally useful functions out of jump threading
into libanalysis and transformutils.

llvm-svn: 86735
2009-11-10 22:26:15 +00:00
Dan Gohman de8d418ac3 Don't mark conditional branch instructions as control barriers.
llvm-svn: 86732
2009-11-10 22:16:57 +00:00
Bill Wendling fc9469f311 Modify how the prologue encoded the "move" information for the FDE. GCC
generates a sequence similar to this:

__Z4funci:
LFB2:
        mflr r0
LCFI0:
        stmw r30,-8(r1)
LCFI1:
        stw r0,8(r1)
LCFI2:
        stwu r1,-80(r1)
LCFI3:
        mr r30,r1
LCFI4:

where LCFI3 and LCFI4 are used by the FDE to indicate what the FP, LR, and other
things are. We generated something more like this:

Leh_func_begin1:
        mflr r0
        stw r31, 20(r1)
        stw r0, 8(r1)
Llabel1:
        stwu r1, -80(r1)
Llabel2:
        mr r31, r1

Note that we are missing the "mr" instruction. This patch makes it more like the
GCC output.

llvm-svn: 86729
2009-11-10 22:14:04 +00:00
Devang Patel 42c1d17dd1 Process InlinedAt location info.
Update InsertDeclare to return newly inserted llvm.dbg.declare intrinsic.

llvm-svn: 86727
2009-11-10 22:05:35 +00:00
Chris Lattner 02e2cee7dc fix a crash in SCCP handling extractvalue of an array, pointed out and
tracked down by Stephan Reiter!

llvm-svn: 86726
2009-11-10 22:02:09 +00:00
Jakob Stoklund Olesen 4453dc976b Teach PHIElimination to split critical edges when -split-phi-edges is enabled.
Critical edges leading to a PHI node are split when the PHI source variable is
live out from the predecessor block. This help the coalescer eliminate more
PHI joins.

llvm-svn: 86725
2009-11-10 22:01:05 +00:00
Jakob Stoklund Olesen 19f235e455 Refactoring: Extract method PHIElimination::isLiveOut().
Clean up some whitespace.
No functional changes.

llvm-svn: 86724
2009-11-10 22:00:56 +00:00
Chris Lattner 40b15f220d improve comment.
llvm-svn: 86723
2009-11-10 21:45:09 +00:00
Chris Lattner 80e7e5a429 Make jump threading eliminate blocks that just contain phi nodes,
debug intrinsics, and an unconditional branch when possible.  This
reuses the TryToSimplifyUncondBranchFromEmptyBlock function split
out of simplifycfg.

llvm-svn: 86722
2009-11-10 21:40:01 +00:00
Evan Cheng 87fe40b32d Generalize lsr code that optimize loop to count down towards zero.
llvm-svn: 86715
2009-11-10 21:14:05 +00:00
Dan Gohman 1f31f6e265 Optimize test more.
llvm-svn: 86714
2009-11-10 21:02:18 +00:00
Victor Hernandez bb336a1987 make this handle redefinition of malloc function with different prototype correctly
llvm-svn: 86712
2009-11-10 19:53:28 +00:00
Evan Cheng e034867587 Change Thumb1 address mode printing, instead of
[r0, #2 * 4]
Now
[r0, #8]

This makes Thumb2 assembly more uniform and frankly the scale doesn't add much.

llvm-svn: 86707
2009-11-10 19:48:13 +00:00
Evan Cheng e6548f4106 Add a comment.
llvm-svn: 86706
2009-11-10 19:44:56 +00:00
Duncan Sands 23344095de Add defensive break.
llvm-svn: 86705
2009-11-10 19:36:40 +00:00
Daniel Dunbar b9415c7d9a Add a monstrous hack to improve X86ISelDAGToDAG compile time.
- Force NDEBUG on in any Release build. This drops the compile time to ~100s
   from ~600s, in Release mode.

 - This may just be a temporary workaround, I don't know the true nature of the
   gcc-4.2 compile time performance problem.

llvm-svn: 86695
2009-11-10 18:24:37 +00:00
Duncan Sands 8d4cde2b55 Fix obvious typo.
llvm-svn: 86694
2009-11-10 18:21:37 +00:00
Chris Lattner b8f79ba10e clarify logic.
llvm-svn: 86689
2009-11-10 17:00:47 +00:00
Douglas Gregor 66df54f92c CMake: Add Darwin-specific linker flags for building loadable modules
llvm-svn: 86684
2009-11-10 15:30:33 +00:00
Duncan Sands 1925d3a1d1 Teach DSE to eliminate useless trampolines.
llvm-svn: 86683
2009-11-10 13:49:50 +00:00
Duncan Sands 04e0c95248 Add brackets to make gcc-4.4 happy.
llvm-svn: 86681
2009-11-10 09:32:10 +00:00
Duncan Sands dca0c28452 Codegen support for the llvm.invariant/lifetime.start/end intrinsics:
just throw them away.

llvm-svn: 86678
2009-11-10 09:08:09 +00:00
Victor Hernandez fcc77b1c02 Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size
llvm-svn: 86676
2009-11-10 08:32:25 +00:00
Victor Hernandez 4744488e8d Add ComputeMultiple() analysis function that recursively determines if a Value V is a multiple of unsigned Base
llvm-svn: 86675
2009-11-10 08:28:35 +00:00
Chris Lattner 17529ac0c5 optimize test
llvm-svn: 86672
2009-11-10 07:44:36 +00:00
Chris Lattner 1559bedcc7 unify the code that determines whether it is a good idea to change the type
of a computation.  This fixes some infinite loops when dealing with TD that
has no native types.

llvm-svn: 86670
2009-11-10 07:23:37 +00:00
Nick Lewycky 5b3def9b86 Simplify.
llvm-svn: 86668
2009-11-10 07:00:43 +00:00
Nick Lewycky 9027147fb1 Reapply r86359, "Teach dead store elimination that certain intrinsics write to
memory just like a store" with bug fixed (partial-overwrite.ll is the
regression test).

llvm-svn: 86667
2009-11-10 06:46:40 +00:00
Chris Lattner cbd18fc93d refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
llvm-svn: 86666
2009-11-10 05:59:26 +00:00
Oscar Fuentes bbc1067001 CMake: Support for building llvm loadable modules.
llvm-svn: 86656
2009-11-10 02:45:37 +00:00
Daniel Dunbar 5a5b223c04 lit: Start documentation testing architecture.
llvm-svn: 86655
2009-11-10 02:41:27 +00:00
Daniel Dunbar 8acffa7dd5 lit: Add ExampleTests, for testing lit and demonstrating test suite features.
llvm-svn: 86654
2009-11-10 02:41:17 +00:00
Daniel Dunbar 4010a04034 lit: Fix bug in --show-suites which accidentally override the list of tests.
llvm-svn: 86653
2009-11-10 02:40:21 +00:00
Bruno Cardoso Lopes 05671ea10a Fix PR5445
llvm-svn: 86651
2009-11-10 02:35:13 +00:00
Chris Lattner ab799110c6 I misread the parens, not so redundant after all.
llvm-svn: 86648
2009-11-10 02:04:54 +00:00
Chris Lattner 38c44ea6b0 make jump threading recursively simplify expressions instead of doing it
just one level deep.  On the testcase we go from getting this:

F1:                                               ; preds = %T2
  %F = and i1 true, %cond                         ; <i1> [#uses=1]
  br i1 %F, label %X, label %Y

to a fully threaded:

F1:                                               ; preds = %T2
  br label %Y


This changes gets us to the point where we're forming (too many) switch 
instructions on doug's strswitch testcase.

llvm-svn: 86646
2009-11-10 01:57:31 +00:00
Chris Lattner ee89d5a4d0 remove some redundant parens.
llvm-svn: 86645
2009-11-10 01:56:04 +00:00
Oscar Fuentes b8d7793628 CMake: Remove unnecessary `unset' which was not supported by old cmake
releases.

llvm-svn: 86644
2009-11-10 01:45:05 +00:00
Dan Gohman 42cc1806d8 Remove an unused variable.
llvm-svn: 86642
2009-11-10 01:37:57 +00:00
Dan Gohman 48079d4bf5 Minor code simplification.
llvm-svn: 86641
2009-11-10 01:36:20 +00:00
Dan Gohman 0d401124d1 Trim a bunch of unneeded code from this testcase.
llvm-svn: 86640
2009-11-10 01:33:08 +00:00
Chris Lattner be11db6894 don't invalidate PN, rewrite of this code is in progress anyway.
llvm-svn: 86639
2009-11-10 01:19:06 +00:00
Chris Lattner fb7f87d5a3 add a new SimplifyInstruction API, which is like ConstantFoldInstruction,
except that the result may not be a constant.  Switch jump threading to 
use it so that it gets things like (X & 0) -> 0, which occur when phi preds
are deleted and the remaining phi pred was a zero.

llvm-svn: 86637
2009-11-10 01:08:51 +00:00
Jeffrey Yasskin b40d3f76a0 Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!

llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Chris Lattner a71e9d61be factor simplification logic for AND and OR out to InstSimplify from instcombine.
llvm-svn: 86635
2009-11-10 00:55:12 +00:00
David Goodwin 0d412c2528 Fixed to address code review. No functional changes.
llvm-svn: 86634
2009-11-10 00:48:55 +00:00
Daniel Dunbar 124fc5e252 Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.

llvm-svn: 86630
2009-11-10 00:43:58 +00:00
David Goodwin cf89db135e Allow targets to specify register classes whose member registers should not be renamed to break anti-dependencies.
llvm-svn: 86628
2009-11-10 00:15:47 +00:00
Chris Lattner ccfdceb22c pull a bunch of logic out of instcombine into instsimplify for compare
simplification, this handles the foldable fcmp x,x cases among many others.

llvm-svn: 86627
2009-11-09 23:55:12 +00:00
Dan Gohman 2ac504729b Pass the (optional) TargetData object to ConstantFoldInstOperands
and ConstantFoldCompareInstOperands.

llvm-svn: 86626
2009-11-09 23:34:17 +00:00
Chris Lattner beadc6e8c7 inline a simple function.
llvm-svn: 86625
2009-11-09 23:31:49 +00:00
Chris Lattner c1f19071f8 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
Jim Grosbach 2524b04d0e Now that the default is 'enabled,' a separate command line option for ARM is
not necessary.

llvm-svn: 86621
2009-11-09 23:11:45 +00:00
Mike Stump f8a74fc4a5 Add testcase for recent checkin.
llvm-svn: 86620
2009-11-09 23:10:49 +00:00
Chris Lattner cdfb80de16 fix ConstantFoldCompareInstOperands to take the LHS/RHS as
individual operands instead of taking a temporary array

llvm-svn: 86619
2009-11-09 23:06:58 +00:00
Daniel Dunbar 3f94a132dd Add StringSwitch::Cases overloads, for matching multiple strings to a single
value.

llvm-svn: 86618
2009-11-09 23:05:44 +00:00
Chris Lattner 800aad3dda use instructionsimplify instead of a weak clone of ad-hoc folding stuff.
llvm-svn: 86616
2009-11-09 23:00:14 +00:00
Jim Grosbach 47e3bcf180 Update test
llvm-svn: 86614
2009-11-09 22:59:01 +00:00
Chris Lattner 084a1b5581 stub out a new libanalysis "instruction simplify" interface that
takes decimated instructions and applies identities to them.  This
is pretty minimal at this point, but I plan to pull some instcombine
logic out into these and similar routines.

llvm-svn: 86613
2009-11-09 22:57:59 +00:00
Jeffrey Yasskin 8483f12ac5 Remove dlsym stubs, with Nate Begeman's permission.
llvm-svn: 86606
2009-11-09 22:34:19 +00:00
Jim Grosbach 1218b804fb Enable dynamic stack realignment by default.
llvm-svn: 86604
2009-11-09 22:32:40 +00:00
Chris Lattner 2978ca7b79 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
Jim Grosbach 55d3480769 Set dynamic stack realignment to real values.
llvm-svn: 86602
2009-11-09 22:32:03 +00:00
Dan Gohman a951526510 Remove an unneeded #include.
llvm-svn: 86601
2009-11-09 22:28:30 +00:00
Mike Stump f04c4cdb27 Fix for 64-bit builds.
llvm-svn: 86600
2009-11-09 22:28:21 +00:00
Bill Wendling 787997f77e Similar to r86588, but for Darwin this time.
llvm-svn: 86592
2009-11-09 21:45:26 +00:00
Bill Wendling 7307bff420 The jump table was being generated before the end label for exception handling
was generated. This caused code like this:

## The asm code for the function
        .section        __TEXT,__const
        .align  2
lJTI11_0:
LJTI11_0:
        .long    LBB11_16
        .long    LBB11_4
        .long    LBB11_5
        .long    LBB11_6
        .long    LBB11_7
        .long    LBB11_8
        .long    LBB11_9
        .long    LBB11_10
        .long    LBB11_11
        .long    LBB11_12
        .long    LBB11_13
        .long    LBB11_14
Leh_func_end11:   ## <---now in the wrong section!

The `Leh_func_end11' would then end up in the wrong section, causing the
resulting EH frame information to be wrong:

__ZL11CheckRightsjPKcbRbRP6NSData.eh:
    .set    Lset500eh,Leh_frame_end11-Leh_frame_begin11
    .long   Lset500eh  ; Length of Frame Information Entry                                                                                                                   
Leh_frame_begin11:
    .long   Leh_frame_begin11-Leh_frame_common
    .long   Leh_func_begin11-.
    .set    Lset501eh,Leh_func_end11-Leh_func_begin11
    .long   Lset501eh                                   ; FDE address range                                                                                                                                   
`Lset501eh' is now something huge instead of the real value.

The X86 back-end generates the jump table after the EH information is
emitted. Do the same here.

llvm-svn: 86588
2009-11-09 21:20:14 +00:00
Dan Gohman 2745d19287 Print "..." instead of all the uninteresting register clobbers on call
instructions. This makes CodeGen dumps significantly less noisy.

Example before:
  BL <ga:@bar>, %R0<imp-def>, %R1<imp-def,dead>, %R2<imp-def,dead>, %R3<imp-def,dead>, %R12<imp-def,dead>, %LR<imp-def,dead>, %D0<imp-def,dead>, %D1<imp-def,dead>, %D2<imp-def,dead>, %D3<imp-def,dead>, %D4<imp-def,dead>, %D5<imp-def,dead>, %D6<imp-def,dead>, %D7<imp-def,dead>, %D16<imp-def,dead>, %D17<imp-def,dead>, %D18<imp-def,dead>, %D19<imp-def,dead>, %D20<imp-def,dead>, %D21<imp-def,dead>, %D22<imp-def,dead>, %D23<imp-def,dead>, %D24<imp-def,dead>, %D25<imp-def,dead>, %D26<imp-def,dead>, %D27<imp-def,dead>, %D28<imp-def,dead>, %D29<imp-def,dead>, %D30<imp-def,dead>, %D31<imp-def,dead>, %CPSR<imp-def,dead>, %FPSCR<imp-def,dead>

Same example after:
  BL <ga:@bar>, %R0<imp-def>, %R1<imp-def,dead>, %LR<imp-def,dead>, %CPSR<imp-def,dead>, ...

llvm-svn: 86583
2009-11-09 19:38:45 +00:00
Dan Gohman ccb4584edd Default-addressspace null pointers don't alias anything. This allows
GVN to be more aggressive. Patch by Hans Wennborg! (with a comment added by me)

llvm-svn: 86582
2009-11-09 19:29:11 +00:00