Commit Graph

134451 Commits

Author SHA1 Message Date
Chandler Carruth e7a1ba5e8b Switch to a signed representation for the dynamic offsets while walking
across the uses of the alloca. It's entirely possible for negative
numbers to come up here, and in some rare cases simply doing the 2's
complement arithmetic isn't the correct decision. Notably, we can't zext
the index of the GEP. The definition of GEP is that these offsets are
sign extended or truncated to the size of the pointer, and then wrapping
2's complement arithmetic used.

This patch fixes an issue that comes up with *no* input from the
buildbots or bootstrap afaict. The only place where it manifested,
disturbingly, is Clang's own regression test suite. A reduced and
targeted collection of tests are added to cope with this. Note that I've
tried to pin down the potential cases of overflow, but may have missed
some cases. I've tried to add a few cases to test this, but its hard
because LLVM has quite limited support for >64bit constructs.

llvm-svn: 164475
2012-09-23 11:43:14 +00:00
Nick Lewycky c6b4f0310c Don't do actual work inside an assert statement. Fixes PR11760!
llvm-svn: 164474
2012-09-23 03:58:21 +00:00
Rafael Espindola 151a957fb0 Implement ToolChain::IsUnwindTablesDefault to reduce code duplication a bit.
llvm-svn: 164473
2012-09-23 03:05:41 +00:00
Michael Liao 8d62212e93 Revise test to avoid using of 'grep'
llvm-svn: 164472
2012-09-23 02:41:47 +00:00
Craig Topper 3186c01fec Add LLVM_OVERRIDE to methods that override their base classes.
llvm-svn: 164471
2012-09-23 02:12:10 +00:00
Rafael Espindola 66431cd10f On Hexagon getArchName() never returns x86_64, simplify the function.
llvm-svn: 164470
2012-09-22 22:58:57 +00:00
Rafael Espindola ccaa3b6eb2 Use pipes.
llvm-svn: 164469
2012-09-22 22:51:00 +00:00
Rafael Espindola c326427905 Use FileCheck.
llvm-svn: 164468
2012-09-22 22:30:04 +00:00
Dmitri Gribenko 1da8886915 Comment sema: warn when comment has \deprecated but declaration does not have a
deprecation attribute ('deprecated', 'availability' or 'unavailable').

This warning is under a separate flag, -Wdocumentation-deprecated-sync, so it
can be turned off easily while leaving other -Wdocumentation warnings on.

llvm-svn: 164467
2012-09-22 21:47:50 +00:00
Dmitri Gribenko d0885d2941 Remove superfluous \namespace command.
llvm-svn: 164466
2012-09-22 21:44:37 +00:00
Michael Liao 1b823fc1ba Enhance test case of atomic16 to verify inst encoding fixed in r164453.
llvm-svn: 164465
2012-09-22 21:07:59 +00:00
Dmitri Gribenko b947e8239f Fix cindex.py compatibility with older libclang.so
The issue is that we were calling clang_getCompletionBriefComment
unconditionally.  New we check if this function is available before calling it.

llvm-svn: 164464
2012-09-22 17:52:29 +00:00
Rafael Espindola a7b9698b3d Use FileCheck.
llvm-svn: 164462
2012-09-22 15:26:38 +00:00
Rafael Espindola 08f1ebb2b7 Fix pr13749. There is still a lot of code using getArchName that should be
using getArch, but I will try to fix them one at time to add tests.

llvm-svn: 164460
2012-09-22 15:04:11 +00:00
NAKAMURA Takumi 23b5b171eb ARMInstPrinter.cpp: Fix a warning in -Asserts. [-Wunused-variable]
llvm-svn: 164459
2012-09-22 13:12:28 +00:00
NAKAMURA Takumi 0ac2f2a077 Whitespace.
llvm-svn: 164458
2012-09-22 13:12:22 +00:00
Tim Northover 2fdbdc5870 Fix edge cases of ARM shift operands in arith instructions.
As before with load instructions, oddities like "asr #32", "rrx" could
be printed incorrectly.

Patch by Chris Lidbury.

llvm-svn: 164456
2012-09-22 11:18:19 +00:00
Tim Northover 0c97e76492 Fix the handling of edge cases in ARM shifted operands.
This patch fixes load/store instructions to handle less common cases
like "asr #32", "rrx" properly throughout the MC layer.

Patch by Chris Lidbury.

llvm-svn: 164455
2012-09-22 11:18:12 +00:00
Abramo Bagnara 6cba23a649 Avoid multiple atomic builtin declaration.
llvm-svn: 164454
2012-09-22 09:05:22 +00:00
Michael Liao 2718b20030 Fix 16-bit atomic inst encoding and keep pseudo-inst starting with '#'
llvm-svn: 164453
2012-09-22 05:41:15 +00:00
Michael Liao 2456b3ae8c Fix typo in r164357
llvm-svn: 164452
2012-09-22 03:39:42 +00:00
Andrew Trick 9257b8f8bb Machine Model (-schedmodel only). Added SchedAliases.
Allow subtargets to tie SchedReadWrite types to processor specific
sequences or variants.

