Commit Graph

104988 Commits

Author SHA1 Message Date
Lenny Maiorani ed2cc6ccbb Eliminates an assert in the strncpy/strncat checker caused by not validating a cast was successful. If the value of an argument was unknown, the cast would result in a NULL pointer which was later being dereferenced.
This fixes Bugzilla #9806.

llvm-svn: 130422
2011-04-28 18:59:43 +00:00
Argyrios Kyrtzidis e07425a5e7 When value-initializing the elements of an array not not included in the initializer make sure
that a non-trivial C++ constructor gets called.

Fixes rdar://9347552 & http://llvm.org/PR9801

llvm-svn: 130421
2011-04-28 18:53:58 +00:00
Argyrios Kyrtzidis fddbcfbec4 Don't waste memory if the initializer expression is empty.
llvm-svn: 130420
2011-04-28 18:53:55 +00:00
Devang Patel 33d87d97f6 Do not lose line number info while eliminating tail call.
llvm-svn: 130419
2011-04-28 18:43:39 +00:00
Eli Friedman 3cf6d4032a Actually revert r130348 correctly.
llvm-svn: 130418
2011-04-28 18:20:24 +00:00
Stuart Hastings 4b21495e42 Replace SmallVector with an array, as suggested by Frits van Bommel. rdar://problem/7662569
llvm-svn: 130417
2011-04-28 18:16:06 +00:00
Chris Lattner 1777601a74 final step needed to resolve PR6627, which allows us to flatten the code down to
a nice and tidy:
  %x1 = load i32* %0, align 4
  %1 = icmp eq i32 %x1, 1179403647
  br i1 %1, label %if.then, label %if.end

instead of doing lots of loads and branches.  May the FreeBSD bootloader
long fit in its allocated space.

llvm-svn: 130416
2011-04-28 18:15:47 +00:00
Chris Lattner 45e393fc9c code cleanups only.
llvm-svn: 130414
2011-04-28 18:08:21 +00:00
Eli Friedman d5a80ca3c8 Revert r130348; causing buildbot issues on x86-32.
llvm-svn: 130412
2011-04-28 18:06:10 +00:00
Douglas Gregor d517d55484 When determining whether two types are reference-compatible, check
non-CVR qualifiers as well as CVR qualifiers. For example, don't allow
a reference to an integer in address space 1 to bind to an integer in
address space 2.

llvm-svn: 130411
2011-04-28 17:56:11 +00:00
Owen Anderson 715973fc6c Fix a bug in tblgen that caused incorrect encodings on instructions that specified operands with "bit" instead of "bits<1>".
Unfortunately, my only testcase for this is fragile, and the ARM AsmParser can't round trip the instruction in question.
<rdar://problem/9345702>

llvm-svn: 130410
2011-04-28 17:51:45 +00:00
Devang Patel b63596436f Add command line option to print debug info in human readable form as comment in llvm IR output. This, i.e -enable-debug-info-comment, is very useful if you want to easily find out which optimization pass is losing line number information.
llvm-svn: 130409
2011-04-28 17:41:38 +00:00
Andrew Trick c4456ae6ec Reapply r130340: Fix for PR9730.
llvm-svn: 130408
2011-04-28 17:30:04 +00:00
Manuel Klimek 7030b869a0 Fixes ArrayTypeTraitExpr (-Wnon-virtual-dtor).
llvm-svn: 130407
2011-04-28 17:03:03 +00:00
Benjamin Kramer 4145c0d3b1 InstCombine: Merge "(trunc x) == C1 & (and x, CA) == C2" into a single and+icmp.
This happens when GVN widens loads. Part of PR6627.

llvm-svn: 130405
2011-04-28 16:58:40 +00:00
Eric Christopher 4f012fd0a1 Be more layout aware here and swap the successor and branch condition
if it means we get a fallthrough.

