David Greene
a8a32dd987
Change errs() to dbgs().
...
llvm-svn: 92599
2010-01-05 01:26:39 +00:00
David Greene
30ed3ca034
Change errs() to dbgs().
...
llvm-svn: 92597
2010-01-05 01:26:11 +00:00
David Greene
d18966c79f
Change errs() to dbgs().
...
llvm-svn: 92596
2010-01-05 01:26:09 +00:00
David Greene
fc886b99da
Change errs() to dbgs().
...
llvm-svn: 92595
2010-01-05 01:26:05 +00:00
David Greene
aa8ce38113
Change errs() to dbgs().
...
llvm-svn: 92594
2010-01-05 01:26:01 +00:00
David Greene
4b7aa24842
Change errs() to dbgs().
...
llvm-svn: 92593
2010-01-05 01:26:00 +00:00
David Greene
7e34eadd91
Change errs() to dbgs().
...
llvm-svn: 92592
2010-01-05 01:25:58 +00:00
David Greene
9f23703919
Change errs() to dbgs().
...
llvm-svn: 92591
2010-01-05 01:25:55 +00:00
David Greene
e3f851db18
Change errs() to dbgs().
...
llvm-svn: 92590
2010-01-05 01:25:52 +00:00
David Greene
714520fb89
Change errs() to dbgs().
...
llvm-svn: 92589
2010-01-05 01:25:50 +00:00
David Greene
97d9fc8cdb
Change errs() to dbgs().
...
llvm-svn: 92588
2010-01-05 01:25:47 +00:00
David Greene
91c42f851b
Change errs() to dbgs().
...
llvm-svn: 92587
2010-01-05 01:25:45 +00:00
David Greene
7e256f397c
Change errs() to dbgs().
...
llvm-svn: 92586
2010-01-05 01:25:43 +00:00
David Greene
94745d0d10
Change errs() to dbgs().
...
llvm-svn: 92585
2010-01-05 01:25:41 +00:00
David Greene
0c1e7772fb
Change errs() to dbgs().
...
llvm-svn: 92584
2010-01-05 01:25:39 +00:00
David Greene
025e934d54
Change errs() to dbgs().
...
llvm-svn: 92583
2010-01-05 01:25:20 +00:00
David Greene
85afc853b5
Change errs() to dbgs().
...
llvm-svn: 92582
2010-01-05 01:25:15 +00:00
David Greene
4eb5bed65b
Change errs() to dbgs().
...
llvm-svn: 92581
2010-01-05 01:25:11 +00:00
David Greene
d65bc15c81
Change errs() to dbgs().
...
llvm-svn: 92580
2010-01-05 01:25:09 +00:00
David Greene
6f021a30fe
Change errs() to dbgs().
...
llvm-svn: 92579
2010-01-05 01:25:04 +00:00
David Greene
fe5c3524c7
Change errs() to dbgs().
...
llvm-svn: 92578
2010-01-05 01:25:00 +00:00
David Greene
5730f203ee
Change errs() to dbgs().
...
llvm-svn: 92577
2010-01-05 01:24:57 +00:00
David Greene
f34d7ac9f1
Change errs() to dbgs().
...
llvm-svn: 92576
2010-01-05 01:24:54 +00:00
David Greene
ae4f266b2d
Change errs() to dbgs().
...
llvm-svn: 92575
2010-01-05 01:24:53 +00:00
David Greene
ec5883fc0e
Change errs() to dbgs().
...
llvm-svn: 92574
2010-01-05 01:24:50 +00:00
David Greene
807fcf6374
Change errs() to dbgs().
...
llvm-svn: 92573
2010-01-05 01:24:48 +00:00
David Greene
40deefdc4f
Change errs() to dbgs().
...
llvm-svn: 92572
2010-01-05 01:24:45 +00:00
David Greene
63145844c8
Change errs() to dbgs().
...
llvm-svn: 92571
2010-01-05 01:24:43 +00:00
David Greene
4cec475ed7
Change errs() to dbgs().
...
llvm-svn: 92570
2010-01-05 01:24:40 +00:00
David Greene
d93137dce7
Change errs() to dbgs().
...
llvm-svn: 92569
2010-01-05 01:24:36 +00:00
David Greene
7562faa4cf
Change errs() to dbgs().
...
llvm-svn: 92568
2010-01-05 01:24:34 +00:00
David Greene
d7c266bb9c
Change errs() to dbgs().
...
llvm-svn: 92567
2010-01-05 01:24:28 +00:00
David Greene
2555292e44
Change errs() to dbgs().
...
llvm-svn: 92566
2010-01-05 01:24:24 +00:00
David Greene
ac9f8199ba
Change errs() to dbgs().
...
llvm-svn: 92565
2010-01-05 01:24:21 +00:00
Dan Gohman
ea6f91ff64
Change SelectCode's argument from SDValue to SDNode *, to make it more
...
clear what information these functions are actually using.
This is also a micro-optimization, as passing a SDNode * around is
simpler than passing a { SDNode *, int } by value or reference.
llvm-svn: 92564
2010-01-05 01:24:18 +00:00
David Greene
f62be0c0a6
Change errs() to dbgs().
...
llvm-svn: 92563
2010-01-05 01:24:08 +00:00
David Greene
2baba9643c
Change errs() to dbgs().
...
llvm-svn: 92562
2010-01-05 01:23:38 +00:00
David Greene
85814ac1b7
Change errs() to dbgs().
...
llvm-svn: 92561
2010-01-05 01:23:36 +00:00
David Greene
1c10c25354
Change errs() to dbgs().
...
llvm-svn: 92560
2010-01-05 01:23:34 +00:00
Devang Patel
be94f23992
Remove dead debug info intrinsics.
...
Intrinsic::dbg_stoppoint
Intrinsic::dbg_region_start
Intrinsic::dbg_region_end
Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.
llvm-svn: 92557
2010-01-05 01:10:40 +00:00
Dan Gohman
43324d0b29
Remove the SDNPAssociative properties for the flags-producing
...
operators. Eli pointed out that it's not obvious what that
would mean.
llvm-svn: 92555
2010-01-05 00:44:20 +00:00
Dan Gohman
1c93bbc7d4
Simplify this code; avoid duplicating the low-level implementation code.
...
llvm-svn: 92554
2010-01-05 00:42:54 +00:00
Dan Gohman
0b10fd4f4a
Fix a typo in a comment.
...
llvm-svn: 92552
2010-01-05 00:30:22 +00:00
Daniel Dunbar
72a87448c1
Fix some struct/class specifier mismatches.
...
llvm-svn: 92550
2010-01-05 00:15:58 +00:00
David Greene
646aacb097
Change errs() to dbgs().
...
llvm-svn: 92548
2010-01-05 00:10:05 +00:00
David Greene
55cf95c202
Change errs() to dbgs().
...
llvm-svn: 92547
2010-01-05 00:03:48 +00:00
David Greene
29388d6a6f
Change errs() to dbgs().
...
llvm-svn: 92545
2010-01-04 23:48:20 +00:00
David Greene
6671011c21
Change errs() to dbgs().
...
llvm-svn: 92544
2010-01-04 23:39:17 +00:00
David Greene
6c56cefe08
Change errs() to dbgs().
...
llvm-svn: 92542
2010-01-04 23:22:07 +00:00
Daniel Dunbar
4a8d96df0b
Update CMake LibDeps
...
llvm-svn: 92540
2010-01-04 23:17:24 +00:00
David Greene
2ff921beef
Change errs() to dbgs().
...
llvm-svn: 92539
2010-01-04 23:14:46 +00:00
David Greene
c4878b132b
Change errs() to dbgs().
...
llvm-svn: 92535
2010-01-04 23:06:47 +00:00
Devang Patel
e6433faba6
Fix debug_inlined section entries for routines whose names are changed through __asm() extension.
...
llvm-svn: 92533
2010-01-04 23:04:36 +00:00
David Greene
d599dcd754
Change errs() to dbgs().
...
llvm-svn: 92532
2010-01-04 23:02:10 +00:00
David Greene
1a51a211c6
Change errs() to dbgs().
...
llvm-svn: 92529
2010-01-04 22:49:02 +00:00
David Greene
c215532318
Change errs() to dbgs().
...
llvm-svn: 92528
2010-01-04 22:41:43 +00:00
David Greene
ca15eaccbb
Change errs() to dbgs().
...
llvm-svn: 92524
2010-01-04 22:33:16 +00:00
Daniel Dunbar
74be83582c
tblgen/OptParser: Use EmitSourceFileHeader.
...
llvm-svn: 92521
2010-01-04 22:03:51 +00:00
David Greene
72e47cd670
Change errs() to dbgs().
...
llvm-svn: 92520
2010-01-04 22:02:01 +00:00
Douglas Gregor
5b88b8a365
Fix CMake build for InstCombine changes
...
llvm-svn: 92519
2010-01-04 21:58:55 +00:00
David Greene
ca553bd73f
Change errs() to dbgs().
...
llvm-svn: 92518
2010-01-04 21:48:34 +00:00
David Greene
821e67e25b
Change errs() to dbgs().
...
llvm-svn: 92516
2010-01-04 21:35:15 +00:00
David Greene
964a98221d
Change errs() to dbgs().
...
llvm-svn: 92515
2010-01-04 21:26:07 +00:00
Dan Gohman
8c63ee7e28
Make this test more portable.
...
llvm-svn: 92514
2010-01-04 21:23:34 +00:00
Evan Cheng
7844a99d60
Perform this folding as a target specific dag combine:
...
(or (x << c) | (y >> (64 - c))) ==> (shld64 x, y, c)
The isel patterns may not catch all the cases if general dag combine has reduced width of source operands.
llvm-svn: 92513
2010-01-04 21:22:48 +00:00
Dan Gohman
feeced4104
Use a pointer type rather than MVT::Other for the ExternalSymbol node used
...
in an inline asm.
llvm-svn: 92512
2010-01-04 21:00:54 +00:00
Dan Gohman
5d1987f9a0
Remove some README.txt entries which are now implemented.
...
llvm-svn: 92511
2010-01-04 20:55:05 +00:00
Devang Patel
63cdd6fcf3
Remove oversimplified test case.
...
llvm-svn: 92510
2010-01-04 20:54:06 +00:00
Dan Gohman
52183c3cc9
Add some tests and update an existing test to reflect recent
...
x86 isel peeps.
llvm-svn: 92509
2010-01-04 20:53:54 +00:00
Dan Gohman
0f960aed68
A use by operand 1 or 2 of a SELECT is not a FLAGS use. This
...
lets the test-elimination work in more conditional-move cases.
llvm-svn: 92508
2010-01-04 20:52:50 +00:00
Dan Gohman
85d4fdfe37
Flags-producing add, and, or, etc. have the same profibility
...
rules as normal add, and, or, etc.
llvm-svn: 92507
2010-01-04 20:51:50 +00:00
Dan Gohman
71671131c3
Add SDNPCommutative and SDNPAssociative to several X86 target nodes.
...
This lets isel fold loads into them in more cases.
llvm-svn: 92506
2010-01-04 20:51:05 +00:00
Devang Patel
530a075f17
Fix begin and end markers for nested scopes.
...
llvm-svn: 92505
2010-01-04 20:44:00 +00:00
Dan Gohman
673e23558b
Replace some special-case code which probably was buggy with an assertion
...
verifying that the special case does not occur.
llvm-svn: 92504
2010-01-04 20:36:57 +00:00
Dan Gohman
b91411c9b9
Remove the CPAttrParentAsRoot code, which is unused, and inconvenient
...
for a refactoring I'm working on.
llvm-svn: 92503
2010-01-04 20:31:55 +00:00
David Greene
af5b9a2d62
Change errs() to dbgs().
...
llvm-svn: 92502
2010-01-04 19:57:26 +00:00
Devang Patel
a7c8e58d95
The test, derived from optimzed IR, does not mention "bar" in debug info anywhere so the dwarf writer is not expected to emit any debug info for function "bar".
...
llvm-svn: 92499
2010-01-04 19:41:13 +00:00
David Greene
94cfbe1ddd
Change errs() to dbgs().
...
llvm-svn: 92498
2010-01-04 19:36:42 +00:00
David Greene
7af1efc1ae
Change errs() to dbgs().
...
llvm-svn: 92496
2010-01-04 19:10:20 +00:00
Chris Lattner
a751d09c08
Truncate GEP indexes larger than the pointer size down to pointer size
...
when doing this transform if the GEP is not inbounds. No testcase because
it is very difficult to trigger this: instcombine already canonicalizes
GEP indices to pointer size, so it relies specific permutations of the
instcombine worklist.
Thanks to Duncan for pointing this possible problem out.
llvm-svn: 92495
2010-01-04 18:57:15 +00:00
Chris Lattner
2cb08e69b1
silence a bogus 'might be used uninit' warning from GCC.
...
llvm-svn: 92494
2010-01-04 18:48:26 +00:00
Dan Gohman
fc76441623
Add a comment.
...
llvm-svn: 92492
2010-01-04 18:38:39 +00:00
David Greene
96b90539d6
Change errs() to dbgs().
...
llvm-svn: 92490
2010-01-04 17:47:05 +00:00
Anton Korobeynikov
d91a14dba5
Fix invalid chain folding for memory variant of sdiv / udiv
...
llvm-svn: 92472
2010-01-04 10:31:54 +00:00
Chris Lattner
59d95743c8
move some more cast-related stuff
...
llvm-svn: 92471
2010-01-04 07:59:07 +00:00
Mikhail Glushenkov
6a8ac8ce8f
80-col violations, trailing whitespace.
...
llvm-svn: 92470
2010-01-04 07:55:25 +00:00
Chris Lattner
92be2adba6
move the [Can]EvaluateInDifferentType functions out to InstCombineCasts.cpp
...
llvm-svn: 92469
2010-01-04 07:54:59 +00:00
Chris Lattner
2b295a0eba
split 943 lines of instcombine out to a new InstCombineCasts.cpp
...
file. InstructionCombining.cpp is now down to a svelte 9300 lines :)
llvm-svn: 92468
2010-01-04 07:53:58 +00:00
Chris Lattner
2188e40e4c
split instcombine of compares (visit[FI]Cmp) out to
...
a new InstCombineCompares.cpp file.
llvm-svn: 92467
2010-01-04 07:37:31 +00:00
Chris Lattner
6ea40f1542
update cmakefile
...
llvm-svn: 92466
2010-01-04 07:19:55 +00:00
Chris Lattner
7e0449172c
move the 'SimplifyDemandedFoo' methods out to their own file, cutting 1K lines out of instcombine.cpp
...
llvm-svn: 92465
2010-01-04 07:17:19 +00:00
Mikhail Glushenkov
9081dc6b12
Fix the Emacs mode string.
...
Also trailing whitespace & 80-col violations.
llvm-svn: 92464
2010-01-04 07:16:12 +00:00
Chris Lattner
35522b7465
split the instcombine class definition out to a header shared
...
among the instcombine library.
llvm-svn: 92463
2010-01-04 07:12:23 +00:00
Chris Lattner
b8906bda13
remove a ton of unneeded LLVMContext stuff.
...
llvm-svn: 92462
2010-01-04 07:02:48 +00:00
Chris Lattner
66c2e54bcd
move InstCombineWorklist out to its own header.
...
llvm-svn: 92461
2010-01-04 06:30:00 +00:00
Chris Lattner
e2b9da98b0
forgot to svn add these.
...
llvm-svn: 92460
2010-01-04 06:28:20 +00:00
Chris Lattner
c0e6640d3a
move instcombine to its own library, it's past time.
...
llvm-svn: 92459
2010-01-04 06:23:24 +00:00
Chris Lattner
2d91231d82
implement an instcombine xform needed by clang's codegen
...
on the example in PR4216. This doesn't trigger in the testsuite,
so I'd really appreciate someone scrutinizing the logic for
correctness.
llvm-svn: 92458
2010-01-04 06:03:59 +00:00
Chris Lattner
1dae8766b1
fix PR5930, allowing the asmprinter to emit difference between
...
two labels as a truncate.
llvm-svn: 92455
2010-01-03 18:33:18 +00:00
Chris Lattner
fd11f49b4e
it isn't safe to speculative load from a malloc, it might have
...
returned null, and may not have been big enough in any case.
Thanks to Jay Foad for pointing this out!
llvm-svn: 92452
2010-01-03 18:14:24 +00:00
Chris Lattner
f6a585fc2f
add PR#
...
llvm-svn: 92451
2010-01-03 18:10:58 +00:00
Chris Lattner
a7cfc43af8
differences between two blockaddress's don't cause a
...
global variable initializer to require relocations.
llvm-svn: 92450
2010-01-03 18:09:40 +00:00
Chris Lattner
48218e42cd
pull my debug hooks out, I'm done with this xform for now.
...
llvm-svn: 92446
2010-01-03 06:58:48 +00:00
Nick Lewycky
475d3d1215
Small cleanups, refactor some duplicated code into a single method. No
...
functionality change.
llvm-svn: 92445
2010-01-03 04:39:07 +00:00
Chris Lattner
fca0c8f93a
generalize the previous transformation to handle indexing into
...
arrays of structs and other arrays, so long as all the subsequent
indexes are constants. This triggers frequently for stuff like:
@divisions = internal constant [29 x [2 x i32]] [[2 x i32] zeroinitializer, [2 x i32] [i32 0, i32 1], [2 x i32] [i32 0, i32 2], [2 x i32] [i32 0, i32 1], [2 x i32] zeroinitializer, [2 x i32] [i32 0, i32 1], [2 x i32] [i32 0, i32 1], [2 x i32] [i32 0, i32 2], [2 x i32] [i32 0, i32 2], [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] [i32 0, i32 2], [2 x i32] [i32 0, i32 1], [2 x i32] zeroinitializer, [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 2]], align 32 ; <[29 x [2 x i32]]*> [#uses=50]
%623 = getelementptr inbounds [29 x [2 x i32]]* @divisions, i64 0, i64 %619, i64 0 ; <i32*> [#uses=1]
%684 = icmp eq i32 %683, 999
also for the "my_defs" table in 'gs', etc.
llvm-svn: 92444
2010-01-03 03:03:27 +00:00
Nick Lewycky
ff9cd7ace7
Cleanup.
...
llvm-svn: 92436
2010-01-03 00:55:31 +00:00
Chris Lattner
98ad2b56cc
teach instcombine to optimize idioms like A[i]&42 == 0. This
...
occurs in 403.gcc in mode_mask_array, in safe-ctype.c (which
is copied in multiple apps) in _sch_istable, etc.
llvm-svn: 92427
2010-01-02 22:08:28 +00:00
Chris Lattner
b56bef45f8
Teach the table lookup optimization to generate range compares
...
when a consequtive sequence of elements all satisfies the
predicate. Like the double compare case, this generates better
code than the magic constant case and generalizes to more than
32/64 element array lookups.
Here are some examples where it triggers. From 403.gcc, most
accesses to the rtx_class array are handled, e.g.:
@rtx_class = constant [153 x i8] c"xxxxxmmmmmmmmxxxxxxxxxxxxmxxxxxxiiixxxxxxxxxxxxxxxxxxxooxooooooxxoooooox3x2c21c2222ccc122222ccccaaaaaa<<<<<<<<<<<<<<<<<<111111111111bbooxxxxxxxxxxcc2211x", align 32 ; <[153 x i8]*> [#uses=547]
%142 = icmp eq i8 %141, 105
@rtx_class = constant [153 x i8] c"xxxxxmmmmmmmmxxxxxxxxxxxxmxxxxxxiiixxxxxxxxxxxxxxxxxxxooxooooooxxoooooox3x2c21c2222ccc122222ccccaaaaaa<<<<<<<<<<<<<<<<<<111111111111bbooxxxxxxxxxxcc2211x", align 32 ; <[153 x i8]*> [#uses=543]
%165 = icmp eq i8 %164, 60
Also, most of the 59-element arrays (mode_class/rid_to_yy, etc)
optimized before are actually range compares. This lets 32-bit
machines optimize them.
400.perlbmk has stuff like this:
400.perlbmk: PL_regkind, even for 32-bit:
@PL_regkind = constant [62 x i8] c"\00\00\02\02\02\06\06\06\06\09\09\0B\0B\0D\0E\0E\0E\11\12\12\14\14\16\16\18\18\1A\1A\1C\1C\1E\1F !!!$$&'((((,-.///88886789:;8$", align 32 ; <[62 x i8]*> [#uses=4]
%811 = icmp ne i8 %810, 33
@PL_utf8skip = constant [256 x i8] c"\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\04\04\04\04\04\04\04\04\05\05\05\05\06\06\07\0D", align 32 ; <[256 x i8]*> [#uses=94]
%12 = icmp ult i8 %10, 2
etc.
llvm-svn: 92426
2010-01-02 21:50:18 +00:00
Chris Lattner
e199d2df80
theoretically the negate we find could be in a different function, check
...
for this case.
llvm-svn: 92425
2010-01-02 21:46:33 +00:00
Chris Lattner
2fa4ec70fc
use enums for the over/underdefined markers for clarity. Switch
...
to using -2/-3 instead of -1/-2 for a future xform.
llvm-svn: 92423
2010-01-02 20:20:33 +00:00
Chris Lattner
351e22aa36
remove the random sampling framework, which is not maintained anymore.
...
If there is interest, it can be resurrected from SVN. PR4912.
llvm-svn: 92422
2010-01-02 20:07:03 +00:00
Nick Lewycky
a67519be12
Fix logic error in previous commit. The != case needs to become an or, not an
...
and.
llvm-svn: 92419
2010-01-02 16:14:56 +00:00
Nick Lewycky
357d41b3c1
Optimize pointer comparison into the typesafe form, now that the backends will
...
handle them efficiently. This is the opposite direction of the transformation
we used to have here.
llvm-svn: 92418
2010-01-02 15:25:44 +00:00
Chris Lattner
cfda435c73
Generalize the previous xform to handle cases where exactly
...
two elements match or don't match with two comparisons. For
example, the testcase compiles into:
define i1 @test5(i32 %X) {
%1 = icmp eq i32 %X, 2 ; <i1> [#uses=1]
%2 = icmp eq i32 %X, 7 ; <i1> [#uses=1]
%R = or i1 %1, %2 ; <i1> [#uses=1]
ret i1 %R
}
This generalizes the previous xforms when the array is larger than
64 elements (and this case matches) and generates better code for
cases where it overlaps with the magic bitshift case.
This generalizes more cases than you might expect. For example,
400.perlbmk has:
@PL_utf8skip = constant [256 x i8] c"\01\01\01\...
%15 = icmp ult i8 %7, 7
403.gcc has:
@rid_to_yy = internal constant [114 x i16] [i16 259, i16 260, ...
%18 = icmp eq i16 %16, 295
and xalancbmk has a bunch of examples, such as
_ZN11xercesc_2_5L15gCombiningCharsE and _ZN11xercesc_2_5L10gBaseCharsE.
llvm-svn: 92417
2010-01-02 09:35:17 +00:00
Chris Lattner
c6ac078423
fix a miscompilation I introduced of cdecl with a late change.
...
llvm-svn: 92416
2010-01-02 09:22:13 +00:00
Chris Lattner
935a4a606a
enhance the compare/load/index optimization to work on *any* load
...
from a global with 32/64 elements or less (depending on whether
i64 is native on the target), generating a bitshift idiom to
determine the result. For example, on test4 we produce:
define i1 @test4(i32 %X) {
%1 = lshr i32 933, %X ; <i32> [#uses=1]
%2 = and i32 %1, 1 ; <i32> [#uses=1]
%R = icmp ne i32 %2, 0 ; <i1> [#uses=1]
ret i1 %R
}
This triggers in a number of interesting cases, for example, here's an
fp case:
@A.3255 = internal constant [4 x double] [double 4.100000e+00, double -3.900000e+00, double -1.000000e+00, double 1.000000e+00], align 32 ; <[4 x double]*> [#uses=7]
...
%7 = fcmp olt double %3, 0.000000e+00
In this case we make the slen2_tab global dead, which is nice:
@slen2_tab = internal constant [16 x i32] [i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 1, i32 2, i32 3, i32 1, i32 2, i32 3, i32 2, i32 3], align 32 ; <[16 x i32]*> [#uses=1]
...
%204 = icmp eq i32 %46, 0
Perl has a bunch of these, also on the 'Perl_regkind' array:
@Perl_yygindex = internal constant [51 x i16] [i16 0, i16 0, i16 0, i16 0, i16 374, i16 351, i16 0, i16 -12, i16 0, i16 946, i16 413, i16 -83, i16 0, i16 0, i16 0, i16 -311, i16 -13, i16 4007, i16 2893, i16 0, i16 0, i16 0, i16 0, i16 0, i16 372, i16 -8, i16 0, i16 0, i16 246, i16 -131, i16 43, i16 86, i16 208, i16 -45, i16 -169, i16 987, i16 0, i16 0, i16 0, i16 0, i16 308, i16 0, i16 -271, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0], align 32 ; <[51 x i16]*> [#uses=1]
...
%1364 = icmp eq i16 %1361, 0
186.crafty really likes this on 64-bit machines, because it triggers on a bunch of globals like this:
@white_outpost = internal constant [64 x i8] c"\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\02\02\00\00\00\00\00\04\05\05\04\00\00\00\00\03\06\06\03\00\00\00\00\00\01\01\00\00\00\00\00\00\00\00\00\00\00", align 32 ; <[64 x i8]*> [#uses=2]
However the big winner is 403.gcc, which triggers hundreds of times, eliminating all the accesses to the 57-element arrays 'mode_class', mode_unit_size, mode_bitsize, regclass_map, etc.
go 64-bit machines :)
llvm-svn: 92415
2010-01-02 08:56:52 +00:00
Mikhail Glushenkov
65f12ea72e
Forward -O0 to llvm-gcc.
...
llvm-svn: 92414
2010-01-02 08:27:23 +00:00
Mikhail Glushenkov
8181d150c0
Apparently, it is OK for -MT to be specified several times.
...
llvm-svn: 92413
2010-01-02 08:27:10 +00:00
Chris Lattner
b1567bd584
enhance the previous optimization to work with fcmp in addition
...
to icmp.
llvm-svn: 92412
2010-01-02 08:20:51 +00:00
Chris Lattner
a061859ccc
Teach instcombine to fold compares of loads from constant
...
arrays with variable indices into a comparison of the index
with a constant. The most common occurrence of this that
I see by far is stuff like:
if ("foobar"[i] == '\0') ...
which we compile into: if (i == 6), saving a load and
materialization of the global address. This also exposes
loop trip count information to later passes in many cases.
This triggers hundreds of times in xalancbmk, which is where I first
noticed it, but it also triggers in many other apps. Here are a few
interesting ones from various apps:
@must_be_connected_without = internal constant [8 x i8*] [i8* getelementptr inbounds ([3 x i8]* @.str64320, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8]* @.str27283, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8]* @.str71327, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8]* @.str72328, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8]* @.str18274, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8]* @.str11267, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8]* @.str32288, i64 0, i64 0), i8* null], align 32 ; <[8 x i8*]*> [#uses=2]
%scevgep.i = getelementptr [8 x i8*]* @must_be_connected_without, i64 0, i64 %indvar.i ; <i8**> [#uses=1]
%17 = load ...
%18 = icmp eq i8* %17, null ; <i1> [#uses=1]
-> icmp eq i64 %indvar.i, 7
@yytable1095 = internal constant [84 x i8] c"\12\01(\05\06\07\08\09\0A\0B\0C\0D\0E1\0F\10\11266\1D: \10\11,-,0\03'\10\11B6\04\17&\18\1945\05\06\07\08\09\0A\0B\0C\0D\0E\1E\0F\10\11*\1A\1B\1C$3+>#%;<IJ=ADFEGH9KL\00\00\00C", align 32 ; <[84 x i8]*> [#uses=2]
%57 = getelementptr inbounds [84 x i8]* @yytable1095, i64 0, i64 %56 ; <i8*> [#uses=1]
%mode.0.in = getelementptr inbounds [9 x i32]* @mb_mode_table, i64 0, i64 %.pn ; <i32*> [#uses=1]
load ...
%64 = icmp eq i8 %58, 4 ; <i1> [#uses=1]
-> icmp eq i64 %.pn, 35 ; <i1> [#uses=0]
@gsm_DLB = internal constant [4 x i16] [i16 6554, i16 16384, i16 26214, i16 32767]
%scevgep.i = getelementptr [4 x i16]* @gsm_DLB, i64 0, i64 %indvar.i ; <i16*> [#uses=1]
%425 = load %scevgep.i
%426 = icmp eq i16 %425, -32768 ; <i1> [#uses=0]
-> false
llvm-svn: 92411
2010-01-02 08:12:04 +00:00
Chris Lattner
8fb74c6ee2
constant fold nasty constant expressions formed by llvm-gcc,
...
wrapping up PR3351.
llvm-svn: 92410
2010-01-02 01:22:23 +00:00
Chris Lattner
2e4be2c340
remove the instcombine transformations that are inserting nasty
...
pointer to int casts that confuse later optimizations. See PR3351
for details.
This improves but doesn't complete fix 483.xalancbmk because llvm-gcc
does this xform in GCC's "fold" routine as well. Clang++ will do
better I guess.
llvm-svn: 92408
2010-01-02 00:31:05 +00:00
Chris Lattner
909c71c96a
allow this to work on linux hosts.
...
llvm-svn: 92407
2010-01-02 00:22:15 +00:00
Chris Lattner
1eea3b0ada
Teach codegen to handle:
...
(X != null) | (Y != null) --> (X|Y) != 0
(X == null) & (Y == null) --> (X|Y) == 0
so that instcombine can stop doing this for pointers. This is part of PR3351,
which is a case where instcombine doing this for pointers (inserting ptrtoint)
is pessimizing code.
llvm-svn: 92406
2010-01-02 00:00:03 +00:00
Chris Lattner
6eef072eb6
rename file.
...
llvm-svn: 92405
2010-01-01 23:55:04 +00:00
Chris Lattner
24576a5cf3
whitespace cleanup
...
llvm-svn: 92404
2010-01-01 23:37:34 +00:00
Chris Lattner
faf1337acb
add a simple instcombine xform, simplify another one to use hasAllZeroIndices()
...
instead of hand rolling a loop.
llvm-svn: 92403
2010-01-01 23:09:08 +00:00
Chris Lattner
30c0a2833d
generalize the pointer difference optimization to handle
...
a constantexpr gep on the 'base' side of the expression.
This completes comment #4 in PR3351, which comes from
483.xalancbmk.
llvm-svn: 92402
2010-01-01 22:42:29 +00:00
Chris Lattner
4394f71752
teach instcombine to optimize pointer difference idioms involving constant
...
expressions. This is a step towards comment #4 in PR3351.
llvm-svn: 92401
2010-01-01 22:29:12 +00:00
Chris Lattner
9d4c5414bb
use 'match' to simplify some code.
...
llvm-svn: 92400
2010-01-01 22:12:03 +00:00
Chris Lattner
25c87e9cf9
implement the transform requested in PR5284
...
llvm-svn: 92398
2010-01-01 18:34:40 +00:00
Mikhail Glushenkov
5c35d2f6a4
Fix a warning on gcc 4.4.
...
SelectionDAGBuilder.cpp:4294: warning: suggest explicit braces to avoid
ambiguous ‘else’
llvm-svn: 92395
2010-01-01 04:41:36 +00:00
Mikhail Glushenkov
2abe1b70ac
Trailing whitespace, 80-col violations.
...
llvm-svn: 92394
2010-01-01 04:41:22 +00:00
Mikhail Glushenkov
8a52b77523
Minor simplifactions.
...
llvm-svn: 92393
2010-01-01 04:41:10 +00:00
Mikhail Glushenkov
9b0afc36a8
Typo.
...
llvm-svn: 92392
2010-01-01 04:40:54 +00:00
Mikhail Glushenkov
c4f17987b6
Make CheckForSuperfluousOptions handle list form of 'switch_on' correctly.
...
llvm-svn: 92391
2010-01-01 03:51:02 +00:00
Mikhail Glushenkov
8711c8dbcf
Minor simplifications.
...
llvm-svn: 92390
2010-01-01 03:50:51 +00:00
Mikhail Glushenkov
554c054777
Better error message.
...
llvm-svn: 92389
2010-01-01 03:50:34 +00:00
Chris Lattner
39f18e545e
Teach codegen to lower llvm.powi to an efficient (but not optimal)
...
multiply sequence when the power is a constant integer. Before, our
codegen for std::pow(.., int) always turned into a libcall, which was
really inefficient.
This should also make many gfortran programs happier I'd imagine.
llvm-svn: 92388
2010-01-01 03:32:16 +00:00
Chris Lattner
5967840a5f
Make this more likely to generate a libcall.
...
llvm-svn: 92387
2010-01-01 03:26:51 +00:00
Chris Lattner
ee1f861d81
add missing line.
...
llvm-svn: 92384
2010-01-01 01:54:08 +00:00
Chris Lattner
8330daf733
add a few trivial instcombines for llvm.powi.
...
llvm-svn: 92383
2010-01-01 01:52:15 +00:00
Chris Lattner
71cf7c256f
update this. To take the next step, llvm.powi should be generalized to work
...
on integers as well and codegen should lower them to branch trees.
llvm-svn: 92382
2010-01-01 01:29:26 +00:00
Chris Lattner
0c59ac3f41
When factoring multiply expressions across adds, factor both
...
positive and negative forms of constants together. This
allows us to compile:
int foo(int x, int y) {
return (x-y) + (x-y) + (x-y);
}
into:
_foo: ## @foo
subl %esi, %edi
leal (%rdi,%rdi,2), %eax
ret
instead of (where the 3 and -3 were not factored):
_foo:
imull $-3, 8(%esp), %ecx
imull $3, 4(%esp), %eax
addl %ecx, %eax
ret
this started out as:
movl 12(%ebp), %ecx
imull $3, 8(%ebp), %eax
subl %ecx, %eax
subl %ecx, %eax
subl %ecx, %eax
ret
This comes from PR5359.
llvm-svn: 92381
2010-01-01 01:13:15 +00:00
Chris Lattner
2f03e64094
test case we alredy get right.
...
llvm-svn: 92380
2010-01-01 00:50:00 +00:00
Ted Kremenek
504b7f8cc4
Remove old header.
...
llvm-svn: 92378
2010-01-01 00:04:49 +00:00
Chris Lattner
a552683fd4
clean up some comments.
...
llvm-svn: 92377
2010-01-01 00:04:26 +00:00
Chris Lattner
17229a7cb8
switch from std::map to DenseMap for rank data structures.
...
llvm-svn: 92375
2010-01-01 00:01:34 +00:00
Ted Kremenek
2fdca4b720
Remove derelict serialization code.
...
llvm-svn: 92374
2009-12-31 23:40:17 +00:00
Chris Lattner
fed3397654
reuse negates where possible instead of always creating them from scratch.
...
This allows us to optimize test12 into:
define i32 @test12(i32 %X) {
%factor = mul i32 %X, -3 ; <i32> [#uses=1]
%Z = add i32 %factor, 6 ; <i32> [#uses=1]
ret i32 %Z
}
instead of:
define i32 @test12(i32 %X) {
%Y = sub i32 6, %X ; <i32> [#uses=1]
%C = sub i32 %Y, %X ; <i32> [#uses=1]
%Z = sub i32 %C, %X ; <i32> [#uses=1]
ret i32 %Z
}
llvm-svn: 92373
2009-12-31 20:34:32 +00:00
Chris Lattner
60c2ca743d
we don't need a smallptrset to detect duplicates, the values are
...
sorted, so we can just do a linear scan.
llvm-svn: 92372
2009-12-31 19:49:01 +00:00
Chris Lattner
1d8979422a
make reassociate more careful about not leaving around dead mul's
...
llvm-svn: 92370
2009-12-31 19:34:45 +00:00
Chris Lattner
ed18917665
remove debug
...
llvm-svn: 92369
2009-12-31 19:25:19 +00:00
Chris Lattner
60b71b5c4d
teach reassociate to factor x+x+x -> x*3. While I'm at it,
...
fix RemoveDeadBinaryOp to actually do something.
llvm-svn: 92368
2009-12-31 19:24:52 +00:00
Chris Lattner
38abecbad0
change reassociate to use SmallVector for its key datastructures
...
instead of std::vector.
llvm-svn: 92366
2009-12-31 18:40:32 +00:00
Chris Lattner
ac61550504
change an if to an assert, fix comment.
...
llvm-svn: 92364
2009-12-31 18:18:46 +00:00
Chris Lattner
177140ad12
move the rest of the add optimization code out to OptimizeAdd,
...
improve some comments, simplify a bit of code.
llvm-svn: 92363
2009-12-31 18:17:13 +00:00
Chris Lattner
ba1f36aa99
factor statistic updating better.
...
llvm-svn: 92362
2009-12-31 17:51:05 +00:00
Benjamin Kramer
738800dd1d
Silence compiler warning.
...
warning: comparison between signed and unsigned integer expressions
llvm-svn: 92359
2009-12-31 16:27:13 +00:00
Chris Lattner
4e3a5678af
simple fix for an incorrect factoring which causes a
...
miscompilation, PR5458.
llvm-svn: 92354
2009-12-31 08:33:49 +00:00
Chris Lattner
2d3b53a68c
merge some more tests in.
...
llvm-svn: 92353
2009-12-31 08:32:22 +00:00
Chris Lattner
19a4baa201
filecheckize
...
llvm-svn: 92352
2009-12-31 08:29:56 +00:00
Chris Lattner
d5bace7092
fix refactoro
...
llvm-svn: 92349
2009-12-31 08:23:09 +00:00
Chris Lattner
5f8a005d38
factor code out into helper functions.
...
llvm-svn: 92347
2009-12-31 07:59:34 +00:00
Chris Lattner
f5c2b8b8d7
switch some std::vector's to smallvector. Reduce nesting.
...
llvm-svn: 92346
2009-12-31 07:48:51 +00:00
Chris Lattner
9039ff8912
use more modern datastructures.
...
llvm-svn: 92344
2009-12-31 07:33:14 +00:00
Chris Lattner
bc1512c8d1
clean up -debug output.
...
llvm-svn: 92343
2009-12-31 07:17:37 +00:00
Douglas Gregor
5639af4eac
Document the edit-distance algorithm used in StringRef, switch it over
...
to SmallVector, and add a unit test.
llvm-svn: 92340
2009-12-31 04:24:34 +00:00
Chris Lattner
5e9aca4c5d
this #include is ok.
...
llvm-svn: 92338
2009-12-31 03:02:42 +00:00
Chris Lattner
6a0ca6aa90
fix Analysis/DebugInfo.h to not include Metadata.h. Do this
...
by moving one method out of line and eliminating redundant checks
from other methods.
llvm-svn: 92337
2009-12-31 03:02:08 +00:00
Chris Lattner
cac432c846
add some basic named MD tests.
...
llvm-svn: 92336
2009-12-31 03:00:49 +00:00
Chris Lattner
b419a1e44f
use early exits to reduce indentation.
...
llvm-svn: 92335
2009-12-31 02:33:14 +00:00
Chris Lattner
cdec581a35
eliminate another copy of the mdnode printing logic, simplify the
...
one that remains.
llvm-svn: 92334
2009-12-31 02:31:59 +00:00
Chris Lattner
0d50bddda6
random tidying for MDNode printing.
...
llvm-svn: 92333
2009-12-31 02:27:30 +00:00
Chris Lattner
efb5e39428
eliminate a bunch of useless forwarding functions with one caller.
...
llvm-svn: 92332
2009-12-31 02:23:35 +00:00
Chris Lattner
cf4a76e441
make mdnMap type safe, rename accessors for consistency with the rest of llvm.
...
llvm-svn: 92331
2009-12-31 02:20:11 +00:00
Chris Lattner
01635a8428
metadata can't be a global var initializer.
...
llvm-svn: 92330
2009-12-31 02:15:45 +00:00
Chris Lattner
bddea6a530
simplify mdnode printing logic. Now N->dump() only
...
dumps one node instead of all of them.
llvm-svn: 92329
2009-12-31 02:13:35 +00:00
Chris Lattner
1e6e36785e
don't unittest mdnode printing, we have disassembler tests for this.
...
llvm-svn: 92328
2009-12-31 02:12:13 +00:00
Chris Lattner
2c48c64821
unify two copies of the NamedMDNode printing code.
...
llvm-svn: 92327
2009-12-31 01:54:05 +00:00
Chris Lattner
b9196679f9
fix printing of function-local metadata to print all the operands of the
...
mdnode, not just operand 0 over and over.
llvm-svn: 92326
2009-12-31 01:44:44 +00:00
Chris Lattner
31fcc28a84
simplify printing of mdstring and Argument.
...
llvm-svn: 92325
2009-12-31 01:41:14 +00:00
Chris Lattner
be2de79b77
simplify asmprinting of NamedMDNode
...
llvm-svn: 92324
2009-12-31 01:36:50 +00:00
Chris Lattner
cc8c8146d2
Remove #include of metadata.h from intrinsicinst.h. The only
...
method that needs it (DbgValueInst::getValue) has been moved out
of line.
llvm-svn: 92323
2009-12-31 01:32:41 +00:00
Chris Lattner
9b493028df
rename "elements" of metadata to "operands". "Elements" are
...
things that occur in types. "operands" are things that occur
in values.
llvm-svn: 92322
2009-12-31 01:22:29 +00:00
Chris Lattner
8cb6c3476d
Optimize MDNode to coallocate the operand list immediately
...
after the MDNode in memory. This eliminates the operands
pointer and saves a new[] per node.
Note that the code in DIDerivedType::replaceAllUsesWith is wrong
and quite scary. A MDNode should not be RAUW'd with something
else: this changes all uses of the mdnode, which may not be debug
info related! Debug info should use something non-mdnode for
declarations.
llvm-svn: 92321
2009-12-31 01:05:46 +00:00
Chris Lattner
8dace893fa
tidy
...
llvm-svn: 92320
2009-12-31 00:51:46 +00:00
Chris Lattner
30ae06be14
do not bother reuniquing mdnodes whose operands drop to null. Doing
...
so can be a huge performance issue when tearing down modules and mdnodes
are not guaranteed to be unique anyway. This speeds up:
$ time ~/llvm/Release/bin/clang gcc.c -w -S -g
from 72 to 35s, where gcc.c is from:
http://people.csail.mit.edu/smcc/projects/single-file-programs/
llvm-svn: 92315
2009-12-30 21:42:11 +00:00
Chris Lattner
09660c9b06
remove some misleading comments.
...
llvm-svn: 92311
2009-12-30 20:25:09 +00:00
Douglas Gregor
165882c240
Implement edit distance for StringRef
...
llvm-svn: 92309
2009-12-30 17:23:44 +00:00
Chris Lattner
16bafa6f14
remove some fixme's
...
llvm-svn: 92304
2009-12-30 06:00:36 +00:00
Chris Lattner
c5c08899e4
fix two bogus tests that the asmparser now rejects.
...
llvm-svn: 92303
2009-12-30 05:54:51 +00:00
Chris Lattner
94b9c5a73b
now that instruction metadata is only parsed in one place, eliminate the
...
parser-global MDsOnInst vector and make ParseInstructionMetadata return
its result by-ref through an argument like the entire rest of the parser.
llvm-svn: 92302
2009-12-30 05:48:36 +00:00
Chris Lattner
b2f3950da7
reimplement ParseOptionalInfo as ParseOptionalCommaAlign, correctly
...
handle the comma case for metadata.
llvm-svn: 92301
2009-12-30 05:44:30 +00:00
Chris Lattner
5c42763452
rename ParseOptionalCustomMetadata -> ParseInstructionMetadata,
...
and make it non-optional. This fixes the bug where we'd accept
and ignore a spurious comma after some instructions.
llvm-svn: 92300
2009-12-30 05:31:19 +00:00
Chris Lattner
f4f0342b08
convert 4 more instructions over.
...
llvm-svn: 92299
2009-12-30 05:27:33 +00:00
Chris Lattner
77b89dc58b
add facilities to start factoring instruction metadata parsing
...
out of each opcode's handler. Change ret over so far.
llvm-svn: 92298
2009-12-30 05:23:43 +00:00
Chris Lattner
28f1eebe3e
reimplement insertvalue/extractvalue metadata handling to not blindly
...
accept invalid input. Actually add a testcase.
llvm-svn: 92297
2009-12-30 05:14:00 +00:00
Chris Lattner
bafee45d2c
remove two bogus calls that accepted metadata in the middle of insert/extract value
...
*constant exprs*.
llvm-svn: 92296
2009-12-30 05:04:46 +00:00
Chris Lattner
eafe4de021
rename NamedOrCustomMD -> MetadataVar to follow conventions of all the rest of the code.
...
llvm-svn: 92295
2009-12-30 05:02:06 +00:00