Commit Graph

210478 Commits

Author SHA1 Message Date
Chaoren Lin 3ca7a3eb41 Fix off-by-one size check.
llvm-svn: 247766
2015-09-16 01:20:34 +00:00
Richard Smith 938d701fad [modules] Fix a corner case in the macro override rules: properly handle overridden leaf module macros.
llvm-svn: 247765
2015-09-16 00:55:50 +00:00
Greg Clayton 4947b21cb9 Fix MacOSX since "imported" and "Imported::imported" are ambiguous. Test that we can read the global when specified with the global namespace and test that we can read "Imported::imported" correctly. The commented out test should be testing for ambiguity when just "imported" is evaluated as an expression, but that doesn't work yet.
llvm-svn: 247764
2015-09-16 00:42:50 +00:00
Naomi Musgrave 36597fa128 Explicit reference to bug highlighted by
test/msan/dtor-trivial.cpp. Runtime testing for poisoning
vtable pointer in dtor.

Summary: Runtime testing for vtable ptr poisoning in dtor.

Reviewers: eugenis, kcc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12713

Clean test case & comments.

Update tests for vptr poisoning order.

Simplify test to rely upon globals.

Assertions verify that vtable still accessible from dtors.

Testing linear inheritance and multiple inheritance for vtable poisoning.

Macros for testing expected failing functions.

Rename macros.

Removed xfail, modified FileCheck commands, to expect test to crash.

llvm-svn: 247763
2015-09-16 00:41:28 +00:00
Naomi Musgrave 703835c7f3 Implementation and testing for poisoning vtable
ptr in dtor.

Summary:
After destruction, invocation of virtual functions prevented
by poisoning vtable pointer.

Reviewers: eugenis, kcc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12712

Fixed testing callback emission order to account for vptr.
Poison vtable in either complete or base dtor, depending on
if virtual bases exist. If virtual bases exist, poison in
complete dtor. Otherwise, poison in base.
Remove commented-out block.

llvm-svn: 247762
2015-09-16 00:38:22 +00:00
NAKAMURA Takumi c9ca73336d clang/test/CodeGenCXX/exceptions-cxx-new.cpp: Don't assume the label "entry:".
Seems it would be redundant.

llvm-svn: 247761
2015-09-16 00:33:59 +00:00
Paul Herman 92775baa5d Fix double include in CompilerDeclContext.h
llvm-svn: 247760
2015-09-16 00:29:10 +00:00
Paul Herman 82aa6f1ab5 Fix missing include in CompilerDeclContext.h
llvm-svn: 247759
2015-09-16 00:26:12 +00:00
Michael J. Spencer 75e5fda3de [elf2] Add R_X86_64_32S.
llvm-svn: 247758
2015-09-16 00:24:19 +00:00
NAKAMURA Takumi 92063b3bf2 llvm/CodeGen/CommandFlags.h: Prune doubleslash in #include.
While packaging 3.7 for Fedora, the debug info splitting
process fell over this, so fix it upstream seems like a good plan.

This should be put in the 3.7 branch as well.

Noticed by Dave Airlie <airlied@redhat.com>

llvm-svn: 247757
2015-09-16 00:10:43 +00:00
Greg Clayton 64277a9e27 Fix Xcode project by adding CompilerDecl.cpp and .h.
llvm-svn: 247756
2015-09-16 00:03:14 +00:00
Bruce Mitchener 778e7ab5a3 Return false, not 0, for bools.
Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12873

llvm-svn: 247755
2015-09-16 00:00:16 +00:00
Greg Clayton 5747dd158b Fix the MacOSX build.
llvm-svn: 247754
2015-09-15 23:59:41 +00:00
Greg Clayton 648267c29c Avoid a missing override warning.
llvm-svn: 247753
2015-09-15 23:59:25 +00:00
Nico Weber 8d8fc3f1ca Remove accidental superfluous newline added in r247750.
llvm-svn: 247752
2015-09-15 23:51:08 +00:00
Jason Molenda 9878e3b4b5 A partner to the cleanup in r247741, change the variables names in
debugserver to match.  "gcc" is now "ehframe" and "gdb" is now
"debugserver".  Because this is debugserver, what we call the Process
Plugin register numbers up in lldb are the debugserver register
numbers down here - they are the register numbers that debugserver
will use to refer to these registers over the gdb-remote protocol.

