platform/upstream/llvm.git
7 years ago[CodeGen] Add support for emitting .init_array instead of .ctors on FreeBSD.
Davide Italiano [Mon, 26 Sep 2016 22:53:15 +0000 (22:53 +0000)]
[CodeGen] Add support for emitting .init_array instead of .ctors on FreeBSD.

PR: 30494
llvm-svn: 282451

7 years ago[CodeGen] Switch test as FreeBSD will support .init_array soon.
Davide Italiano [Mon, 26 Sep 2016 22:38:17 +0000 (22:38 +0000)]
[CodeGen] Switch test as FreeBSD will support .init_array soon.

llvm-svn: 282450

7 years agoExpect DLL builds on Windows by default and require a custom __config for static
Eric Fiselier [Mon, 26 Sep 2016 22:19:41 +0000 (22:19 +0000)]
Expect DLL builds on Windows by default and require a custom __config for static
builds.

On Windows the __declspec(dllimport) and __declspec(dllexport) attributes
require linking to a DLL, not a static library. Previously these annotations
were disabled by default unless _LIBCPP_DLL was defined. However the DLL
configuration is probably the more common one, so it should be supported by
default.

This patch enables import/export attributes by default and adds a
_LIBCPP_DISABLE_DLL_IMPORT_EXPORT macro which can be used to disable this
behavior. If libc++ is built as a static library on Windows then a custom __config
header will be generated that predefines this macro.

This patch is based off work by Shoaib Meenai.

llvm-svn: 282449

7 years ago[clang-format] Don't allow newline after uppercase Obj-C block return types
Daniel Jasper [Mon, 26 Sep 2016 22:19:08 +0000 (22:19 +0000)]
[clang-format] Don't allow newline after uppercase Obj-C block return types

Fixes the following:
  BOOL (^aaa)(void) = ^BOOL {
  };

The first BOOL's token was getting set to TT_FunctionAnnotationRParen
incorrectly, which was causing an unexpected newline after (^aaa). This
was introduced in r245846.

Patch by Kent Sutherland, thank you!

llvm-svn: 282448

7 years agoheaders: add missing Windows ARM Interlocked intrinsics
Saleem Abdulrasool [Mon, 26 Sep 2016 22:12:43 +0000 (22:12 +0000)]
headers: add missing Windows ARM Interlocked intrinsics

On ARM, there are multiple versions of each of the intrinsics, with
acquire/relaxed/release barrier semantics.

The newly added ones are provided as inline functions here instead of builtins,
since they should only be available on certain archs (arm/aarch64).

This is necessary in order to compile C++ code for ARM in MSVC mode.

Patch by Martin Storsjö!

llvm-svn: 282447

