Commit Graph

208379 Commits

Author SHA1 Message Date
George Burgess IV bdb5b2687a Make __builtin_object_size always answer correctly
__builtin_object_size would return incorrect answers for many uses where
type=3. This fixes the inaccuracy by making us emit 0 instead of LLVM's
objectsize intrinsic.

Additionally, there are many cases where we would emit suboptimal (but
correct) answers, such as when arrays are involved. This patch fixes
some of these cases (please see new tests in test/CodeGen/object-size.c
for specifics on which cases are improved)

Resubmit of r245323 with PR24493 fixed.
Patch mostly by Richard Smith.
Differential Revision: http://reviews.llvm.org/D12000
This fixes PR15212.

llvm-svn: 245403
2015-08-19 02:19:07 +00:00
Eric Christopher 0efe9f60bb Revert "Fix PR24469 resulting from r245025 and re-enable dead store elimination across basicblocks."
This is causing bootstrap problems, e.g.: http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/2960

This reverts r245195.

llvm-svn: 245402
2015-08-19 02:15:13 +00:00
Ehsan Akhgari c62c639610 Insert override at the same line as the end of the function declaration
Summary:
The existing check converts the code pattern below:

  void f()
  {
  }

to:

  void f()
  override {
  }

which is fairly sub-optimal.  This patch fixes this by inserting the
override keyword on the same line as the function declaration if
possible, so that we instead get:

  void f() override
  {
  }

We do this by looking for the last token before the start of the body
and inserting the override keyword at the end of its location.  Note
that we handle const, volatile and ref-qualifiers correctly.

Test Plan: Includes an automated test.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 245401
2015-08-19 02:05:37 +00:00
Hal Finkel a8d205f145 Make ScalarEvolution::isKnownPredicate a little smarter
Here we make ScalarEvolution::isKnownPredicate, indirectly, a little smarter.
Given some relational comparison operator OP, and two AddRec SCEVs, {I,+,S} OP
{J,+,T}, we can reduce this to the comparison I OP J when S == T, both AddRecs
are for the same loop, and both are known not to wrap.

As it turns out, because of the way that backedge-guard expressions can be
leveraged when computing known predicates, this allows indvars to simplify the
if-statement comparison in this loop:

  void foo (int *a, int *b, int n) {
    for (int i = 0; i < n; ++i) {
      if (i > n)
        a[i] = b[i] + 1;
    }
  }

which, somewhat surprisingly, we were not previously optimizing away.

llvm-svn: 245400
2015-08-19 01:51:51 +00:00
Chih-Hung Hsieh fdcf541871 Split ARM and AArch64 emutls.ll test
Differential Revision: http://reviews.llvm.org/D12127

llvm-svn: 245399
2015-08-19 01:44:51 +00:00
Chaoren Lin 57998de165 Update to r245397.
`ast_transformer` could be null, in which case we should initialize
`m_code_generator` with the ASTContext.

llvm-svn: 245398
2015-08-19 01:24:57 +00:00
Richard Smith 453930d7c3 Fix LLDB after Clang r245346.
The right thing to do here would be to give the ASTConsumer to the
CompilerInstance so it can set things up for us, but we can't do that
because we don't own it. So instead just initialize it ourselves.

llvm-svn: 245397
2015-08-19 01:05:34 +00:00
Alex Lorenz df9e3c6fb0 MIR Serialization: Serialize MMI's variable debug information.
llvm-svn: 245396
2015-08-19 00:13:25 +00:00
Quentin Colombet 861ad97e6f [BasicAA] Add a test for PR24468 to be sure we won't regress
when we finally get the GEP aliasing right.

llvm-svn: 245395
2015-08-19 00:08:26 +00:00
Quentin Colombet b700e357b5 [BasicAA] Revert r221876 because it can produce incorrect aliasing
information: see PR24468.

llvm-svn: 245394
2015-08-19 00:07:20 +00:00
David Blaikie 8f2a7feec8 unique_ptrify CXXBasePaths::DeclsFound & remove the then-unnecessary user-defined dtor
Maybe this and the NumDeclsFound member should just be a std::vector
instead. (it could be a std::dynarray, but that missed standardization)

llvm-svn: 245392
2015-08-18 23:56:00 +00:00
Richard Smith 401cd25b23 [modules] Tests for r245390.
llvm-svn: 245391
2015-08-18 23:42:50 +00:00
Richard Smith 386bb073d2 [modules] Fix HeaderFileInfo serialization to store all the known owning modules for a header, not just the current favourite.
llvm-svn: 245390
2015-08-18 23:42:23 +00:00
Eric Fiselier 10967a6ea6 [libcxx] Add Atomic test helper and fix TSAN failures.
Summary:
This patch attempts to fix the last 3 TSAN failures on the libc++ bot (http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-tsan/builds/143). This patch also adds a `Atomic` test type that can be used where `<atomic>` cannot.

