Commit Graph

75194 Commits

Author SHA1 Message Date
Douglas Gregor 9882a5aac6 Teach Preprocessor::macro_begin/macro_end to lazily load all macro
definitions from a precompiled header. This ensures that
code-completion with macro names behaves the same with or without
precompiled headers.

llvm-svn: 92497
2010-01-04 19:18:44 +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
Daniel Dunbar d443c0a02a Revert r92431, this code isn't dead and broke the ntfs build.
llvm-svn: 92493
2010-01-04 18:47:06 +00:00
Dan Gohman fc76441623 Add a comment.
llvm-svn: 92492
2010-01-04 18:38:39 +00:00
Daniel Dunbar 5b9019515a Fix -Asserts warning.
llvm-svn: 92491
2010-01-04 18:02:28 +00:00
David Greene 96b90539d6 Change errs() to dbgs().
llvm-svn: 92490
2010-01-04 17:47:05 +00:00
Douglas Gregor 40f7a007e9 When declaring an Objective-C implementation without a corresponding
interface, suggest correction of typos. For example, given:

  @interface NSString
  @end

  @implementation NSstring
  @end

we'll warn with:

t.m:4:19: warning: cannot find interface declaration for 'NSstring';
    did you mean 'NSString'?
  @implementation NSstring
                  ^

However, since this is just a warning, we don't provide a fix-it
hint. Good idea, Ted!

llvm-svn: 92488
2010-01-04 17:27:12 +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
Benjamin Kramer 0128f668a9 __builtin_object_size(ptr, type) returns -1 for type = {0,1} if there are any side-effects.
llvm-svn: 92453
2010-01-03 18:18:37 +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
Douglas Gregor 35b0bac8c5 Implement typo correction for a variety of Objective-C-specific
constructs:

  - Instance variable lookup ("foo->ivar" and, in instance methods, "ivar")
  - Property name lookup ("foo.prop")
  - Superclasses
  - Various places where a class name is required
  - Protocol names (e.g., id<proto>)

This seems to cover many of the common places where typos could occur.

llvm-svn: 92449
2010-01-03 18:01:57 +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
Eli Friedman c6f59b1c49 Better coverage for -dump-record-layouts and -print-decl-contexts.
llvm-svn: 92441
2010-01-03 02:01:11 +00:00
Eli Friedman 50f6aa11cf Improve coverage for test.
llvm-svn: 92440
2010-01-03 01:20:41 +00:00
Eli Friedman 6257e08a3d Get rid of more dead code.
llvm-svn: 92439
2010-01-03 01:11:47 +00:00
Nick Lewycky ff9cd7ace7 Cleanup.
llvm-svn: 92436
2010-01-03 00:55:31 +00:00
Eli Friedman 906be1b580 Add test for annotate attribute for coverage.
llvm-svn: 92435
2010-01-03 00:51:58 +00:00
Eli Friedman 090adddf15 Fix minor oversight for increment/decrement of complex int. Add tests for
coverage.

llvm-svn: 92433
2010-01-03 00:20:48 +00:00
Eli Friedman c52a9367b3 Get rid of some unnecessary code.
llvm-svn: 92432
2010-01-02 23:43:59 +00:00
Eli Friedman 14e4005851 Delete impossible case.
llvm-svn: 92431
2010-01-02 23:28:56 +00:00
Eli Friedman bb333722c1 Add a couple more tests for coverage.
llvm-svn: 92430
2010-01-02 23:21:40 +00:00
Eli Friedman 81390dfcfd Get rid of more unnecessary code.
llvm-svn: 92429
2010-01-02 22:56:07 +00:00
Eli Friedman 5906ea4f76 Get rid of some unnecessary code.
llvm-svn: 92428
2010-01-02 22:43:56 +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
Eli Friedman d423dcc9bd Eliminate dead code.
llvm-svn: 92424
2010-01-02 21:44:36 +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