7 years ago[libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2
Oleg Ranevskyy [Mon, 26 Sep 2016 21:39:38 +0000 (21:39 +0000)]
[libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2

Summary: This patch fixes a couple of typos that cause compilation errors when application includes <unordered_map> and enables the libc++'s debugging capabilities.

Reviewers: EricWF

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24883

llvm-svn: 282446

7 years agoFix an issue where LLDB would not accept the --description-verbosity option to 'po...
Enrico Granata [Mon, 26 Sep 2016 21:36:17 +0000 (21:36 +0000)]
Fix an issue where LLDB would not accept the --description-verbosity option to 'po' without an argument after the StringRef refactoring

Fixes rdar://28480275

llvm-svn: 282445

7 years agoNon alloca sections should not keep other sections live.
Rafael Espindola [Mon, 26 Sep 2016 21:34:34 +0000 (21:34 +0000)]
Non alloca sections should not keep other sections live.

This matches the gold behaviour and is important to prevent debug info
from effectively disabling gc.

llvm-svn: 282444

7 years ago[Modules TS] Diagnose 'export' declaration within 'export' declaration.
Richard Smith [Mon, 26 Sep 2016 21:27:23 +0000 (21:27 +0000)]
[Modules TS] Diagnose 'export' declaration within 'export' declaration.

llvm-svn: 282443

7 years ago[WebAssembly] Use the frame pointer instead of the stack pointer
Derek Schuff [Mon, 26 Sep 2016 21:18:03 +0000 (21:18 +0000)]
[WebAssembly] Use the frame pointer instead of the stack pointer

When we have dynamic allocas we have a frame pointer, and
when we're lowering frame indexes we should make sure we use it.

Patch by Jacob Gravelle

Differential Revision: https://reviews.llvm.org/D24889

llvm-svn: 282442

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Mon, 26 Sep 2016 21:11:03 +0000 (21:11 +0000)]
Next set of additional error checks for invalid Mach-O files for the
other load commands that use the Mach::linkedit_data_command type
but not used in llvm libObject code but used in llvm tool code.

This includes LC_FUNCTION_STARTS, LC_SEGMENT_SPLIT_INFO
and LC_DYLIB_CODE_SIGN_DRS load commands.

llvm-svn: 282441

7 years agoMove computation past early return
Aditya Kumar [Mon, 26 Sep 2016 21:01:13 +0000 (21:01 +0000)]
Move computation past early return

Reviewers:
        rafael
        spatel

Differential Revision: https://reviews.llvm.org/D24843

llvm-svn: 282440

7 years ago[libc++] Extension: Make `move` and `forward` constexpr in C++11.
Eric Fiselier [Mon, 26 Sep 2016 20:55:02 +0000 (20:55 +0000)]
[libc++] Extension: Make `move` and `forward` constexpr in C++11.

Summary:
`std::move` and `std::forward` were not marked constexpr in C++11.  This can be very damaging because it makes otherwise constant expressions non-constant. For example:

```
#include <utility>
template <class T>
struct Foo {
  constexpr Foo(T&& tx) :  t(std::move(tx)) {}
  T t;
};
[[clang::require_constant_initialization]] Foo<int> f(42); // Foo should be constant initialized but C++11 move is not constexpr. As a result `f` is an unsafe global.
```

This patch applies `constexpr` to `move` and `forward` as an extension in C++11. Normally the library is not allowed to add `constexpr` because it may be observable to the user. In particular adding constexpr may cause valid code to stop compiling. However these problems only happen in more complex situations, like making `__invoke(...)` constexpr. `forward` and `move` are simply enough that applying `constexpr` is safe.

Note that libstdc++ has offered this extension since at least 4.8.1.

Most of the changes in this patch are simply test cleanups or additions. The main changes in the tests are:

* Fold all `forward_N.fail.cpp` tests into a single `forward.fail.cpp` test using -verify.
* Delete most `move_only_N.fail.cpp` tests because they weren't actually testing anything.
* Fold `move_copy.pass.cpp` and `move_only.pass.cpp` into a single `move.pass.cpp` test.
* Add return type and noexcept tests for `forward` and `move`.

Reviewers: rsmith, mclow.lists, EricWF

Subscribers: K-ballo, loladiro

Differential Revision: https://reviews.llvm.org/D24637

llvm-svn: 282439

7 years agoFix test on windows
Matthias Braun [Mon, 26 Sep 2016 20:48:34 +0000 (20:48 +0000)]
Fix test on windows

llvm-svn: 282438

7 years ago[thinlto] Basic thinlto fdo heuristic
Piotr Padlewski [Mon, 26 Sep 2016 20:37:32 +0000 (20:37 +0000)]
[thinlto] Basic thinlto fdo heuristic

Summary:
This patch improves thinlto importer
by importing 3x larger functions that are called from hot block.

I compared performance with the trunk on spec, and there
were about 2% on povray and 3.33% on milc. These results seems
to be consistant and match the results Teresa got with her simple
heuristic. Some benchmarks got slower but I think they are just
noisy (mcf, xalancbmki, omnetpp)- running the benchmarks again with
more iterations to confirm. Geomean of all benchmarks including the noisy ones
were about +0.02%.

I see much better improvement on google branch with Easwaran patch
for pgo callsite inlining (the inliner actually inline those big functions)
Over all I see +0.5% improvement, and I get +8.65% on povray.
So I guess we will see much bigger change when Easwaran patch will land
(it depends on new pass manager), but it is still worth putting this to trunk
before it.

Implementation details changes:
- Removed CallsiteCount.
- ProfileCount got replaced by Hotness
- hot-import-multiplier is set to 3.0 for now,
didn't have time to tune it up, but I see that we get most of the interesting
functions with 3, so there is no much performance difference with higher, and
binary size doesn't grow as much as with 10.0.

Reviewers: eraman, mehdi_amini, tejohnson

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D24638

llvm-svn: 282437

7 years agoadded Linux support for test timeout sampling
Todd Fiala [Mon, 26 Sep 2016 20:25:47 +0000 (20:25 +0000)]
added Linux support for test timeout sampling

This is the Linux counterpart to the sampling support I added
on the macOS side.

This change also introduces zip-file compression if the size of
the sample output is greater than 10 KB.  The Linux side can be
quite large and the textual content is averaging over a 10x
compression factor on tests that I force to time out.  When
compression takes place, the filename becomes:

    {session_dir}/{TestFilename.py}-{pid}.sample.zip

This support relies on the linux 'perf' tool.  If it isn't
present, the behavior is to ignore pre-kill processing of
the timed out test process.

Note calling the perf tool under the timeout command appears
to nuke the profiled process.  This was causing the timeout
kill logic to fail due to the process having disappeared.
I modified the kill logic to catch the case of the process
not existing, and I have it ignore the kill request in that
case.  Any other exception is still raised.

Reviewers: labath

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D24890

llvm-svn: 282436

7 years ago[include] Declare __STDC_*_MACROS for C++11 compat in old libc
Michal Gorny [Mon, 26 Sep 2016 20:20:00 +0000 (20:20 +0000)]
[include] Declare __STDC_*_MACROS for C++11 compat in old libc

Declare __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and
__STDC_CONSTANT_MACROS before including real inttypes.h/stdint.h when
the wrapper-header is included in C++11, in order to enable
the necessary macros in C99-compliant libc.

The C99 standard defined that the format macros in inttypes.h should be
defined by the C++ implementations only when __STDC_FORMAT_MACROS is
defined, and the limit and constant macros in stdint.h should be defined
only when __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined
appropriately. Following this specification, multiple old versions of
glibc up to 2.17 do not define those macros by default for C++,
rendering the libc++ headers non-compliant to the C++11 standard.

In order to achieve the necessary compliance, __STDC_FORMAT_MACROS is
defined in wrapped inttypes.h just before including the system
inttypes.h, when C++11 or newer is used. Both __STDC_LIMIT_MACROS
and __STDC_CONSTANT_MACROS are defined in newly-wrapped stdint.h. This
fixes the C++11 compliance while preserving the current behavior for
C++03.

Differential Revision: https://reviews.llvm.org/D24903

llvm-svn: 282435

7 years agoAdded a setting that enables saving all .o files from a given JIT expression.
Sean Callanan [Mon, 26 Sep 2016 20:18:51 +0000 (20:18 +0000)]
Added a setting that enables saving all .o files from a given JIT expression.

This allows debugging of the JIT and other analyses of the internals of the
expression parser.  I've also added a testcase that verifies that the setting
works correctly when off and on.

llvm-svn: 282434

7 years agoAllow StringRef to be constructed from a null pointer.
Zachary Turner [Mon, 26 Sep 2016 20:08:05 +0000 (20:08 +0000)]
Allow StringRef to be constructed from a null pointer.

Differential Revision: https://reviews.llvm.org/D24904

llvm-svn: 282433

7 years agoFix serialization of Python breakpoint commands.
Jim Ingham [Mon, 26 Sep 2016 19:47:37 +0000 (19:47 +0000)]
Fix serialization of Python breakpoint commands.

CommandData breakpoint commands didn't know whether they were
Python or Command line commands, so they couldn't serialize &
deserialize themselves properly.  Fix that.
I also changed the "breakpoint list" command to note in the output
when the commands are Python commands.  Fortunately only one test
was relying on this explicit bit of text output.

llvm-svn: 282432

7 years agoAdd support for Code16GCC
Nirav Dave [Mon, 26 Sep 2016 19:33:36 +0000 (19:33 +0000)]
Add support for Code16GCC

[X86] The .code16gcc directive parses X86 assembly input in 32-bit mode and
outputs in 16-bit mode. Teach parser to switch modes appropriately.

Reviewers: dwmw2, craig.topper

Subscribers: llvm-commits

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

llvm-svn: 282430

7 years ago[ELF] - Linkerscript: implemented BYTE/SHORT/LONG/QUAD commands.
George Rimar [Mon, 26 Sep 2016 19:22:50 +0000 (19:22 +0000)]
[ELF] - Linkerscript: implemented BYTE/SHORT/LONG/QUAD commands.

The BYTE, SHORT, LONG, and QUAD commands store one, two, four, and eight bytes (respectively).
After storing the bytes, the location counter is incremented by the number of bytes
stored.

Previously our scripts handles these commands incorrectly. For example:
SECTIONS  {
  .foo : {
 *(.foo.1)
 BYTE(0x11)
...
We accepted the script above treating BYTE as input section description.
These commands are used in the wild though.

Differential revision: https://reviews.llvm.org/D24830

llvm-svn: 282429

7 years agoAdd optimization bisect support to an optional Mips pass
Andrew Kaylor [Mon, 26 Sep 2016 19:05:37 +0000 (19:05 +0000)]
Add optimization bisect support to an optional Mips pass

Differential Revision: https://reviews.llvm.org/D19513

llvm-svn: 282428

7 years ago[ELF] - Fix for: Bug 30521 - lld exits non-zero return value linking a library with...
George Rimar [Mon, 26 Sep 2016 19:04:42 +0000 (19:04 +0000)]
[ELF] - Fix for: Bug 30521 - lld exits non-zero return value linking a library with no entry symbol

PR30521 was about linking shared library. After r282295 code when linking -shared produced
"entry symbol not found" warning, what in combination with --fatal-errors failed linkage.

Patch fixes logic (and adds testcases) to follow next rules:

1) If entry was specified and not found report warning.
2) If entry was not specified then:
 a) Emit warning if not -shared.
 b) Do not emit warning if -shared.

