Commit Graph

131459 Commits

Author SHA1 Message Date
Ted Kremenek 7c88d2ae0f Teach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min
llvm-svn: 161443
2012-08-07 19:27:08 +00:00
Dmitri Gribenko 168d23414a Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.

llvm-svn: 161442
2012-08-07 18:59:04 +00:00
Jakob Stoklund Olesen 84689b0d5a Add a new kind of MachineOperand: MO_TargetIndex.
A target index operand looks a lot like a constant pool reference, but
it is completely target-defined. It contains the 8-bit TargetFlags, a
32-bit index, and a 64-bit offset. It is preserved by all code generator
passes.

TargetIndex operands can be used to carry target-specific information in
cases where immediate operands won't suffice.

llvm-svn: 161441
2012-08-07 18:56:39 +00:00
Anna Zaks f0267f5c9e Turn on strncat-size warning implemented a while ago.
Warns on anti-patterns/typos in the 'size' argument to strncat. The
correct size argument should look like the following:
 - strncat(dst, src, sizeof(dst) - strlen(dest) - 1);

We warn on: 
 - sizeof(dst)
 - sizeof(src)
 - sizeof(dst) - strlen(dst)
 - sizeof(src) - anything

(This has been implemented in void Sema::CheckStrncatArguments().)

llvm-svn: 161440
2012-08-07 18:36:58 +00:00
Dmitri Gribenko 815f72bac7 c-index-test Makefile: fix build on Linux. Reviewed by Eric Christopher.
llvm-svn: 161439
2012-08-07 18:36:33 +00:00
Andrew Kaylor 1a568c3a4f Enable lazy compilation in MCJIT
llvm-svn: 161438
2012-08-07 18:33:00 +00:00
Jakob Stoklund Olesen 296448b293 Fix a couple of typos.
llvm-svn: 161437
2012-08-07 18:32:57 +00:00
Dmitri Gribenko a4eeae7930 Comment.h: fix typo in comment
llvm-svn: 161436
2012-08-07 18:20:04 +00:00
Dmitri Gribenko 94ef6357ca Comment AST: treat enumerators as "variables" in DeclInfo.
llvm-svn: 161435
2012-08-07 18:12:22 +00:00
Eli Friedman a8b38f2af2 Remove empty directory.
llvm-svn: 161434
2012-08-07 18:06:01 +00:00
Jakob Stoklund Olesen 75d9d5159e Add trace accessor methods, implement primitive if-conversion heuristic.
Compare the critical paths of the two traces through an if-conversion
candidate. If the difference is larger than the branch brediction
penalty, reject the if-conversion. If would never pay.

llvm-svn: 161433
2012-08-07 18:02:19 +00:00
Marshall Clow d39041f2fc Added code to let the user specify a compilation database on the command line
llvm-svn: 161432
2012-08-07 17:58:49 +00:00
Dmitri Gribenko 740c0fbe0e libclang API for comment-to-xml conversion.
The implementation also includes a Relax NG schema and tests for the schema
itself.  The schema is used in c-index-test to verify that XML documents we
produce are valid.  In order to do the validation, we add an optional libxml2
dependency for c-index-test.

Credits for CMake part go to Doug Gregor.  Credits for Autoconf part go to Eric
Christopher.  Thanks!

llvm-svn: 161431
2012-08-07 17:54:38 +00:00
Jim Grosbach af9aec0cd7 Tidy up a bit.
llvm-svn: 161430
2012-08-07 17:53:14 +00:00
Rafael Espindola 59564079e9 The dominance computation already has logic for computing if an edge dominates
a use or a BB, but it is inline in the handling of the invoke instruction.

This patch refactors it so that it can be used in other cases. For example, in

define i32 @f(i32 %x) {
bb0:
  %cmp = icmp eq i32 %x, 0
  br i1 %cmp, label %bb2, label %bb1
bb1:
  br label %bb2
bb2:
  %cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
  %foo = add i32 %cond, %x
  ret i32 %foo
}

GVN should be able to replace %x with 0 in any use that is dominated by the
true edge out of bb0. In the above example the only such use is the one in
the phi.

llvm-svn: 161429
2012-08-07 17:30:46 +00:00
Hal Finkel 895a5f5d12 Add a comment about mftb vs. mfspr on PPC.
Thanks to Alex Rosenberg for the suggestion.

llvm-svn: 161428
2012-08-07 17:04:20 +00:00
Fariborz Jahanian a7c9f883e6 objective-c: Exclude -Wdirect-ivar-access for arc.
Allow direct ivar access in init and dealloc methods
in mrr. // rdar://650197

llvm-svn: 161426
2012-08-07 16:38:44 +00:00
Filipe Cabecinhas 59fba12d28 Added fix from Pawel Worach.
llvm-svn: 161420
2012-08-07 16:33:49 +00:00
Filipe Cabecinhas 1a62bf4d55 Start working on the test suite in FreeBSD
llvm-svn: 161419
2012-08-07 15:40:30 +00:00
Alexey Samsonov 36796b4899 [compiler-rt] CMake build: if LLVM_BUILD_32_BITS is on, then -m32 is added to llvm definitions. Let us override this by explicitly adding -m64 compiler flag when building compiler-rt libraries for x86_64 target
llvm-svn: 161415
2012-08-07 12:14:29 +00:00
Alexey Samsonov 947228c4f7 Fix the representation of debug line table in DebugInfo LLVM library,
and "instruction address -> file/line" lookup.