`wait.exception.pass.cpp` and `wait_for.exception.pass.cpp` were failing because the test replaced `std::terminate` with `std::exit`. `std::exit` would asynchronously run the TLS and static destructors and this would cause a race condition. See PR22606 and D8802 for more details. 

This is fixed by using `_Exit` to prevent cleanup.

`notify_all_at_thread_exit.pass.cpp` exercises the same race condition but for different reasons. I fixed this test by manually joining the thread before beginning program termination.

Reviewers: EricWF, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 245389
2015-08-18 23:29:59 +00:00
Steve King d4c8f70ce1 Fix backward operands in call to isTruncateFree() and improve comments.
llvm-svn: 245385
2015-08-18 23:02:41 +00:00
Alex Lorenz 607efb6c7e MIR Parser: Return true on error when parsing standalone registers.
llvm-svn: 245384
2015-08-18 22:57:36 +00:00
Alex Lorenz f3630113cd MIR Serialization: Serialize the operand's bit mask target flags.
This commit adds support for bit mask target flag serialization to the MIR
printer and the MIR parser. It also adds support for the machine operand's
target flag serialization to the AArch64 target.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 245383
2015-08-18 22:52:15 +00:00
Sanjay Patel 5c55fbc5ea use TLI.allowsMemoryAccess() to check if memory accesses are fast; NFCI
This consolidates use of isUnalignedMem32Slow() in one place.
There is a slight change in logic although I'm not sure that it would ever
come up in the real world: we were assuming that an alignment of the type 
size is always fast; now, we actually check the data layout to confirm that.

llvm-svn: 245382
2015-08-18 22:48:12 +00:00
Paul Herman 10bc1a4e83 Fix resolution conflict between global and class static variables in C++
llvm-svn: 245381
2015-08-18 22:46:57 +00:00
Paul Herman b058fb47db Test chaned function calls and imported namespaces in C++
llvm-svn: 245380
2015-08-18 22:43:37 +00:00
Nick Lewycky 06b0ea2e8f Fix three typos in comments; "easilly" -> "easily".
llvm-svn: 245379
2015-08-18 22:41:58 +00:00
David Blaikie 7e70d6803d Devirtualize EHScopeStack::Cleanup's dtor because it's never destroyed polymorphically
llvm-svn: 245378
2015-08-18 22:40:54 +00:00
Reid Kleckner d85f7010cc [windows] Implement GetProcAddress internally to avoid initializing the CRT
ASan uses GetProcAddress to get the address of malloc so it can patch
it. Newer versions of Windows make GetProcAddress initialize the DLL
before returning a function pointer into it. That's perfectly
reasonable, but ASan needs to finish patching malloc before CRT
initialization. So now we roll our own GetProcAddress.

Fixes PR24237

Based on a patch by David Major

Originally written by David Major as part of:
https://hg.mozilla.org/mozilla-central/file/tip/toolkit/xre/WindowsCrtPatch.h

llvm-svn: 245377
2015-08-18 22:38:27 +00:00
Greg Clayton 6dc8d583b9 More abstraction to get almost all clang specific DWARF parsing code into ClangASTContext.
llvm-svn: 245376
2015-08-18 22:32:36 +00:00
Greg Clayton 7b1c497862 Fix inconsistent use of override warnings.
llvm-svn: 245375
2015-08-18 22:31:29 +00:00
Peter Collingbourne 4cfa086df2 Support: Clean up TSan annotations.
Remove support for Valgrind-based TSan, which hasn't been maintained for a
few years. We now use the TSan annotations only if LLVM is compiled with
-fsanitize=thread. We no longer need the weak function definitions as we
are guaranteed that our program is linked directly with the TSan runtime.

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

llvm-svn: 245374
2015-08-18 22:31:24 +00:00
Greg Clayton 2ad6ac5461 Quiet build warnings on MacOSX.
llvm-svn: 245373
2015-08-18 22:30:25 +00:00
Alex Lorenz a314d81328 MIR Serialization: Serialize the frame information's stack protector index.
llvm-svn: 245372
2015-08-18 22:26:26 +00:00
Zachary Turner 913f776ff9 Fix TestArrayTypes on Windows.
Whether or not frames print their tid in hex or decimal is apparently
hardcoded to depend on the operating system.  For now a comment was
added that this should be changed to a more sane check (for example
a setting), and the OS check is updated to do the right thing for
Windows.

llvm-svn: 245371
2015-08-18 22:25:40 +00:00
Alex Lorenz dc9dadf683 MIR Parser: Extract the code that parses stack object references into a new
method.