Differential revision: https://reviews.llvm.org/D24913

llvm-svn: 282427

7 years agoCC1: Add -save-stats option
Matthias Braun [Mon, 26 Sep 2016 18:53:34 +0000 (18:53 +0000)]
CC1: Add -save-stats option

This option behaves in a similar spirit as -save-temps and writes
internal llvm statistics in json format to a file.

Differential Revision: https://reviews.llvm.org/D24820

llvm-svn: 282426

7 years agoStatistic: Only print statistics on exit for -stats
Matthias Braun [Mon, 26 Sep 2016 18:38:07 +0000 (18:38 +0000)]
Statistic: Only print statistics on exit for -stats

Previously enabling the statistics with EnableStatistics() would lead to
them getting printed to stderr/-info-output-file on exit. However
frontends may want a way to enable statistics and do the printing on
their own instead of the forced printing on exit.

This changes the code so that only the -stats option enables printing on
exit, EnableStatistics() only enables the tracking but requires invoking
one of the PrintStatistics() variants.

Differential Revision: https://reviews.llvm.org/D24819

llvm-svn: 282425

7 years agoMachineInstr: Fix comment typo, further refine comment; NFC
Matthias Braun [Mon, 26 Sep 2016 18:38:05 +0000 (18:38 +0000)]
MachineInstr: Fix comment typo, further refine comment; NFC

llvm-svn: 282424

7 years ago[AArch64] Fix test triplet
Evandro Menezes [Mon, 26 Sep 2016 18:09:21 +0000 (18:09 +0000)]
[AArch64] Fix test triplet

Specify proper target triplet to pass under Windows too.

llvm-svn: 282423

7 years ago[llvm-cov] Silence a warning from the MSVC runtime (NFC)
Vedant Kumar [Mon, 26 Sep 2016 17:57:13 +0000 (17:57 +0000)]
[llvm-cov] Silence a warning from the MSVC runtime (NFC)

Rework getLongestCommonPrefixLen() so that it doesn't access string null
terminators. The old version with std::mismatch would do this:

                        |
                        v
    Strings[0] = ['a', nil]

    Strings[1] = ['a', 'a', nil]
                        ^
                        |

This should silence a warning from the MSVC runtime (PR30515). As
before, I tested this out by preparing a coverage report for FileCheck.
Thanks to Yaron Keren for the report!

llvm-svn: 282422

7 years agoUpdate MemorySSA unittest to account for non-pruned SSA form
Daniel Berlin [Mon, 26 Sep 2016 17:44:31 +0000 (17:44 +0000)]
Update MemorySSA unittest to account for non-pruned SSA form

llvm-svn: 282421

7 years agoAMDGPU/SI: Don't crash on anonymous GlobalValues
Tom Stellard [Mon, 26 Sep 2016 17:29:25 +0000 (17:29 +0000)]
AMDGPU/SI: Don't crash on anonymous GlobalValues

Summary:
We need to call AsmPrinter::getNameWithPrefix() in order to handle
anonymous GlobalValues (e.g. @0, @1).

Reviewers: arsenm, b-sumner

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D24865