llvm-svn: 164451
2012-09-22 02:24:21 +00:00
Argyrios Kyrtzidis b41791d848 When importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can point to the
FunctionDecl that we are importing the FunctionProtoType for, in which case we'll have
infinite recursion when importing.

Initially create a FunctionProtoType with null ExceptionSpecDecl/ExceptionSpecTemplate and
update the type in ASTNodeImporter::VisitFunctionDecl after the FunctionDecl has been created.

llvm-svn: 164450
2012-09-22 01:58:06 +00:00
Jordan Rose 52de8eec01 [analyzer] Suppress bugs whose paths go through the return of a null pointer.
This is a heuristic intended to greatly reduce the number of false
positives resulting from inlining, particularly inlining of generic,
defensive C++ methods that live in header files. The suppression is
triggered in the cases where we ask to track where a null pointer came
from, and it turns out that the source of the null pointer was an inlined
function call.

This change brings the number of bug reports in LLVM from ~1500 down to
around ~300, a much more manageable number. Yes, some true positives may
be hidden as well, but from what I looked at the vast majority of silenced
reports are false positives, and many of the true issues found by the
analyzer are still reported.

I'm hoping to improve this heuristic further by adding some exceptions
next week (cases in which a bug should still be reported).

llvm-svn: 164449
2012-09-22 01:25:06 +00:00
Jordan Rose 4ac7cba404 [analyzer] Track a null value back through FindLastStoreBRVisitor.
Also, tidy up the other tracking visitors so that they mark the right
things as interesting and don't do extra work.

llvm-svn: 164448
2012-09-22 01:25:00 +00:00
Jordan Rose fa92f0f298 [analyzer] Always allow BugReporterVisitors to see the bug path.
Before, PathDiagnosticConsumers that did not support actual path output
would (sensibly) cause the generation of the full path to be skipped.
However, BugReporterVisitors may want to see the path in order to mark a
BugReport as invalid.

Now, even for a path generation scheme of 'None' we will still create a
trimmed graph and walk backwards through the bug path, doing no work other
than passing the nodes to the BugReporterVisitors. This isn't cheap, but
it's necessary to properly do suppression when the first path consumer does
not support path notes.

In the future, we should try only generating the path and visitor-provided
path notes once, or at least only creating the trimmed graph once.

llvm-svn: 164447
2012-09-22 01:24:56 +00:00
Jordan Rose 5a751b993f [analyzer] Allow a BugReport to be marked "invalid" during path generation.
This is intended to allow visitors to make decisions about whether a
BugReport is likely a false positive. Currently there are no visitors
making use of this feature, so there are no tests.

When a BugReport is marked invalid, the invalidator must provide a key
that identifies the invaliation (intended to be the visitor type and a
context pointer of some kind). This allows us to reverse the decision
later on. Being able to reverse a decision about invalidation gives us more
flexibility, and allows us to formulate conditions like "this report is
invalid UNLESS the original argument is 'foo'". We can use this to
fine-tune our false-positive suppression (coming soon).

llvm-svn: 164446
2012-09-22 01:24:53 +00:00
Jordan Rose 6f3d2f0acd [analyzer] Look through OpaqueValueExprs when tracking a nil value.
This allows us to show /why/ a particular object is nil, even when it is
wrapped in an OpaqueValueExpr.

llvm-svn: 164445
2012-09-22 01:24:49 +00:00
Jordan Rose 106b037a85 [analyzer] Better path notes for null pointers passed as arguments.
Rather than saying "Null pointer value stored to 'foo'", we now say
"Passing null pointer value via Nth parameter 'foo'", which is much better.
The note is also now on the argument expression as well, rather than the
entire call.

This paves the way for continuing to track arguments back to their sources.

<rdar://problem/12211490>

llvm-svn: 164444
2012-09-22 01:24:46 +00:00
Jordan Rose c102b35b44 Use llvm::getOrdinalSuffix to print ordinal numbers in diagnostics.
Just a refactoring of common infrastructure. No intended functionality change.

llvm-svn: 164443
2012-09-22 01:24:42 +00:00
Jordan Rose 1d64a49855 [analyzer] Check that an ObjCIvarRefExpr's base is non-null even as an lvalue.
Like with struct fields, we want to catch cases like this early,
so that we can produce better diagnostics and path notes:

  PointObj *p = nil;
  int *px = &p->_x; // should warn here
  *px = 1;