debugserver was already reporting the registers with the key
"ehframe"; this change is just cleaning up the internal variable
names to match.

llvm-svn: 247751
2015-09-15 23:49:57 +00:00
Nico Weber 4f11349028 clang-format: In Java, `assert` is followed by an expression.
Before: assert a&& b;
Now:    assert a && b;
llvm-svn: 247750
2015-09-15 23:48:17 +00:00
Sanjoy Das 8a5526e8be [IndVars] Fix PR24783.
In `IndVarSimplify::ExpandSCEVIfNeeded`,
`SCEVExpander::findExistingExpansion` may return an `llvm::Value` that
differs in type from the SCEV it was asked to find an expansion for (but
computes the same value).  In such cases, we fall back on
`expandCodeFor`; and rely on LLVM to CSE the two equivalent
expressions (different only by a no-op cast) into a single computation.

I tried a few other approaches to fixing PR24783, all of which turned
out to be more complex than this current version:

 1. Move the `ExpandSCEVIfNeeded` logic into `expandCodeFor`.  This got
    problematic because currently we do not pass in the `Loop *` into
    `expandCodeFor`.  Changing the interface to do this is a more
    invasive change, and really does not make much semantic sense unless
    the SCEV being passed in is an add recurrence.

    There is also the problem of `expandCodeFor` being used in places
    other than `indvars` -- there may be performance / correctness
    issues elsewhere if `expandCodeFor` is moved from always generating
    IR from scratch to cache-like model.

 2. Have `findExistingExpansion` only return expression with the correct
    type.  This would make `isHighCostExpansionHelper` and thus
    `isHighCostExpansion` more conservative than necessary.

 3. Insert casts on the value returned by `findExistingExpansion` if
    needed using `InsertNoopCastOfTo`.  This is complicated because
    `InsertNoopCastOfTo` depends on internal state of its
    `SCEVExpander` (specifically `Builder.GetInserPoint()`), and this
    may not be set up when `ExpandSCEVIfNeeded` is called.

 4. Manually insert casts on the value returned by
    `findExistingExpansion` if needed using `InsertNoopCastOfTo` via
    `CastInst::Create`.  This is probably workable, but figuring out the
    location where the cast instruction needs to be inserted has enough
    edge cases (arguments, constants, invokes, LCSSA must be preserved)
    makes me feel what I have right now is simplest solution.

llvm-svn: 247749
2015-09-15 23:45:39 +00:00
Sanjoy Das 0ce51a92a8 [IndVars] Rename variable; NFC.
llvm-svn: 247748
2015-09-15 23:45:35 +00:00
Sanjoy Das 192f21222f [SCEVExpander] Fix comment formatting; NFC.
llvm-svn: 247747
2015-09-15 23:45:31 +00:00
Paul Herman d628cbb999 Search variables based on clang::DeclContext and clang::Decl tree
Summary: SymbolFileDWARF now creates VarDecl and BlockDecl and adds them to the Decl tree. Then, in ClangExpressionDeclMap it uses the Decl tree to search for a variable. This fixes lots of variable scoping problems.

Reviewers: sivachandra, chaoren, spyffe, clayborg

Subscribers: tberghammer, jingham, lldb-commits

Differential Revision: http://reviews.llvm.org/D12658

llvm-svn: 247746
2015-09-15 23:44:17 +00:00
Michael J. Spencer dff84070da [elf2] Add error checking for the R_X86_64_32 relocation.
llvm-svn: 247745
2015-09-15 23:36:30 +00:00
Davide Italiano 386e2ab158 [llvm-cxxdump] Remove duplicate code check.
We already fail with 'No such file or directory' when we try to open
the file -- if that doesn't exist. Also add a test to verify this behavior.