llvm-svn: 130404
2011-04-28 16:52:09 +00:00
Chris Lattner f81f789b6c centralize "marking for deletion" into a helper function. Pass GVN around to
static functions instead of passing around tons of random ivars.

llvm-svn: 130403
2011-04-28 16:36:48 +00:00
Douglas Gregor b6100f2bdc Only call the MacroExpands callback when we're actually going to
expand the macro, based on a patch by Ori Avtalion. Fixes PR9799.

llvm-svn: 130402
2011-04-28 16:36:13 +00:00
Chris Lattner 6cec6ab275 Promote toErase to be an ivar of the GVN class.
llvm-svn: 130401
2011-04-28 16:18:52 +00:00
Rafael Espindola c5dac4df2e Add a getExprForPersonalitySymbol method to MCAsmInfo. Use it when
converting the symbol passed to .cfi_personality into bytes is the file.

llvm-svn: 130400
2011-04-28 16:09:09 +00:00
Douglas Gregor 068730992c libstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
as a keyword for the __is_signed type trait. Cope with this conflict
via some hackish recovery: if we see a declaration of the form

 static const bool __is_signed

then we stop treating __is_signed as a keyword and instead treat it as
an identifier. It's ugly, but it's better than making the __is_signed
type trait conditional on some language flag. Fixes PR9804.

llvm-svn: 130399
2011-04-28 15:48:45 +00:00
Lenny Maiorani 4af23c8159 Implements strcasecmp() checker in Static Analyzer.
llvm-svn: 130398
2011-04-28 15:09:11 +00:00
Rafael Espindola 349c3298da Mark the EH symbol global or weak if the corresponding function is.
llvm-svn: 130397
2011-04-28 12:50:37 +00:00
Jay Foad 07ef11112e Fix typos in comments.
llvm-svn: 130396
2011-04-28 09:12:47 +00:00
Chandler Carruth 93da3c8233 Fix the last -Wnon-pod-memset I'm seeing. This is benign, but appears
a bit more sinister as the memset doesn't do what the constructor does.
There seems to be a cleaner solution than a cast here though, instead we
can point the memset destination into the union its actually trying to
clear.

An alternative is to point to the Untyped member of this union. Review
appreciated, and if that is cleaner I'm happy to switch. All of these
should be functionally equivalent to the original code.

llvm-svn: 130395
2011-04-28 08:37:18 +00:00
Chandler Carruth 6e1f9babcd Silence more -Wnon-pod-memset given its current implementation. I may be
able to revert these based on a patch I'm working on, but no reason for
people to be spammed with warnings in the interim.

llvm-svn: 130394
2011-04-28 08:19:45 +00:00
Chandler Carruth 3f7b581e2f Revert an unintended commit. Very sorry for this one.
llvm-svn: 130393
2011-04-28 08:18:22 +00:00
Chandler Carruth 0c2bef1716 Fix more -Wnon-pod-memset warnings.
llvm-svn: 130392
2011-04-28 08:17:08 +00:00
Chandler Carruth e63a7b21f6 nuke gold
llvm-svn: 130391
2011-04-28 08:17:05 +00:00
Chris Lattner 827a270a2a teach GVN to widen integer loads when they are overaligned, when doing an
wider load would allow elimination of subsequent loads, and when the wider
load is still a native integer type.  This eliminates a ton of loads on 
various benchmarks involving struct fields, though it is somewhat hobbled
by clang not being very aggressive about field alignment.

This is yet another step along the way towards resolving PR6627.

llvm-svn: 130390
2011-04-28 07:29:08 +00:00
Anton Korobeynikov df5c1b77db Add BTT directory structure to polly
llvm-svn: 130389
2011-04-28 07:28:28 +00:00
Ted Kremenek 4c62882604 Add comment to CFGBlock suggested by Jiri Slaby.
llvm-svn: 130387
2011-04-28 06:19:35 +00:00
Eric Christopher a98cd22d96 Let the immediate leaf pattern take transforms and switch the signed
immediate patterns in arm to using the pattern.