llvm-svn: 282420

7 years agoRemove pruning of phi nodes in MemorySSA - it makes updating harder
Daniel Berlin [Mon, 26 Sep 2016 17:22:54 +0000 (17:22 +0000)]
Remove pruning of phi nodes in MemorySSA - it makes updating harder

Reviewers: george.burgess.iv

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24923

llvm-svn: 282419

7 years ago[LV] Scalarize instructions marked scalar after vectorization
Matthew Simpson [Mon, 26 Sep 2016 17:08:37 +0000 (17:08 +0000)]
[LV] Scalarize instructions marked scalar after vectorization

This patch ensures that we actually scalarize instructions marked scalar after
vectorization. Previously, such instructions may have been vectorized instead.

Differential Revision: https://reviews.llvm.org/D23889

llvm-svn: 282418

7 years agoComplete support for the cxxCtorInitializer() AST matcher so that it can be used...
Aaron Ballman [Mon, 26 Sep 2016 17:04:27 +0000 (17:04 +0000)]
Complete support for the cxxCtorInitializer() AST matcher so that it can be used as a top-level matcher.

llvm-svn: 282417

7 years ago[ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.
Haojian Wu [Mon, 26 Sep 2016 16:01:52 +0000 (16:01 +0000)]
[ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.

Reviewers: klimek

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D24821

llvm-svn: 282415

7 years ago[Coroutines] Part14: Handle coroutines with no suspend points.
Gor Nishanov [Mon, 26 Sep 2016 15:49:28 +0000 (15:49 +0000)]
[Coroutines] Part14: Handle coroutines with no suspend points.

Summary:
If coroutine has no suspend points, remove heap allocation and turn a coroutine into a normal function.

Also, if a pattern is detected that coroutine resumes or destroys itself prior to coro.suspend call, turn the suspend point into a simple jump to resume or cleanup label. This pattern occurs when coroutines are used to propagate errors in functions that return expected<T>.

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D24408

llvm-svn: 282414

7 years ago[AArch64] Improve add/sub/cmp isel of uxtw forms.
Geoff Berry [Mon, 26 Sep 2016 15:34:47 +0000 (15:34 +0000)]
[AArch64] Improve add/sub/cmp isel of uxtw forms.

Don't match the UXTW extended reg forms of ADD/ADDS/SUB/SUBS if the
32-bit to 64-bit zero-extend can be done for free by taking advantage
of the 32-bit defining instruction zeroing the upper 32-bits of the X
register destination.  This enables better instruction selection in a
few cases, such as:

  sub x0, xzr, x8
  instead of:
  mov x8, xzr
  sub x0, x8, w9, uxtw

  madd x0, x1, x1, x8
  instead of:
  mul x9, x1, x1
  add x0, x9, w8, uxtw

  cmp x2, x8
  instead of:
  sub x8, x2, w8, uxtw
  cmp x8, #0

  add x0, x8, x1, lsl #3
  instead of:
  lsl x9, x1, #3
  add x0, x9, w8, uxtw

Reviewers: t.p.northover, jmolloy

Subscribers: mcrosier, aemerson, llvm-commits, rengolin

Differential Revision: https://reviews.llvm.org/D24747

llvm-svn: 282413

7 years agoAdd support to optionally limit the size of jump tables.
Evandro Menezes [Mon, 26 Sep 2016 15:32:33 +0000 (15:32 +0000)]
Add support to optionally limit the size of jump tables.

Many high-performance processors have a dedicated branch predictor for
indirect branches, commonly used with jump tables.  As sophisticated as such
branch predictors are, they tend to have well defined limits beyond which
their effectiveness is hampered or even nullified.  One such limit is the
number of possible destinations for a given indirect branches that such
branch predictors can handle.

This patch considers a limit that a target may set to the number of
destination addresses in a jump table.

Patch by: Evandro Menezes <e.menezes@samsung.com>, Aditya Kumar
<aditya.k7@samsung.com>, Sebastian Pop <s.pop@samsung.com>.

Differential revision: https://reviews.llvm.org/D21940

llvm-svn: 282412

7 years ago[analyzer] Improve CastToStruct checker so it can also detect widening casts of struc...
Daniel Marjamaki [Mon, 26 Sep 2016 15:17:18 +0000 (15:17 +0000)]
[analyzer] Improve CastToStruct checker so it can also detect widening casts of struct data

Example:

struct AB {
  int A;
  int B;
};

struct ABC {
  int A;
  int B;
  int C;
};

void f() {
  struct AB Data;
  struct ABC *P = (struct ABC *)&Data;
}

Differential Revision: https://reviews.llvm.org/D23508

llvm-svn: 282411

7 years agoclang-format: Only special-case top-level */& in multivar-declstmts.
Daniel Jasper [Mon, 26 Sep 2016 15:14:24 +0000 (15:14 +0000)]
clang-format: Only special-case top-level */& in multivar-declstmts.

Before (even with PointerAlignment: Left):
  vector<int *> a, b;

After:
  vector<int*> a, b;

llvm-svn: 282410

7 years agoSilence a false positive with the cert-err58-cpp check; now allows objects with stati...
Aaron Ballman [Mon, 26 Sep 2016 15:00:45 +0000 (15:00 +0000)]
Silence a false positive with the cert-err58-cpp check; now allows objects with static or thread storage duration at function block scope.

Patch by Malcolm Parsons

llvm-svn: 282409

7 years agoRemove ancient icc decorators
Pavel Labath [Mon, 26 Sep 2016 14:34:02 +0000 (14:34 +0000)]
Remove ancient icc decorators

Nobody is running the test suite with icc, so we have no idea if they pass. But
the bug they link to has definitely been fixed.

llvm-svn: 282408

7 years agotsan: relaxed check in CheckShadowMapping
Dmitry Vyukov [Mon, 26 Sep 2016 14:23:34 +0000 (14:23 +0000)]
tsan: relaxed check in CheckShadowMapping

Some platforms use strange addresses in shadow mapping.
E.g. aarch64/42vma:
  static const uptr kHiAppMemEnd   = 0x3ffffffffffull;
instead of 0x40000000000ull (the range is half-open).
This caused bot failures after r282405:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12242/steps/ninja%20check%201/logs/FAIL%3A%20SanitizerCommon-tsan-aarch64-Linux%3A%3Aclock_gettime.c
Relaxed the new check in CheckShadowMapping to not expect round addresses.

llvm-svn: 282407

7 years agoRemove an ancient XFAIL from TestBuiltinTrap
Pavel Labath [Mon, 26 Sep 2016 13:50:06 +0000 (13:50 +0000)]
Remove an ancient XFAIL from TestBuiltinTrap

in refers to gcc-4.6. Hopefully noone is using that anymore, and I think there is
a good chance it was fixed anyway.

llvm-svn: 282406

7 years agotsan: make shadow mapping linear within a single user region
Dmitry Vyukov [Mon, 26 Sep 2016 13:41:33 +0000 (13:41 +0000)]
tsan: make shadow mapping linear within a single user region

This is a follow up to r282152.
A more extensive testing on real apps revealed a subtle bug in r282152.
The revision made shadow mapping non-linear even within a single
user region. But there are lots of code in runtime that processes
memory ranges and assumes that mapping is linear. For example,
region memory access handling simply increments shadow address
to advance to the next shadow cell group. Similarly, DontNeedShadowFor,
java memory mover, search of heap memory block header, etc
make similar assumptions.
To trigger the bug user range would need to cross 0x008000000000 boundary.
This was observed for a module data section.

Make shadow mapping linear within a single user range again.
Add a startup CHECK for linearity.

llvm-svn: 282405

7 years agotsan: remove kMidShadowOff mapping parameter
Dmitry Vyukov [Mon, 26 Sep 2016 13:27:07 +0000 (13:27 +0000)]
tsan: remove kMidShadowOff mapping parameter

kMidShadowOff is trivially computable from other parameters.
Remove it.

llvm-svn: 282404

7 years agotsan: simplify meta mapping
Dmitry Vyukov [Mon, 26 Sep 2016 13:24:48 +0000 (13:24 +0000)]
tsan: simplify meta mapping

Don't xor user address with kAppMemXor in meta mapping.
The only purpose of kAppMemXor is to raise shadow for ~0 user addresses,
so that they don't map to ~0 (which would cause overlap between
user memory and shadow).
For meta mapping we explicitly add kMetaShadowBeg offset,
so we don't need to additionally raise meta shadow.

llvm-svn: 282403

7 years agoIn the get started page, also explain how to start the testsuite
Sylvestre Ledru [Mon, 26 Sep 2016 13:22:34 +0000 (13:22 +0000)]
In the get started page, also explain how to start the testsuite

llvm-svn: 282402

7 years ago[InstCombine] Fixed bug introduced in r282237
Alexey Bataev [Mon, 26 Sep 2016 13:18:59 +0000 (13:18 +0000)]
[InstCombine] Fixed bug introduced in r282237

The index of the new insertelement instruction was evaluated in the
wrong way, it was considered as the index of the inserted value instead
of index of the position, where the value should be inserted.

llvm-svn: 282401

7 years agoupdate the link to the code coverage
Sylvestre Ledru [Mon, 26 Sep 2016 12:53:53 +0000 (12:53 +0000)]
update the link to the code coverage

llvm-svn: 282400

7 years agoFix typo in comment, NFC
Krzysztof Parzyszek [Mon, 26 Sep 2016 12:38:03 +0000 (12:38 +0000)]
Fix typo in comment, NFC

llvm-svn: 282399

7 years ago[InstCombine] Teach the udiv folding logic how to handle constant expressions.
Andrea Di Biagio [Mon, 26 Sep 2016 12:07:23 +0000 (12:07 +0000)]
[InstCombine] Teach the udiv folding logic how to handle constant expressions.

This patch fixes PR30366.

Function foldUDivShl() worked under the assumption that one of the values
in input to the function was always an instance of llvm::Instruction.
However, function visitUDivOperand() (the only user of foldUDivShl) was
clearly violating that precondition; internally, visitUDivOperand() uses pattern
matches to check the operands of a udiv. Pattern matchers for binary operators
know how to handle both Instruction and ConstantExpr values.

This patch fixes the problem in foldUDivShl(). Now we use pattern matchers
instead of explicit casts to Instruction. The reduced test case from PR30366
has been added to test file InstCombine/udiv-simplify.ll.

Differential Revision: https://reviews.llvm.org/D24565

llvm-svn: 282398

7 years ago[AVR] Add AVRMCExpr
Dylan McKay [Mon, 26 Sep 2016 11:35:32 +0000 (11:35 +0000)]
[AVR] Add AVRMCExpr

Summary: This adds the AVRMCExpr headers and implementation.

Reviewers: arsenm, ruiu, grosbach, kparzysz

Subscribers: wdng, beanz, mgorny, kparzysz, jtbandes, llvm-commits

Differential Revision: https://reviews.llvm.org/D20503

llvm-svn: 282397

7 years agoRevert "[AMDGPU] Disassembler: print label names in branch instructions"
Sam Kolton [Mon, 26 Sep 2016 11:29:03 +0000 (11:29 +0000)]
Revert "[AMDGPU] Disassembler: print label names in branch instructions"

This reverts commit 6c6dbe625263ec9fcf8de0df27263cf147cde550.

llvm-svn: 282396

7 years ago[ELF] - Format. NFC.
George Rimar [Mon, 26 Sep 2016 11:00:48 +0000 (11:00 +0000)]
[ELF] - Format. NFC.

llvm-svn: 282395

7 years ago[AMDGPU] Disassembler: print label names in branch instructions
Sam Kolton [Mon, 26 Sep 2016 10:05:50 +0000 (10:05 +0000)]
[AMDGPU] Disassembler: print label names in branch instructions

Summary: Add AMDGPUSymbolizer for finding names for labels from ELF symbol table.

Reviewers: vpykhtin, artem.tamazov, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

Differential Revision: https://reviews.llvm.org/D24802

llvm-svn: 282394

7 years agoLinkerscript: don't crash when GC .debug_line
Eugene Leviant [Mon, 26 Sep 2016 09:04:16 +0000 (09:04 +0000)]
Linkerscript: don't crash when GC .debug_line

Differential revision: https://reviews.llvm.org/D24870

llvm-svn: 282393

7 years agoLinkerscript: do not GC non-allocated sections
Eugene Leviant [Mon, 26 Sep 2016 08:32:41 +0000 (08:32 +0000)]
Linkerscript: do not GC non-allocated sections

Differential revision: https://reviews.llvm.org/D24733

llvm-svn: 282391

7 years ago[msan] Fix second parameter in MsanReallocate from previous commit.
Maxim Ostapenko [Mon, 26 Sep 2016 08:26:23 +0000 (08:26 +0000)]
[msan] Fix second parameter in MsanReallocate from previous commit.

It's wrong to pass to MsanReallocate a pointer that MSan allocator doesn't own.
Use nullptr instead of ptr to prevent possible (still unlikely) failure.

llvm-svn: 282390

7 years ago[asan, msan] Fix reallocation logic when IsInDlsymAllocPool(ptr) is true.
Maxim Ostapenko [Mon, 26 Sep 2016 08:11:21 +0000 (08:11 +0000)]
[asan, msan] Fix reallocation logic when IsInDlsymAllocPool(ptr) is true.

llvm-svn: 282389

7 years ago[clang-rename] Use checktime when reloading vim buffer after applying clang-rename
Kirill Bobyrev [Mon, 26 Sep 2016 07:26:32 +0000 (07:26 +0000)]
[clang-rename] Use checktime when reloading vim buffer after applying clang-rename

After applying `clang-rename` to a vim buffer (using `clang-rename.py` as part
of the vim integration) the buffer gets reloaded using `bufdo`. This solution is
suboptimal, since syntax highlighting is turned off for performance reasons and
never turned on, after all changes to the source file have been applied.

A better solution to this is using `checktime`. It is exactly designed for this
kind of task and doesn't have the syntax highlighting issue.

Patch by Kai Wolf!

Reviewers: omtcyfz

Differential Revision: https://reviews.llvm.org/D24791

llvm-svn: 282388

7 years ago[ARM] Promote small global constants to constant pools
James Molloy [Mon, 26 Sep 2016 07:26:24 +0000 (07:26 +0000)]
[ARM] Promote small global constants to constant pools

If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

This recommit contains fixes for a nasty bug related to fast-isel fallback - because
fast-isel doesn't know about this optimization, if it runs and emits references to
a string that we inline (because fast-isel fell back to SDAG) we will end up
with an inlined string and also an out-of-line string, and we won't emit the
out-of-line string, causing backend failures.

It also contains fixes for emitting .text relocations which made the sanitizer
bots unhappy.

llvm-svn: 282387

7 years ago[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions
Kirill Bobyrev [Mon, 26 Sep 2016 07:22:37 +0000 (07:22 +0000)]
[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions

This patch extends clang-tidy's readability-redundant-smartptr-get to produce
warnings for previously unsupported cases:

```
std::unique_ptr<void> ptr;
if (ptr.get())
if (ptr.get() == NULL)
if (ptr.get() != NULL)
```

This is intended to fix https://llvm.org/bugs/show_bug.cgi?id=25804, a bug
report opened by @Eugene.Zelenko.

However, there still are cases not detected by the check. They can be found in
`void Negative()` function defined in
test/clang-tidy/readability-redundant-smartptr-get.cpp.

Reviewers: alexfh

Differential Revision: https://reviews.llvm.org/D24893

llvm-svn: 282386

7 years ago[X86] Optimization for replacing LEA with MOV at frame index elimination time
Zvi Rackover [Mon, 26 Sep 2016 06:42:07 +0000 (06:42 +0000)]
[X86] Optimization for replacing LEA with MOV at frame index elimination time

Summary:
Replace a LEA instruction of the form 'lea (%esp), %ebx' --> 'mov %esp, %ebx'

MOV is preferable over LEA because usually there are more issue-slots available to execute MOVs than LEAs. Latest processors also support zero-latency MOVs.

Fixes pr29022.

Reviewers: hfinkel, delena, igorb, myatsina, mkuper

Differential Revision: https://reviews.llvm.org/D24705

llvm-svn: 282385

7 years agoRevert r282382; it had no reference to Revision.
Kirill Bobyrev [Mon, 26 Sep 2016 06:33:58 +0000 (06:33 +0000)]
Revert r282382; it had no reference to Revision.

llvm-svn: 282384

7 years ago[PM] Refactor this unittest a bit to remove duplicated code. This was
Chandler Carruth [Mon, 26 Sep 2016 06:29:21 +0000 (06:29 +0000)]
[PM] Refactor this unittest a bit to remove duplicated code. This was
suggested at one point during code review and I deferred it to
a follow-up commit.

llvm-svn: 282383

7 years ago[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions
Kirill Bobyrev [Mon, 26 Sep 2016 06:22:54 +0000 (06:22 +0000)]
[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions

This patch extends clang-tidy's readability-redundant-smartptr-get to produce
warnings for previously unsupported cases:

```
std::unique_ptr<void> ptr;
if (ptr.get())
if (ptr.get() == NULL)
if (ptr.get() != NULL)
```

This is intended to fix https://llvm.org/bugs/show_bug.cgi?id=25804, a bug
report opened by @Eugene.Zelenko.

However, there still are cases not detected by the check. They can be found in
`void Negative()` function defined in
test/clang-tidy/readability-redundant-smartptr-get.cpp.

llvm-svn: 282382

7 years ago[X86][avx512] Fix bug in masked compress store.
Ayman Musa [Mon, 26 Sep 2016 06:22:08 +0000 (06:22 +0000)]
[X86][avx512] Fix bug in masked compress store.

Differential Revision: https://reviews.llvm.org/D23984

llvm-svn: 282381

7 years ago[SCEV] Fix the order of members in the initializer list.
Chandler Carruth [Mon, 26 Sep 2016 04:49:58 +0000 (04:49 +0000)]
[SCEV] Fix the order of members in the initializer list.

Noticed due to the warning on this line. Sanjoy is on
a less-than-awesome internet connection, so committing on his behalf.

llvm-svn: 282380

7 years agoDriver: avoid failing in the backend
Saleem Abdulrasool [Mon, 26 Sep 2016 04:48:22 +0000 (04:48 +0000)]
Driver: avoid failing in the backend

Avoid failing in the backend when the rewrite map does not exist.  Rather check
that the map exists in the frontend before handing it off to the backend.  Add
the missing rewrite maps that the tests were referencing.

llvm-svn: 282379

7 years ago[PM] Add a unittest covering the invalidation of a Module analysis from
Chandler Carruth [Mon, 26 Sep 2016 04:17:12 +0000 (04:17 +0000)]
[PM] Add a unittest covering the invalidation of a Module analysis from
a function pass nested inside of a CGSCC pass manager.

This is very similar to the previous unittest but makes sure the
invalidation logic works across all the layers here.

llvm-svn: 282378

7 years ago[PM] Add a unittest for invalidating module analyses with an SCC pass.
Chandler Carruth [Mon, 26 Sep 2016 04:01:55 +0000 (04:01 +0000)]
[PM] Add a unittest for invalidating module analyses with an SCC pass.

This reinstates r280447. Original commit log:
This wasn't really well explicitly tested with a nice unittest before.
It seems good to have reasonably broken out unittests for this kind of
functionality as I'm workin go other invalidation features to make sure
none of the existing ones regress.

This still has too much duplicated code, I plan to factor that out in
a subsequent commit to use common helpers for repeated parts of this.

llvm-svn: 282377

7 years ago[SCEV] Assign LoopPropertiesCache in the move constructor
Sanjoy Das [Mon, 26 Sep 2016 02:44:10 +0000 (02:44 +0000)]
[SCEV] Assign LoopPropertiesCache in the move constructor

In a previous change I collapsed two different caches into one.  When
doing that I noticed that ScalarEvolution's move constructor was not
moving those caches.

To keep the previous change simple, I've moved that bugfix into this
separate change.

llvm-svn: 282376

7 years ago[SCEV] Combine two predicates into one; NFC
Sanjoy Das [Mon, 26 Sep 2016 02:44:07 +0000 (02:44 +0000)]
[SCEV] Combine two predicates into one; NFC

Both `loopHasNoSideEffects` and `loopHasNoAbnormalExits` involve walking
the loop and maintaining similar sorts of caches.  This commit changes
SCEV to compute both the predicates via a single walk, and maintain a
single cache instead of two.

llvm-svn: 282375

7 years ago[SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage
Sanjoy Das [Mon, 26 Sep 2016 01:10:27 +0000 (01:10 +0000)]
[SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage

Specifically, it moves SCEVUnionPredicates from its input into its own
storage.  Make this obvious at the type level.

llvm-svn: 282374

7 years ago[SCEV] Further isolate incidental data structure; NFC
Sanjoy Das [Mon, 26 Sep 2016 01:10:25 +0000 (01:10 +0000)]
[SCEV] Further isolate incidental data structure; NFC

llvm-svn: 282373

7 years ago[SCEV] Simplify BackedgeTakenInfo::getMax; NFC
Sanjoy Das [Mon, 26 Sep 2016 01:10:22 +0000 (01:10 +0000)]
[SCEV] Simplify BackedgeTakenInfo::getMax; NFC

llvm-svn: 282372

7 years ago[AMDGPU] Expose flat work group size, register and wave control attributes
Konstantin Zhuravlyov [Mon, 26 Sep 2016 01:02:57 +0000 (01:02 +0000)]
[AMDGPU] Expose flat work group size, register and wave control attributes

__attribute__((amdgpu_flat_work_group_size(<min>, <max>))) - request minimum and maximum flat work group size
__attribute__((amdgpu_waves_per_eu(<min>[, <max>]))) - request minimum and/or maximum waves per execution unit

Differential Revision: https://reviews.llvm.org/D24513

llvm-svn: 282371

7 years agoAppease MSVC
Sanjoy Das [Mon, 26 Sep 2016 00:22:18 +0000 (00:22 +0000)]
Appease MSVC

... by not default move constructors and operator= s. Defaulting these
works in clang, but not in MSVC.

llvm-svn: 282370

7 years agoAttempt to appease MSVC
Sanjoy Das [Mon, 26 Sep 2016 00:00:51 +0000 (00:00 +0000)]
Attempt to appease MSVC

... by explicitly deleting the copy constructor.

llvm-svn: 282369

7 years ago[SCEV] Reserve space in SmallVector; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:08 +0000 (23:12 +0000)]
[SCEV] Reserve space in SmallVector; NFC

llvm-svn: 282368

7 years ago[SCEV] Document a gotcha; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:06 +0000 (23:12 +0000)]
[SCEV] Document a gotcha; NFC

We should re-consider the design decision that led to this gotcah, but
for now just document it.

llvm-svn: 282367

7 years ago[SCEV] Have ExitNotTakenInfo keep a pointer to its predicate; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:04 +0000 (23:12 +0000)]
[SCEV] Have ExitNotTakenInfo keep a pointer to its predicate; NFC

SCEVUnionPredicate is a "heavyweight" structure, so it is beneficial to
store the (optional) data out of line.

llvm-svn: 282366

7 years ago[SCEV] Simplify tracking ExitNotTakenInfo instances; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:00 +0000 (23:12 +0000)]
[SCEV] Simplify tracking ExitNotTakenInfo instances; NFC

This change simplifies a data structure optimization in the
`BackedgeTakenInfo` class for loops with exactly one computable exit.

I've sanity checked that this does not regress compile time performance,
using sqlite3's amalgamated build.

llvm-svn: 282365

7 years ago[SCEV] Rename a couple of fields; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:11:57 +0000 (23:11 +0000)]
[SCEV] Rename a couple of fields; NFC

llvm-svn: 282364

7 years ago[SCEV] Remove incidental data structure; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:11:55 +0000 (23:11 +0000)]
[SCEV] Remove incidental data structure; NFC

llvm-svn: 282363

7 years ago[SCEV] Clang format most of the SCEV header; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:11:51 +0000 (23:11 +0000)]
[SCEV] Clang format most of the SCEV header; NFC