llvm-svn: 247744
2015-09-15 23:35:32 +00:00
David Majnemer 778ac14dfb Try to appease the build bots
llvm-svn: 247743
2015-09-15 23:34:59 +00:00
David Majnemer 834c5128d8 [MS ABI] Add a C++ test for -fnew-ms-eh
llvm-svn: 247742
2015-09-15 23:30:42 +00:00
Jason Molenda 63bd0db071 Clean up register naming conventions inside lldb.
"gcc" register numbers are now correctly referred to as "ehframe"
register numbers.  In almost all cases, ehframe and dwarf register
numbers are identical (the one exception is i386 darwin where ehframe
regnums were incorrect).

The old "gdb" register numbers, which I incorrectly thought were
stabs register numbers, are now referred to as "Process Plugin"
register numbers.  This is the register numbering scheme that the
remote process controller stub (lldb-server, gdbserver, core file
support, kdp server, remote jtag devices, etc) uses to refer to the
registers.  The process plugin register numbers may not be contiguous
- there are remote jtag devices that have gaps in their register
numbering schemes.

I removed all of the enums for "gdb" register numbers that we had
in lldb - these were meaningless - and I put LLDB_INVALID_REGNUM
in all of the register tables for the Process Plugin regnum slot.

This change is almost entirely mechnical; the one actual change in
here is to ProcessGDBRemote.cpp's ParseRegisters() which parses the
qXfer:features:read:target.xml response.  As it parses register
definitions from the xml, it will assign sequential numbers as the
eRegisterKindLLDB numbers (the lldb register numberings must be
sequential, without any gaps) and if the xml file specifies register
numbers, those will be used as the eRegisterKindProcessPlugin
register numbers (and those may have gaps).  A J-Link jtag device's
target.xml does contain a gap in register numbers, and it only 
specifies the register numbers for the registers after that gap.
The device supports many different ARM boards and probably selects
different part of its register file as appropriate.

http://reviews.llvm.org/D12791
<rdar://problem/22623262> 

llvm-svn: 247741
2015-09-15 23:20:34 +00:00
Nico Weber 9677562c8f Don't crash when passing &@selector to a _Nonnull parameter. Fixes PR24774.
The root cause here is that ObjCSelectorExpr is an rvalue, yet it can have its
address taken.  That's kind of awkward, but fixing this is awkward in other
ways, see https://llvm.org/bugs/show_bug.cgi?id=24774#c16 .  For now, just
fix the crash.

llvm-svn: 247740
2015-09-15 23:17:17 +00:00
Gabor Horvath 6864cbced6 [Static Analyzer] Added an XFAIL test for inlining when the type inference involves generic types.
llvm-svn: 247739
2015-09-15 23:14:01 +00:00
Michael J. Spencer 3c1ac0a17a [elf2] Relocate absolute symbols.
llvm-svn: 247738
2015-09-15 23:12:02 +00:00
Alexey Samsonov f23dee5408 [ASan] Add test for .preinit_array/.init_array/.fini_array sections.
llvm-svn: 247737
2015-09-15 23:06:17 +00:00
Duncan P. N. Exon Smith a11f81973a LTO: Adjust to LLVM r247735
Perhaps lld wants to disable the verifier sometimes during COFF LTO, but
for now just match behaviour from before r247735.

llvm-svn: 247736
2015-09-15 23:06:16 +00:00
Duncan P. N. Exon Smith cff5feff6f Reapply "LTO: Disable extra verify runs in release builds"
This reverts commit r247730, effectively reapplying r247729.  This time
I have an lld commit ready to follow.

llvm-svn: 247735
2015-09-15 23:05:59 +00:00
Alexey Samsonov c1603b6493 [ASan] Don't instrument globals in .preinit_array/.init_array/.fini_array
These sections contain pointers to function that should be invoked
during startup/shutdown by __libc_csu_init and __libc_csu_fini.
Instrumenting these globals will append redzone to them, which will be
filled with zeroes. This will cause null pointer dereference at runtime.

