Commit Graph

52345 Commits

Author SHA1 Message Date
Dan Gohman ea1086b7f2 PR2659 was fixed by r61847. Add the testcase as a regression test.
llvm-svn: 61986
2009-01-09 08:16:12 +00:00
Chris Lattner f50aa6ae5c Implement rdar://6480391, extending of equality icmp's to avoid a truncation.
I noticed this in the code compiled for a routine using std::map, which produced
this code:
	%25 = tail call i32 @memcmp(i8* %24, i8* %23, i32 6) nounwind readonly
	%.lobit.i = lshr i32 %25, 31		; <i32> [#uses=1]
	%tmp.i = trunc i32 %.lobit.i to i8		; <i8> [#uses=1]
	%toBool = icmp eq i8 %tmp.i, 0		; <i1> [#uses=1]
	br i1 %toBool, label %bb3, label %bb4
which compiled to:

	call	L_memcmp$stub
	shrl	$31, %eax
	testb	%al, %al
	jne	LBB1_11	## 

with this change, we compile it to:

	call	L_memcmp$stub
	testl	%eax, %eax
	js	LBB1_11

This triggers all the time in common code, with patters like this:

	%169 = and i32 %ply, 1		; <i32> [#uses=1]
	%170 = trunc i32 %169 to i8		; <i8> [#uses=1]
	%toBool = icmp ne i8 %170, 0		; <i1> [#uses=1]

 	%7 = lshr i32 %6, 24		; <i32> [#uses=1]
	%9 = trunc i32 %7 to i8		; <i8> [#uses=1]
	%10 = icmp ne i8 %9, 0		; <i1> [#uses=1]

etc

llvm-svn: 61985
2009-01-09 07:47:06 +00:00
Chris Lattner 0f7cf1d7e1 Remove some old code that looks like a remanant from signed-types days.
llvm-svn: 61984
2009-01-09 07:10:58 +00:00
Chris Lattner 482eb70a10 Fix PR3298, a crash in Jump Threading. Apparently even
jump threading can have bugs, who knew? ;-)

llvm-svn: 61983
2009-01-09 06:08:12 +00:00
Chris Lattner d48d1ec320 this doesn't depend on the gcc early inliner anymore.
llvm-svn: 61982
2009-01-09 05:49:27 +00:00
Chris Lattner 7f88a1b512 PR3290 is now fixed.
llvm-svn: 61981
2009-01-09 05:46:19 +00:00
Chris Lattner fef138b140 Fix part 3/2 of PR3290, making instcombine zap (gep(bitcast)) when possible.
llvm-svn: 61980
2009-01-09 05:44:56 +00:00
Chris Lattner 9170731cb7 this test should not run opt -std-compile-opts, it should run
just llc.

llvm-svn: 61979
2009-01-09 05:32:00 +00:00
Chris Lattner 8b80ed7bf7 add a helper method.
llvm-svn: 61978
2009-01-09 05:27:40 +00:00
Chris Lattner 729a21f947 fit in 80 cols
llvm-svn: 61977
2009-01-09 04:58:01 +00:00
Chris Lattner a784a2ce01 move some code, check to see if the input to the GEP is a bitcast
(which is constant time and cheap) before checking hasAllZeroIndices.

llvm-svn: 61976
2009-01-09 04:53:57 +00:00
Chris Lattner c7c9ab7947 Fix rdar://6480479 - [parser] infinite loop on invalid input
llvm-svn: 61975
2009-01-09 04:34:13 +00:00
Daniel Dunbar cc1b6e8fce Convert block types in IRgen. This is not the correct type, but
matches llvm-gcc (?).

llvm-svn: 61974
2009-01-09 02:48:46 +00:00
Daniel Dunbar 9b21e63251 Block pointer types are not aggregate types.
llvm-svn: 61973
2009-01-09 02:44:18 +00:00
Dan Gohman bdc0f8b627 Add load-folding table entries for MOVDQA.
llvm-svn: 61972
2009-01-09 02:40:34 +00:00
Dan Gohman e907a0a527 Whitespace and other minor adjustments to make SSE instructions have
the same formatting as their corresponding SSE2 instructions, for
consistency.

llvm-svn: 61971
2009-01-09 02:27:34 +00:00
Douglas Gregor 1e21c19be6 Don't crash when our FunctionDecl has a non-identifier name
llvm-svn: 61970
2009-01-09 01:47:02 +00:00
Dale Johannesen 4755d9df78 Adjustments to last patch based on review.
llvm-svn: 61969
2009-01-09 01:30:11 +00:00
Daniel Dunbar f4c6616d9d Fix crash on null deference when searching for readwrite properties in
categories.
 - Also, simplify nesting via early return.

llvm-svn: 61968
2009-01-09 01:04:21 +00:00
Daniel Dunbar a3491665a6 ccc: Start defining host information.
- For use by the driver in places where the host alters driver
   behavior (for example, running as a driver driver on darwin).

 - Allow user override for testing purposes.

llvm-svn: 61967
2009-01-09 01:00:40 +00:00
Douglas Gregor c25d7a7fe0 Addressed the issue in <rdar://problem/6479085>, where we failed to
rewrite @class declarations that showed up within linkage
specifications because those @class declarations never made it any
place where the rewriter could find them.

Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can
live in the appropriate top-level or transparent DeclContext near the
top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C
declarations now show up in a traversal of the declarations in a
DeclContext (they didn't before!). This way, the rewriter finds all
Objective-C declarations within linkage specifications.

llvm-svn: 61966
2009-01-09 00:49:46 +00:00
Ted Kremenek 339153d3be Re-enable PTH testing for Cocoa.h and Carbon.h (and include testing for Objective-C++).
llvm-svn: 61965
2009-01-09 00:41:48 +00:00
Fariborz Jahanian e84858ccf9 Adding support for ObjC methods which have c-style
parameter list. This is work in progress.

llvm-svn: 61964
2009-01-09 00:38:19 +00:00
Ted Kremenek b54c19a754 Enable support for '-x objective-c++-header'.
llvm-svn: 61963
2009-01-09 00:38:08 +00:00
Ted Kremenek 6697945069 Simpler solution to LiteralSupport compatibility: just add one whitespace character after each cached string.
llvm-svn: 61962
2009-01-09 00:37:37 +00:00
Ted Kremenek 8ae06625b5 Invert assertion condition.
llvm-svn: 61961
2009-01-09 00:36:11 +00:00
Ted Kremenek cb5a95f3a4 Temporarily revert r61956 and r61957 (PTH tests failing).
llvm-svn: 61960
2009-01-09 00:27:29 +00:00
Dan Gohman 68b135cc9c 61949 accidentally introduced an escaped newline. Fix this by making
the comment a little more verbose.

llvm-svn: 61959
2009-01-08 23:51:48 +00:00
Ted Kremenek 510b4da49d Enhance -fsyntax-only test of Carbon.h to also include testing for PTH.
llvm-svn: 61958
2009-01-08 23:42:56 +00:00
Ted Kremenek 8598addcd7 Enhance -fsyntax-only test of Cocoa.h to also include testing for PTH.
llvm-svn: 61957
2009-01-08 23:41:35 +00:00
Ted Kremenek d4a4fd99de PTH: For the cached spellings of literals, store one whitespace character after the spelling to accomodate sanity checking in LiteralSuppoert.cpp.
llvm-svn: 61956
2009-01-08 23:40:50 +00:00
Devang Patel f646668799 Convert DwarfWriter into a pass.
Now Users request DwarfWriter through getAnalysisUsage() instead of creating an instance of DwarfWriter object directly.

llvm-svn: 61955
2009-01-08 23:40:34 +00:00
Anders Carlsson bfd47a3c00 Add mm_malloc.h, patch by Sam Weinig.
llvm-svn: 61954
2009-01-08 23:30:09 +00:00
Fariborz Jahanian d11dc0b1d9 Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.

llvm-svn: 61953
2009-01-08 23:23:10 +00:00
Douglas Gregor e4b414c781 Revert my previous, failed attempt to pretty-print anonymous struct/union accesses well. Added a FIXME so we know to revisit this later
llvm-svn: 61951
2009-01-08 22:45:41 +00:00
Dan Gohman f87dc9264a Delete unnecessary parens around return values.
llvm-svn: 61950
2009-01-08 22:19:34 +00:00
Dan Gohman 138436f158 Fix the comment for lltok::backslash.
llvm-svn: 61949
2009-01-08 22:18:13 +00:00
Dan Gohman 6031a4353b Fix the path to llvm/Assembly/Parser.h in a comment.
llvm-svn: 61948
2009-01-08 22:17:05 +00:00
Dan Gohman 385d246e0d Correct the form of the atomic opcode names in a comment.
llvm-svn: 61947
2009-01-08 22:14:50 +00:00
Dale Johannesen b48fc71fc6 Do not inline functions with (dynamic) alloca into
functions that don't already have a (dynamic) alloca.
Dynamic allocas cause inefficient codegen and we shouldn't
propagate this (behavior follows gcc).  Two existing tests
assumed such inlining would be done; they are hacked by
adding an alloca in the caller, preserving the point of
the tests.

llvm-svn: 61946
2009-01-08 21:45:23 +00:00
Duncan Sands 715b2897d8 Use mayBeOverridden here, in anticipation of the
day when more linkage types will be handled.

llvm-svn: 61944
2009-01-08 20:55:49 +00:00
Ted Kremenek 0667123ba1 Fix ObjCInterfaceDecl::Destroy and ObjCProtocolDecl::Destroy to iterate and destroy all contained ObjCMethodDecls in one sweep. This fixes a use-after-free error found by valgrind.
llvm-svn: 61943
2009-01-08 20:49:27 +00:00
Douglas Gregor c8938e09ca Remove double-insertion of EnumConstantDecls. Thanks to Zhongxing Xu for pointing this out
llvm-svn: 61942
2009-01-08 20:48:26 +00:00
Ted Kremenek 48ed48212d Added iterator mechanism to ObjCContainerDecl to iterate over both class and instance methods at the same time.
llvm-svn: 61941
2009-01-08 20:48:19 +00:00
Douglas Gregor 82ac25e4a7 Unify the code for defining tags in C and C++, so that we always
introduce a Scope for the body of a tag. This reduces the number of
semantic differences between C and C++ structs and unions, and will
help with other features (e.g., anonymous unions) in C. Some important
points:

  - Fields are now in the "member" namespace (IDNS_Member), to keep
    them separate from tags and ordinary names in C. See the new test
    in Sema/member-reference.c for an example of why this matters. In
    C++, ordinary and member name lookup will find members in both the
    ordinary and member namespace, so the difference between
    IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but
    only in C++!). 
  - We always introduce a Scope and push a DeclContext when we're
    defining a tag, in both C and C++. Previously, we had different
    actions and different Scope/CurContext behavior for enums, C
    structs/unions, and C++ structs/unions/classes. Now, it's one pair
    of actions. (Yay!)

There's still some fuzziness in the handling of struct/union/enum
definitions within other struct/union/enum definitions in C. We'll
need to do some more cleanup to eliminate some reliance on CurContext
before we can solve this issue for real. What we want is for something
like this:

  struct X {
    struct T { int x; } t;
  };

to introduce T into translation unit scope (placing it at the
appropriate point in the IdentifierResolver chain, too), but it should
still have struct X as its lexical declaration
context. PushOnScopeChains isn't smart enough to do that yet, though,
so there's a FIXME test in nested-redef.c

llvm-svn: 61940
2009-01-08 20:45:30 +00:00
Steve Naroff 40e1fd1f79 Add missing castToDeclContext/castFromDeclContext hooks.
llvm-svn: 61939
2009-01-08 20:35:58 +00:00
Steve Naroff 5ca5f4bc0a Remove a dead decl.
llvm-svn: 61938
2009-01-08 20:22:04 +00:00
Steve Naroff 6c879a1448 Move FIXME to a better location.
llvm-svn: 61937
2009-01-08 20:17:34 +00:00
Steve Naroff e538c5f3ae Removed ObjCContainerDecl::getPropertyMethods()...doesn't belong in the AST.
Moved logic to Sema::ProcessPropertyDecl().

llvm-svn: 61936
2009-01-08 20:15:03 +00:00
Steve Naroff 11b387fee0 Remove redundant method context (now that ObjCMethodDecl isa ScopedDecl).
Convert clients to use the standard getDeclContext() API.

Doug, thanks for the review!

llvm-svn: 61935
2009-01-08 19:41:02 +00:00