The indentation for the declared classes was not as per LLVM coding
style.

llvm-svn: 282362

7 years ago[X86] Remove what appears to be leftover MMX code involving (v1i64 scalar_to_vector).
Craig Topper [Sun, 25 Sep 2016 16:34:11 +0000 (16:34 +0000)]
[X86] Remove what appears to be leftover MMX code involving (v1i64 scalar_to_vector).

llvm-svn: 282361

7 years ago[X86] Remove patterns for scalar_to_vector from FR32/FR64 to 256-bit vectors. Lowerin...
Craig Topper [Sun, 25 Sep 2016 16:34:09 +0000 (16:34 +0000)]
[X86] Remove patterns for scalar_to_vector from FR32/FR64 to 256-bit vectors. Lowering explicitly avoids creating this pattern.

llvm-svn: 282360

7 years ago[AVX-512] Replace get512BitSuperRegister with calls to TargetRegisterInfo::getMatchin...
Craig Topper [Sun, 25 Sep 2016 16:34:06 +0000 (16:34 +0000)]
[AVX-512] Replace get512BitSuperRegister with calls to TargetRegisterInfo::getMatchingSuperReg.

llvm-svn: 282359

7 years ago[AVX-512] Fix some patterns predicates to properly enforce priority for various versi...
Craig Topper [Sun, 25 Sep 2016 16:34:02 +0000 (16:34 +0000)]
[AVX-512] Fix some patterns predicates to properly enforce priority for various versions of CVTDQ2PD instruction.