Merge ASan regression tests for globals that should be ignored by
instrumentation pass.

llvm-svn: 247734
2015-09-15 23:05:48 +00:00
Piotr Padlewski 08bd7bf00c invariant.group-for-vptrs test fix
llvm-svn: 247733
2015-09-15 23:04:47 +00:00
Johannes Doerfert 883f8c1d2f Use modulo semantic to generate non-integer-overflow assumptions
This will allow to generate non-wrap assumptions for integer expressions
  that are part of the SCoP. We compare the common isl representation of
  the expression with one computed with modulo semantic. For all parameter
  combinations they are not equal we can have integer overflows.

  The nsw flags are respected when the modulo representation is computed,
  nuw and nw flags are ignored for now.

  In order to not increase compile time to much, the non-wrap assumptions
  are collected in a separate boundary context instead of the assumed
  context. This helps compile time as the boundary context can become
  complex and it is therefor not advised to use it in other operations
  except runtime check generation. However, the assumed context is e.g.,
  used to tighten dependences. While the boundary context might help to
  tighten the assumed context it is doubtful that it will help in practice
  (it does not effect lnt much) as the boundary (or no-wrap assumptions)
  only restrict the very end of the possible value range of parameters.

  PET uses a different approach to compute the no-wrap context, though lnt runs
  have shown that this version performs slightly better for us.

llvm-svn: 247732
2015-09-15 22:52:53 +00:00
Johannes Doerfert cef616fe2d Use blocks instead of domains in SCEVAffinator
Due to the new domain generation, the SCoP keeps track of the domain
  for all blocks, thus the SCEVAffinator can now work with blocks to avoid
  duplication of the domains.

llvm-svn: 247731
2015-09-15 22:49:04 +00:00
Duncan P. N. Exon Smith 7de73e56a4 Revert "LTO: Disable extra verify runs in release builds"
This temporarily reverts commit r247729, as it caused lld build
failures.  I'll recommit once I have an lld patch ready-to-go.

llvm-svn: 247730
2015-09-15 22:47:38 +00:00
Duncan P. N. Exon Smith 236787838c LTO: Disable extra verify runs in release builds
The verifier currently runs three times in LTO: (1) after parsing, (2)
at the beginning of the optimization pipeline, and (3) at the end of it.

The first run is important, since we're not sure where the bitcode comes
from and it's nice to validate it, but in release builds the extra runs
aren't appropriate.

This commit:
  - Allows these runs to be disabled in LTOCodeGenerator.
  - Adds command-line options to llvm-lto.
  - Adds command-line options to libLTO.dylib, and disables the verifier
    by default in release builds (based on NDEBUG).

This shaves about 3.5% off the runtime of ld64 when linking
verify-uselistorder with -flto -g.

rdar://22509081

llvm-svn: 247729
2015-09-15 22:26:11 +00:00
Johannes Doerfert b20f151d56 Coalesce the constructed domains early
llvm-svn: 247728
2015-09-15 22:11:49 +00:00
Enrico Granata c1c9896ff4 Teach the ObjC data formatters to use the correct language when printing strings
llvm-svn: 247727
2015-09-15 22:11:20 +00:00
Chris Bieneman ea7ecde87c [CMake] Add cache scripts for Apple-style clang builds.
Summary:
These CMake cache scripts are my first pass at replicating Apple's packaging logic from autoconf. They can be used on any Darwin machine to approximate an Apple Clang build.

The included README file includes documentation and a sample CMake invocation.

Reviewers: chandlerc, echristo

Subscribers: echristo, cfe-commits

Differential Revision: http://reviews.llvm.org/D12817

llvm-svn: 247726
2015-09-15 21:52:42 +00:00
Piotr Padlewski 4b1ac72cd4 Decorating vptr load & stores with !invariant.group
Adding !invariant.group to vptr load/stores for devirtualization purposes.
For more goto:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html