llvm-svn: 164442
2012-09-22 01:24:38 +00:00
Jordan Rose 04dcb7235f [analyzer] Check that a member expr is valid even when the result is an lvalue.
We want to catch cases like this early, so that we can produce better
diagnostics and path notes:

  Point *p = 0;
  int *px = &p->x; // should warn here
  *px = 1;

llvm-svn: 164441
2012-09-22 01:24:33 +00:00
Jordan Rose d2718b1fed Add llvm::getOrdinalSuffix to get the appropriate -st, -nd, -rd, -th suffix.
Used by clang to print parameter indexes.

llvm-svn: 164440
2012-09-22 01:24:21 +00:00
Jordan Rose f8b0a5e9e3 Casting: assert that pointer arguments to isa<> are non-null.
This silences several analyzer warnings within LLVM, and provides a slightly
nicer crash experience when someone calls isa<>, cast<>, or dyn_cast<> with
a null pointer.

llvm-svn: 164439
2012-09-22 01:24:18 +00:00
Jordan Rose 08f3b9167f DenseMap: assert that we have found a bucket before we try to insert into it.
This silences literally dozens of analyzer warnings on LLVM (since DenseMap
is such a commonly-used class).

llvm-svn: 164438
2012-09-22 01:24:16 +00:00
Richard Smith 6d12af7410 Fix bug which sometimes resulted in further diagnostics being produced after a
fatal error. Previously, if a fatal error was followed by a diagnostic which
was suppressed due to a SFINAETrap, we'd forget that we'd seen a fatal error.

llvm-svn: 164437
2012-09-22 00:53:56 +00:00
Jim Ingham 493dffe2b1 Missed a few places where I didn't delete the obsolete (commented out) version of the breakpoint creation.
llvm-svn: 164436
2012-09-22 00:14:47 +00:00
Akira Hatanaka ecfb828341 MIPS DSP: Add immediate leaves.
llvm-svn: 164435
2012-09-22 00:07:12 +00:00
Akira Hatanaka 329df55de1 MIPS DSP: Add predicates and instruction template.
llvm-svn: 164434
2012-09-22 00:06:06 +00:00
Jim Ingham 63dfc725a7 Fix all the test case breakages caused by folks writing tests all over the place that depended explicitly
on the output of "break set".  Please don't do this sort of thing!!!!!

llvm-svn: 164433
2012-09-22 00:05:11 +00:00
Jim Ingham 1391cc7d51 Change the new breakpoint creation output (primarily from "break set") to something more useful.
<rdar://problem/11333623>

llvm-svn: 164432
2012-09-22 00:04:04 +00:00
Akira Hatanaka fabb8cf421 Add MIPS DSP register classes. Set actions of DSP vector operations and override
TargetLowering's callback functions.

llvm-svn: 164431
2012-09-21 23:58:31 +00:00
Akira Hatanaka 233ac53a3f SelectionDAG node enums for MIPS DSP nodes.
llvm-svn: 164430
2012-09-21 23:52:47 +00:00
Akira Hatanaka f03b6c34f3 Add MIPS accumulator and DSP control registers.
llvm-svn: 164429
2012-09-21 23:48:37 +00:00
Akira Hatanaka 65ce931f9a Add flags and feature bits for mips dsp.
llvm-svn: 164428
2012-09-21 23:41:49 +00:00
Chandler Carruth 225d4bdb07 Fix a case where the new SROA pass failed to zap dead operands to
selects with a constant condition. This resulted in the operands
remaining live through the SROA rewriter. Most of the time, this just
caused some dead allocas to persist and get zapped by later passes, but
in one case found by Joerg, it caused a crash when we tried to *promote*
the alloca despite it having this dead use. We already have the
mechanisms in place to handle this, just wire select up to them.

llvm-svn: 164427
2012-09-21 23:36:40 +00:00
Eric Christopher 9fafe07da0 Add an --enable-backtraces option to configure to determine
whether or not we want to print out backtrace information. Useful
for libraries that don't need backtrace information on a crash.

rdar://11844710

llvm-svn: 164426
2012-09-21 23:03:29 +00:00
Dan Gohman 8d042fa519 Add an MDBuilder utility for creating !tbaa.struct nodes.
llvm-svn: 164425
2012-09-21 23:00:37 +00:00
Michael J. Spencer fa90e850cf [CMake] Respect LLVM_BUILD_RUNTIME.
llvm-svn: 164424
2012-09-21 22:49:06 +00:00
Michael J. Spencer c774095d44 [CMake][tsan] Compile .S files for tsan as C instead of CXX.
Using CXX breaks if you add -stdlib=libc++ to CMAKE_CXX_FLAGS.

llvm-svn: 164422
2012-09-21 22:39:39 +00:00