llvm-svn: 282358

7 years ago[AVX-512] Add rounding versions of instructions to hasUndefRegUpdate.
Craig Topper [Sun, 25 Sep 2016 16:33:59 +0000 (16:33 +0000)]
[AVX-512] Add rounding versions of instructions to hasUndefRegUpdate.

llvm-svn: 282357

7 years ago[AVX-512] Add the scalar unsigned integer to fp conversion instructions to hasUndefRe...
Craig Topper [Sun, 25 Sep 2016 16:33:57 +0000 (16:33 +0000)]
[AVX-512] Add the scalar unsigned integer to fp conversion instructions to hasUndefRegUpdate.

llvm-svn: 282356

7 years ago[AVX-512] Remove duplicate instructions for converting integer to scalar floating...
Craig Topper [Sun, 25 Sep 2016 16:33:53 +0000 (16:33 +0000)]
[AVX-512] Remove duplicate instructions for converting integer to scalar floating point. We can use patterns to point to the other instructions instead.

llvm-svn: 282355

7 years agoUpdate -verify test to use new static assert message
Eric Fiselier [Sun, 25 Sep 2016 08:30:05 +0000 (08:30 +0000)]
Update -verify test to use new static assert message

llvm-svn: 282352

7 years agowww: add new code coverage link to Polly website
Tobias Grosser [Sun, 25 Sep 2016 08:03:38 +0000 (08:03 +0000)]
www: add new code coverage link to Polly website