http://reviews.llvm.org/D12026

llvm-svn: 247725
2015-09-15 21:46:55 +00:00
Piotr Padlewski 9d0ecf27a7 Added llvm.module flag for strict vtable pointers
It is dangerous to do LTO on code with strict-vtable-pointers, because
one module has invariant.group.barriers, and the other one not.

In the future I want to just strip all invariant.group metadata from
vptrs loads/stores and get rid of invariant.group.barrier calls.

http://reviews.llvm.org/D12580

llvm-svn: 247724
2015-09-15 21:46:50 +00:00
Piotr Padlewski 338c9d0ade Emiting llvm.invariant.group.barrier when dynamic type changes
For more goto:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html

http://reviews.llvm.org/D12312

llvm-svn: 247723
2015-09-15 21:46:47 +00:00
Todd Fiala 68615ce606 Add JUnit/XUnit-formatted output to the lldb test run system
Also introduces the test event system into our test runner framework.
See the following for details:
http://reviews.llvm.org/D12831

llvm-svn: 247722
2015-09-15 21:38:04 +00:00
Rui Ueyama c26bbfe6b6 COFF: Add a test for ICF which LLD cannot handle yet.
In this test, we have two functions, foo and bar. MSVC linker can
choose one and discard the other using ICF. LLD cannot. I add this
test as a TODO.

foo and bar are conceptually equivalent to the following:

  void foo() { foo(); }
  void bar() { foo(); }

foo and bar are effectively the same function. If foo and bar are
compiled to the same instructions, both their contents (foo and bar)
and relocation targets (foo) become the same, so from the ICF point
of view, they are reducible. But their graphs are not isomorphic!
LLD's ICF algorithm cannot handle this case yet.

llvm-svn: 247721
2015-09-15 21:17:12 +00:00
Jim Ingham 151c032c86 This patch makes Clang-independent base classes for all the expression types that lldb currently vends.
Before we had:

ClangFunction
ClangUtilityFunction
ClangUserExpression

and code all over in lldb that explicitly made Clang-based expressions. This patch adds an Expression 
base class, and three pure virtual implementations for the Expression kinds:

FunctionCaller
UtilityFunction
UserExpression

You can request one of these expression types from the Target using the Get<ExpressionType>ForLanguage. 
The Target will then consult all the registered TypeSystem plugins, and if the type system that matches 
the language can make an expression of that kind, it will do so and return it.

Because all of the real expression types need to communicate with their ExpressionParser in a uniform way, 
I also added a ExpressionTypeSystemHelper class that expressions generically can vend, and a ClangExpressionHelper 
that encapsulates the operations that the ClangExpressionParser needs to perform on the ClangExpression types. 
Then each of the Clang* expression kinds constructs the appropriate helper to do what it needs.

The patch also fixes a wart in the UtilityFunction that to use it you had to create a parallel FunctionCaller 
to actually call the function made by the UtilityFunction. Now the UtilityFunction can be asked to vend a 
FunctionCaller that will run its function. This cleaned up a lot of boiler plate code using UtilityFunctions.

Note, in this patch all the expression types explicitly depend on the LLVM JIT and IR, and all the common 
JIT running code is in the FunctionCaller etc base classes. At some point we could also abstract that dependency 
but I don't see us adding another back end in the near term, so I'll leave that exercise till it is actually necessary.

llvm-svn: 247720
2015-09-15 21:13:50 +00:00
Justin Bogner 01fa3f96b3 test: Add "REQUIRES: native" so this test passes with no default triple configured
llvm-svn: 247719
2015-09-15 21:13:33 +00:00
Hans Wennborg 5869ec4c6c MS ABI: Don't allow dllexport/import on lambdas
This is to follow up on David's comment in
http://reviews.llvm.org/D12422#235509

llvm-svn: 247718
2015-09-15 21:05:30 +00:00
Nico Weber 3df1840cfc Add test coverage for @encode(SEL); completely untested until now.
llvm-svn: 247717
2015-09-15 20:05:20 +00:00