Handles rdar://9299434

llvm-svn: 130386
2011-04-28 05:49:04 +00:00
Chris Lattner 2a75c72e1c move PR9803 to this readme.
llvm-svn: 130385
2011-04-28 05:33:16 +00:00
Francois Pichet fc15ae466c Update r130381 to check for UO_AddrOf.
llvm-svn: 130384
2011-04-28 05:12:34 +00:00
Ted Kremenek f5df0ce949 Enhance clang_getCXTUResourceUsage() to report the amount of memory used by ASTContext's side tables.
llvm-svn: 130383
2011-04-28 04:53:38 +00:00
Ted Kremenek 2901731553 Add utility method to DenseMap to return the amount of memory used for its buckets.
llvm-svn: 130382
2011-04-28 04:52:57 +00:00
Francois Pichet a1c1352a36 Support &__uuidof(type) as a non type template argument.
This idiom is used everywhere in MFC/COM code and as such this patch removes hundreds of errors when parsing MFC code with clang.

Example: 
template <class T, const GUID* g = &__uuidof(T)>
class ComTemplate  { };

typedef ComTemplate<struct_with_uuid, &__uuidof(struct_with_uuid)> COM_TYPE;

Of course this is just parsing support. Trying to use this in CodeGen will generate:
error: cannot yet mangle expression type CXXUuidofExpr

llvm-svn: 130381
2011-04-28 04:39:50 +00:00
Ted Kremenek 21735e608d Enhance clang_getCXTUResourceUsage() to report the amount of memory used by SourceManager's content cache allocator.
llvm-svn: 130380
2011-04-28 04:10:31 +00:00
Rafael Espindola 2eeee8cfef Add a small temporary hack for producing identical eh_frame sections on OS X.
This removes one of the main advantages of moving eh_frame to MC, but
makes the transition a lot easier to debug (run md5).

llvm-svn: 130379
2011-04-28 04:04:14 +00:00
Rafael Espindola bf60fb0a37 Produce the EH_frame# symbols if needed.
llvm-svn: 130378
2011-04-28 03:26:11 +00:00
Francois Pichet bfaf477a99 SEH was crashing under -fms-extensions.
llvm-svn: 130377
2011-04-28 03:14:31 +00:00
John McCall 7f0a0d55c0 Implement the mangling for non-ADL call expressions that we just
worked out.

llvm-svn: 130376
2011-04-28 02:52:03 +00:00
Rafael Espindola 96b07932a3 Forward isFunctionEHFrameSymbolPrivate. If it is false, produce the foo.eh
symbols.

llvm-svn: 130375
2011-04-28 02:46:42 +00:00
Devang Patel 4a14cd9cf9 Test case for r130373.
llvm-svn: 130374
2011-04-28 02:23:17 +00:00
Devang Patel 3e021533cd Teach dwarf writer to handle complex address expression for .debug_loc entries.
This fixes clang generated blocks' variables' debug info.
Radar 9279956.

llvm-svn: 130373
2011-04-28 02:22:40 +00:00
John McCall a85af56e66 When block-capturing a variable with a non-trivial destructor,
make sure to mark the destructor.  This normally isn't required,
because the destructor should have been marked as part of the
declaration of the local, but it's necessary when the variable
is a parameter because it's the call sites that are responsible
for those destructors.

llvm-svn: 130372
2011-04-28 02:15:35 +00:00
John Wiegley d352222839 A few corrections to type traits that missed the last checkin
llvm-svn: 130371
2011-04-28 02:06:46 +00:00
Francois Pichet 4c3b68c366 Because of r130359 this test no longer fail on Windows.
llvm-svn: 130370
2011-04-28 02:01:57 +00:00
Francois Pichet 84133e41be Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines to real types.
Otherwise statements like:
  __int64 var = __int64(0);

would be expanded to:
  long long var = long long(0);

and fail to compile.

llvm-svn: 130369
2011-04-28 01:59:37 +00:00