llvm-svn: 282351

7 years agoAdd a comment on StringRef::contains(char)
Zachary Turner [Sun, 25 Sep 2016 04:06:39 +0000 (04:06 +0000)]
Add a comment on StringRef::contains(char)

llvm-svn: 282350

7 years agoFix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function
Eric Fiselier [Sun, 25 Sep 2016 04:05:46 +0000 (04:05 +0000)]
Fix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function

llvm-svn: 282349

7 years agoFix signed / unsigned comparison.
Zachary Turner [Sun, 25 Sep 2016 03:57:34 +0000 (03:57 +0000)]
Fix signed / unsigned comparison.

llvm-svn: 282348

7 years ago[libc++] Remove various C++03 feature test macros
Eric Fiselier [Sun, 25 Sep 2016 03:34:28 +0000 (03:34 +0000)]
[libc++] Remove various C++03 feature test macros

Summary:
Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`.

This patch removes the __config macros:

* _LIBCPP_HAS_NO_TRAILING_RETURN
* _LIBCPP_HAS_NO_TEMPLATE_ALIASES
* _LIBCPP_HAS_NO_ADVANCED_SFINAE
* _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
* _LIBCPP_HAS_NO_STATIC_ASSERT

As a drive I also changed our C++03 static_assert to use _Static_assert if available.

I plan to commit this without review if nobody voices an objection.

Reviewers: mclow.lists

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D24895

llvm-svn: 282347