Instead of plain collection of rows, debug line table for compilation unit is now
treated as the number of row ranges, describing sequences (series of contiguous machine
instructions). The sequences are not always listed in the order of increasing
address, so previously used std::lower_bound() sometimes produced wrong results.
Now the instruction address lookup consists of two stages: finding the correct
sequence, and searching for address in range of rows for this sequence.

llvm-svn: 161414
2012-08-07 11:46:57 +00:00
Benjamin Kramer c99d0e9186 PR13095: Give an inline cost bonus to functions using byval arguments.
We give a bonus for every argument because the argument setup is not needed
anymore when the function is inlined. With this patch we interpret byval
arguments as a compact representation of many arguments. The byval argument
setup is implemented in the backend as an inline memcpy, so to model the
cost as accurately as possible we take the number of pointer-sized elements
in the byval argument and give a bonus of 2 instructions for every one of
those. The bonus is capped at 8 elements, which is the number of stores
at which the x86 backend switches from an expanded inline memcpy to a real
memcpy. It would be better to use the real memcpy threshold from the backend,
but it's not available via TargetData.

This change brings the performance of c-ray in line with gcc 4.7. The included
test case tries to reproduce the c-ray problem to catch regressions for this
benchmark early, its performance is dominated by the inline decision of a
specific call.

This only has a small impact on most code, more on x86 and arm than on x86_64
due to the way the ABI works. When building LLVM for x86 it gives a small
inline cost boost to virtually any function using StringRef or STL allocators,
but only a 0.01% increase in overall binary size. The size of gcc compiled by
clang actually shrunk by a couple bytes with this patch applied, but not
significantly.

llvm-svn: 161413
2012-08-07 11:13:19 +00:00
Alexey Samsonov 0317b8bbc0 [ASan] simplify cmake rules for adding lit testsuites
llvm-svn: 161412
2012-08-07 11:09:41 +00:00
Alexey Samsonov 1e6c947a4c [ASan] add llvm_tools_dir to lit.site.cfg for ASan and add it to PATH
llvm-svn: 161411
2012-08-07 11:00:19 +00:00
Chandler Carruth 2f6cf4884c Fix PR13412, a nasty miscompile due to the interleaved
instsimplify+inline strategy.

The crux of the problem is that instsimplify was reasonably relying on
an invariant that is true within any single function, but is no longer
true mid-inline the way we use it. This invariant is that an argument
pointer != a local (alloca) pointer.

The fix is really light weight though, and allows instsimplify to be
resiliant to these situations: when checking the relation ships to
function arguments, ensure that the argumets come from the same
function. If they come from different functions, then none of these
assumptions hold. All credit to Benjamin Kramer for coming up with this
clever solution to the problem.

llvm-svn: 161410
2012-08-07 10:59:59 +00:00
Chandler Carruth 881d0a7966 Add a much more conservative strategy for aligning branch targets.
Previously, MBP essentially aligned every branch target it could. This
bloats code quite a bit, especially non-looping code which has no real
reason to prefer aligned branch targets so heavily.

As Andy said in review, it's still a bit odd to do this without a real
cost model, but this at least has much more plausible heuristics.

Fixes PR13265.

llvm-svn: 161409
2012-08-07 09:45:24 +00:00
Hans Wennborg abc1e22d65 Properly check length modfiers for %n in format strings.
llvm-svn: 161408
2012-08-07 09:13:19 +00:00
Hans Wennborg b1ab2a84f0 Remove ScanfArgType and bake that logic into ArgType.
This is useful for example for %n in printf, which expects
a pointer to int with the same logic for checking as %d
would have in scanf.

llvm-svn: 161407
2012-08-07 08:59:46 +00:00
Alexey Samsonov 59c33c0c9a [ASan] Add support for running unit tests by lit (as a part of 'make check-asan' command)
llvm-svn: 161406
2012-08-07 08:59:15 +00:00
Chandler Carruth 1479492125 Initial support for recursing into the new clang-tools-extra repository
if checked out under clang/tools/extra.

This is mostly so folks other than me can start to test. Documentation,
details, and an announcement are still in the works.

llvm-svn: 161405
2012-08-07 08:37:42 +00:00
Chandler Carruth 118232f2b4 Add a root CMakeLists.txt and fix up all the test build stuff.
With this we can build and test the remove-cstr-calls tool which should
serve as a good example of how to add tools and their tests to the
repository.

llvm-svn: 161404
2012-08-07 08:33:04 +00:00
Hans Wennborg c3b3da0bb2 Rename analyze_format_string::ArgTypeResult to ArgType
Also remove redundant constructors and unused member functions.