This commit extracts the code that parses the stack object references into a
new method named 'parseStackFrameIndex', so that it can be reused when
parsing standalone stack object references.

llvm-svn: 245370
2015-08-18 22:18:52 +00:00
David Majnemer 8e335ca278 [InstSimplify] Remove unused variable
No functionality change is intended.

llvm-svn: 245369
2015-08-18 22:18:22 +00:00
David Blaikie 50ccaa653a Fix for MSVC
llvm-svn: 245368
2015-08-18 22:10:49 +00:00
David Blaikie fb2b796ecc Wdeprecated: Support movability of EHScopeStack::Cleanup objects as they are move constructed in ConditionalCleanup::restore
llvm-svn: 245367
2015-08-18 22:09:28 +00:00
David Majnemer c6bb0e2a51 [InstSimplify] Don't assume getAggregateElement will succeed
It isn't always possible to get a value from getAggregateElement.
This fixes PR24488.

llvm-svn: 245365
2015-08-18 22:07:25 +00:00
David Majnemer 5eaf08ff1f [VectorUtils] Replace 'llvm::' qualification with 'using llvm'
No funcitonal change is intended, this just makes the file look more
like the rest of LLVM.

llvm-svn: 245364
2015-08-18 22:07:20 +00:00
Alexey Samsonov 0a779d7e3d [Sanitizer] Initialize common flags to default values in unit tests.
llvm-svn: 245363
2015-08-18 21:54:32 +00:00
Alexey Samsonov 9a28358a03 [DFSan] Properly initialize and parse common flags in DFSan.
llvm-svn: 245362
2015-08-18 21:54:29 +00:00
Richard Smith 080056ba5a Range-based-for-convert some loops in ASTWriter. No functionality change intended.
llvm-svn: 245361
2015-08-18 21:53:42 +00:00
Joerg Sonnenberger b0ce8747c3 Load/store instructions for floating points with address space require SparcV9.
To properly handle this, define the *a instructions as separate
instruction classes by refactoring the LoadA and StoreA multiclasses.
Move the instruction tests into the sparcv9 file to test the difference.

llvm-svn: 245360
2015-08-18 21:31:46 +00:00
Chris Bieneman 1e7ac1b99a [autoconf] Fixing reversed logic introduced r245304.
Thanks for the catch Hal!

llvm-svn: 245359
2015-08-18 21:23:44 +00:00
Simon Pilgrim 4bce6d6b73 [X86] Refreshed sign extension tests.
llvm-svn: 245358
2015-08-18 21:21:35 +00:00
Oleksiy Vyalov 6e295cd179 Mark TestCModules as XFAIL on OSX.
http://reviews.llvm.org/D11962

llvm-svn: 245357
2015-08-18 21:20:25 +00:00
Hans Wennborg 7ad173dc8a Release script: correctly symlink clang-tools-extra into the build (PR22765)
llvm-svn: 245355
2015-08-18 21:10:17 +00:00
Eric Fiselier e8fd164569 Move atomic_support.h and config_elast.h into src/include
llvm-svn: 245354
2015-08-18 21:08:54 +00:00
Michael Kruse d568a3e20d Update test case multidim_indirect_access.ll
This test was written to check the workings of IndependentBlocks on
arrays which doesn't do such transformations anymore. The test itself
is still useful to check that the region is rejected as SCoP.  

llvm-svn: 245353
2015-08-18 21:08:41 +00:00
David Blaikie 06abbceebc Workaround -Wdeprecated on SemDiagnosticConsumer's tricksy copy ctor.
llvm-svn: 245352
2015-08-18 20:54:26 +00:00
Simon Pilgrim ce30ae62e2 [X86][AVX] Added shuffle concatenation tests
llvm-svn: 245351
2015-08-18 20:51:15 +00:00
Matthias Braun fa3b248a66 DAGCombiner: Improve DAGCombiner select normalization
The current code normalizes select(C0, x, select(C1, x, y)) towards
select(C0|C1, x, y) if the targets prefers that form. This patch adds an
additional rule that if the select(C1, x, y) part already exists in the
function then we want to normalize into the other direction because the
effects of reusing the existing value are bigger than transforming into
the target preferred form.

This addresses regressions following r238793, see also:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150727/290272.html

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

llvm-svn: 245350
2015-08-18 20:48:36 +00:00
Matthias Braun 2e920bd04f DAGCombiner: Optimize SELECTs first before turning them into SELECT_CC
This is part of http://reviews.llvm.org/D11616 - I just decided to split
this up into a separate commit.

llvm-svn: 245349
2015-08-18 20:48:29 +00:00
Simon Pilgrim edaba3b7c3 Updated constants to give more useful min/max constant folding tests
llvm-svn: 245348
2015-08-18 20:46:48 +00:00