llvm-svn: 161403
2012-08-07 08:11:26 +00:00
Chandler Carruth c5062dc91a Copy some of the testing infrastructure from the primary Clang repository into
the new tools repo to preserve history. I'll subsequently be editting these
down to work w/ the tooling test suites.

llvm-svn: 161402
2012-08-07 07:09:14 +00:00
Chandler Carruth 4bf700f1de Copy the existing regression test for remove-cstr-calls from the tooling branch
to preserve its history. It's not yet functional.

llvm-svn: 161401
2012-08-07 07:07:42 +00:00
Chandler Carruth 82eb10d526 Make some directories for the tool-specific regression tests in the new
repository.

llvm-svn: 161400
2012-08-07 07:06:43 +00:00
Chandler Carruth bb5c56f26c Fix compilation with mainline AST matchers.
llvm-svn: 161399
2012-08-07 06:59:48 +00:00
Chandler Carruth 1d0717443f Put it in the correct place within the repository.
llvm-svn: 161398
2012-08-07 06:17:58 +00:00
Manman Ren cb36b8c2e6 MachineCSE: Update the heuristics for isProfitableToCSE.
If the result of a common subexpression is used at all uses of the candidate
expression, CSE should not increase the live range of the common subexpression.

rdar://11393714 and rdar://11819721

llvm-svn: 161396
2012-08-07 06:16:46 +00:00
Douglas Gregor 847cea72e6 Objective-C pointer types don't have C-linkage, even though they are
non-POD. Fixes <rdar://problem/12031870>.

llvm-svn: 161395
2012-08-07 06:14:34 +00:00
Bill Wendling 0acd0c0a69 Revert r161371. Removing the 'const' before Type is a "good thing".
--- Reverse-merging r161371 into '.':
U    include/llvm/Target/TargetData.h
U    lib/Target/TargetData.cpp

llvm-svn: 161394
2012-08-07 05:51:59 +00:00
Richard Smith a33e4fe603 Update documentation of HasSideEffects to match its callers' expectations, and
update implementation to match. An elidable, non-trivial constructor call is a
side-effect under this definition, but wasn't under the old one, because we are
not required to evaluate it even though it may have an effect.

Also rationalize checking for volatile reads: just look for lvalue-to-rvalue
conversions on volatile glvalues, and ignore whether a DeclRefExpr etc is for
a volatile variable.

llvm-svn: 161393
2012-08-07 05:18:29 +00:00
Anna Zaks b8146afcd1 [analyzer] + New line at end of file
llvm-svn: 161392
2012-08-07 05:12:29 +00:00
Anna Zaks 75930b65b4 [analyzer] Address Jordan's review of DynamicTypePropagation.
llvm-svn: 161391
2012-08-07 05:12:24 +00:00
Eric Christopher 96b5f07808 Fix the test RUN line for this better.
llvm-svn: 161390
2012-08-07 05:04:19 +00:00
Ted Kremenek 724923945b Enhance ClangDiagnosticsEmitter to reject diagnostics that are errors that are also
included in warning groups.  Warning groups can only contain warnings, because only
warnings can be mapped to errors or ignored.

This caught a few diagnostics that were incorrectly in diagnostic groups, and
could have resulted in a compiler crash when those diagnostic groups were mapped.

Fixes <rdar://problem/12044436>

llvm-svn: 161389
2012-08-07 05:01:49 +00:00
Richard Smith 0421ce7b22 Teach Expr::HasSideEffects about all the Expr types, and fix a bug where it
was mistakenly classifying dynamic_casts which might throw as having no side
effects.

Switch it from a visitor to a switch, so it is kept up-to-date as future Expr
nodes are added. Move it from ExprConstant.cpp to Expr.cpp, since it's not
really related to constant expression evaluation.

Since we use HasSideEffect to determine whether to emit an unused global with
internal linkage, this has the effect of suppressing emission of globals in
some cases.

I've left many of the Objective-C cases conservatively assuming that the
expression has side-effects. I'll leave it to someone with better knowledge
of Objective-C than mine to improve them.

llvm-svn: 161388
2012-08-07 04:16:51 +00:00
Enrico Granata 9c2efe39c0 Fixing an issue where ValueObject::GetPointeeData() would not work correctly for file addresses when fetching items other than the 0-th
llvm-svn: 161384
2012-08-07 01:49:34 +00:00
Sean Callanan cd4ae1ab94 Changed the Opcode::GetData() API so that it didn't
require an AddressClass, which is useless at this
point since it already knows the distinction between
32-bit Thumb opcodes and 32-bit ARM opcodes.

llvm-svn: 161382
2012-08-07 01:44:58 +00:00
Greg Clayton 79101b5cb0 Fixed an error in the thumb opcode encoding. We need the 32 bit thumb instructions to be encoded as a 32 bit value for the EmulateARM code.
llvm-svn: 161381
2012-08-07 01:29:29 +00:00
Jordan Rose c11a33a2bd [analyzer] Add a test case for OS X 10.8's NSMakeCollectable under non-GC.
This is an additional test for r161349 (ignoring 10.8's annotations for
NSMakeCollectable).

llvm-svn: 161380
2012-08-07 01:11:14 +00:00