platform/upstream/llvm.git
7 years ago[Coroutines] Part12: Handle alloca address-taken
Gor Nishanov [Mon, 5 Sep 2016 23:45:45 +0000 (23:45 +0000)]
[Coroutines] Part12: Handle alloca address-taken

Summary:
Move early uses of spilled variables after CoroBegin.

For example, if a parameter had address taken, we may end up with the code
like:
        define @f(i32 %n) {
          %n.addr = alloca i32
          store %n, %n.addr
          ...
          call @coro.begin

This patch fixes the problem by moving uses of spilled variables after CoroBegin.

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 280678

7 years ago[InstCombine] don't assert that division-by-constant has been folded (PR30281)
Sanjay Patel [Mon, 5 Sep 2016 23:38:22 +0000 (23:38 +0000)]
[InstCombine] don't assert that division-by-constant has been folded (PR30281)

This is effectively a revert of:
https://reviews.llvm.org/rL280115

And this should fix
https://llvm.org/bugs/show_bug.cgi?id=30281:

llvm-svn: 280677

7 years ago[InstCombine] revert r280637 because it causes test failures on an ARM bot
Sanjay Patel [Mon, 5 Sep 2016 22:36:32 +0000 (22:36 +0000)]
[InstCombine] revert r280637 because it causes test failures on an ARM bot

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/14952/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Aicmp.ll

llvm-svn: 280676

7 years agoremove dependence of TestGdbRemoteExitCode.py on parent directory source
Todd Fiala [Mon, 5 Sep 2016 22:03:02 +0000 (22:03 +0000)]
remove dependence of TestGdbRemoteExitCode.py on parent directory source

As Pavel pointed out in a comment on llvm.org/pr30271, the VPATH I was
using here to eliminate duplication of a .cpp file had a side effect of
attempting to pull in a .o/.obj file from that same parent dir, where
other tests can be running in parallel.  This is no good.

For now, I have removed the VPATH, which should address
llvm.org/pr30271.  I have also removed the XFAIL.

llvm-svn: 280675

7 years ago[lit] Downgrade error to warning on gtest crashes during discovery.
Ahmed Bougacha [Mon, 5 Sep 2016 20:53:14 +0000 (20:53 +0000)]
[lit] Downgrade error to warning on gtest crashes during discovery.

Lots of unittests started failing under asan after r280455.  It seems
they've been failing for a long time, but lit silently ignored them.

Downgrade the error so we can figure out what is going on.
Filed http://llvm.org/PR30285.

llvm-svn: 280674

7 years ago[AVX-512] Integrate mask register copying more completely into X86InstrInfo::copyPhys...
Craig Topper [Mon, 5 Sep 2016 20:34:50 +0000 (20:34 +0000)]
[AVX-512] Integrate mask register copying more completely into X86InstrInfo::copyPhysReg and simplify. No functional change intended.

The code is now written in terms of source and dest classes with feature checks inside each type of copy instead of having separate functions for each feature set.

llvm-svn: 280673

7 years agoAdd support for targeting armv6-unknown-cloudabi-eabihf.
Ed Schouten [Mon, 5 Sep 2016 18:38:34 +0000 (18:38 +0000)]
Add support for targeting armv6-unknown-cloudabi-eabihf.

I'm in the progress of adding ARMv6 support to CloudABI. On the compiler
side, everything seems to work properly with this tiny change applied.

llvm-svn: 280672

7 years ago[X86][SSE] Add test cases for PR29078
Simon Pilgrim [Mon, 5 Sep 2016 18:11:17 +0000 (18:11 +0000)]
[X86][SSE] Add test cases for PR29078

'Failure to recognise i64 sitofp/uitofp conversions that can be performed as i32'

llvm-svn: 280671

7 years ago[X86][SSE] Add test cases for PR29079
Simon Pilgrim [Mon, 5 Sep 2016 18:04:38 +0000 (18:04 +0000)]
[X86][SSE] Add test cases for PR29079

'Failure to recognise uitofp conversions that can be performed as sitofp'

llvm-svn: 280670

7 years agoAdd missing _US_ACTION_MASK constant to unwind.h
Dimitry Andric [Mon, 5 Sep 2016 18:01:13 +0000 (18:01 +0000)]
Add missing _US_ACTION_MASK constant to unwind.h

Summary:
During building of recent compiler-rt sources on FreeBSD for arm, I
noticed that our unwind.h (which originates in libunwind) was missing
the `_US_ACTION_MASK` constant:

    compiler-rt/lib/builtins/gcc_personality_v0.c:187:18: error: use of undeclared identifier '_US_ACTION_MASK'
        if ((state & _US_ACTION_MASK) != _US_UNWIND_FRAME_STARTING)
                     ^

It appears that both clang's internal unwind.h, and libgcc's unwind.h
define this constant as 3, so let's add this to libunwind's version too.

Reviewers: logan, kledzik, davide, emaste

Subscribers: joerg, davide, aemerson, emaste, llvm-commits

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

llvm-svn: 280669

7 years agoIntel(R) Memory Protection Extensions (Intel(R) MPX) support.
Valentina Giusti [Mon, 5 Sep 2016 17:43:10 +0000 (17:43 +0000)]
Intel(R) Memory Protection Extensions (Intel(R) MPX) support.

Summary:

The Intel(R) Memory Protection Extensions (Intel(R) MPX) associates pointers
to bounds, against which the software can check memory references to
prevent out of bound memory access.

This patch allows accessing the MPX registers:
  * bnd0-3: 128-bit registers to hold the bound values,
  * bndcfgu, bndstatus: 64-bit configuration registers,

This patch also adds read/write tests for the MPX registers in the register
command tests and adds a new subdirectory for MPX specific tests.

Signed-off-by: Valentina Giusti <valentina.giusti@intel.com>
Reviewers: labath, granata.enrico, lldb-commits, clayborg

Subscribers: lldb-commits

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

llvm-svn: 280668

7 years agoCODE_OWNERS: bring my entry up to date
whitequark [Mon, 5 Sep 2016 17:42:46 +0000 (17:42 +0000)]
CODE_OWNERS: bring my entry up to date

llvm-svn: 280667

7 years ago[ELF][MIPS] Support R_MIPS_TLS_DTPREL64 / R_MIPS_TLS_TPREL64 relocations calculation
Simon Atanasyan [Mon, 5 Sep 2016 15:42:43 +0000 (15:42 +0000)]
[ELF][MIPS] Support R_MIPS_TLS_DTPREL64 / R_MIPS_TLS_TPREL64 relocations calculation

llvm-svn: 280666

7 years ago[ELF][MIPS] Support R_MIPS_TLS_DTPREL32 / R_MIPS_TLS_TPREL32 relocations calculation
Simon Atanasyan [Mon, 5 Sep 2016 15:42:39 +0000 (15:42 +0000)]
[ELF][MIPS] Support R_MIPS_TLS_DTPREL32 / R_MIPS_TLS_TPREL32 relocations calculation

llvm-svn: 280665

7 years ago[ELF][MIPS] Do not create a hidden definition for __tls_get_addr on MIPS
Simon Atanasyan [Mon, 5 Sep 2016 15:42:29 +0000 (15:42 +0000)]
[ELF][MIPS] Do not create a hidden definition for __tls_get_addr on MIPS

On most architectures the linker is required to optimize away any
references to __tls_get_addr in case of static linking. As usual
a special case is MIPS - libc defines __tls_get_addr itself because
there are no TLS optimizations for this architecture.

llvm-svn: 280664

7 years agoReplace uses of MIUtilParse::CRegexParser with llvm::Regex
Pavel Labath [Mon, 5 Sep 2016 15:15:12 +0000 (15:15 +0000)]
Replace uses of MIUtilParse::CRegexParser with llvm::Regex

Summary:
Replace uses of the local MIUtilParse::CRegexParser class with the LLVM support class llvm::Regex. This reduces duplication of code, and makes it possible to remove the MIUtilParse::CRegexParser class that requires LLVM internal implementation headers.

Bug: https://llvm.org/bugs/show_bug.cgi?id=29138

Reviewers: dawn, abidh, ki.stfu

Subscribers: labath, ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D23882
Author: Michał Górny <mgorny@gentoo.org>

llvm-svn: 280662

7 years ago[X86][SSE] Regenerate odd shuffle tests with common prefixes
Simon Pilgrim [Mon, 5 Sep 2016 14:15:38 +0000 (14:15 +0000)]
[X86][SSE] Regenerate odd shuffle tests with common prefixes

llvm-svn: 280661

7 years ago[SimplifyCFG] Add test for sinking inline asm in if/else
Oliver Stannard [Mon, 5 Sep 2016 13:49:26 +0000 (13:49 +0000)]
[SimplifyCFG] Add test for sinking inline asm in if/else

This test code previously caused a failure in the module verifier,
because SimplifyCFG created this invalid instruction, which tries to
take the address of inline asm:
  %.sink = select i1 %1, i64 ()* asm "mov $0, #1", "=r", i64 ()* asm %"mov $0, #2", "=r"

This has been fixed recently, presumably by James Molloy's patches that
re-wrote and changed parts of SimplifyCFG, so this patch just adds a
regression test for it.

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

llvm-svn: 280660

7 years agoclang/test/Modules/compiler_builtins_x86.c: Fix r280658.
NAKAMURA Takumi [Mon, 5 Sep 2016 13:14:54 +0000 (13:14 +0000)]
clang/test/Modules/compiler_builtins_x86.c: Fix r280658.

llvm-svn: 280659

7 years agoAttempt to fix buildbots not targetting x86
James Molloy [Mon, 5 Sep 2016 12:28:49 +0000 (12:28 +0000)]
Attempt to fix buildbots not targetting x86

r280613 introduced failures for all builds that don't target x86 by default. Add an explicit target to avoid a missing feature diagnostic.

llvm-svn: 280658

7 years agoasan: allow __asan_{before,after}_dynamic_init without registered globals
Dmitry Vyukov [Mon, 5 Sep 2016 12:22:56 +0000 (12:22 +0000)]
asan: allow __asan_{before,after}_dynamic_init without registered globals

When optimizing, GCC optimizes away aggressively unused static globals.
The __asan_before_dynamic_init/__asan_after_dynamic_init calls are placed
in static constructor earlier while the registration of the globals is done
later in the compilation process.  If all the globals with
dynamic initialization are optimized away from some particular TU in between
those two, libasan can fail on an assertion that dynamic_init_globals is
empty.

While I'm going to commit a GCC change which will remove the
__asan_before_dynamic_init/__asan_after_dynamic_init in many cases when this
happens (basically if the optimizers can prove there are no memory
references in between the two calls), there are still testcases where such
pair of calls is left, e.g. for
struct S { S () { asm volatile ("" : : : "memory"); } };
static S c;

int
main ()
{
  return 0;
}
with -O2 -fsanitize=address and ASAN_OPTIONS=check_initialization_order=true
this still fails the assertion.  Trying to avoid this problem on the
compiler side would decrease code quality I'm afraid, whether it is making
sure for -fsanitize=address we keep around at least one dynamically
initialized global if the
__asan_before_dynamic_init/__asan_after_dynamic_init pair has been emitted,
or adding some artificial global which would be used as the condition for
those calls etc.
So, can the assertion be instead just removed, this really shouldn't slow
down the calls measurably (for __asan_before_dynamic_init it is even
cheaper) and the assertion doesn't check something worthwhile anyway (it is
sufficient if there is a single dynamically initialized global in any other
TU to make it happy).

Details in http://gcc.gnu.org/PR77396

Author: Jakub Jelinek
llvm-svn: 280657

7 years ago[WebAssembly] Unbreak the build.
Benjamin Kramer [Mon, 5 Sep 2016 12:06:47 +0000 (12:06 +0000)]
[WebAssembly] Unbreak the build.

Not sure why ADL isn't working here.

llvm-svn: 280656

7 years ago[AMDGPU] Refactor FLAT TD instructions
Valery Pykhtin [Mon, 5 Sep 2016 11:22:51 +0000 (11:22 +0000)]
[AMDGPU] Refactor FLAT TD instructions

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

llvm-svn: 280655

7 years agoAdd check-polly-tests build target.
Michael Kruse [Mon, 5 Sep 2016 10:54:16 +0000 (10:54 +0000)]
Add check-polly-tests build target.

The check-polly-tests target runs regression/unit tests but without checking
formatting. This is useful to not having to reload a file in an open editor
(which eg. clears the undo buffer, moves cursor/window position) when running
polly-update-format.

After this change, the following test targets exist:
 - check-polly-unittests to run unittests only
 - check-polly-tests to run unit and regression tests
 - polly-check-format to check formatting using clang-format
 - check-polly to run them all

As a side-effect, when running check-polly, polly-check-format and run in
parallel (instead of polly-check-format first).

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

llvm-svn: 280654

7 years ago[clang-rename] Add comment after namespace closing
Kirill Bobyrev [Mon, 5 Sep 2016 09:42:02 +0000 (09:42 +0000)]
[clang-rename] Add comment after namespace closing

llvm-svn: 280653

7 years agoAdd default_packet_timeout key to the new TestGdbRemoteHostInfo test
Pavel Labath [Mon, 5 Sep 2016 08:34:56 +0000 (08:34 +0000)]
Add default_packet_timeout key to the new TestGdbRemoteHostInfo test

android targets use this key, so the test should recognize it.

llvm-svn: 280652

7 years ago[Thumb1] Add relocations for fixups fixup_arm_thumb_{br,bcc}
James Molloy [Mon, 5 Sep 2016 08:29:15 +0000 (08:29 +0000)]
[Thumb1] Add relocations for fixups fixup_arm_thumb_{br,bcc}

These need to be mapped through to R_ARM_THM_JUMP{11,8} respectively.

Fixes PR30279.

llvm-svn: 280651

7 years ago[AVX512] Fix v8i1 /v16i1 zext + bitcast lowering pattern. Explicitly zero upper bits.
Igor Breger [Mon, 5 Sep 2016 08:26:51 +0000 (08:26 +0000)]
[AVX512] Fix v8i1 /v16i1 zext + bitcast lowering pattern. Explicitly zero upper bits.

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

llvm-svn: 280650

7 years ago[X86] Make some static arrays of opcodes const and shrink to uint16_t. NFC
Craig Topper [Mon, 5 Sep 2016 07:14:21 +0000 (07:14 +0000)]
[X86] Make some static arrays of opcodes const and shrink to uint16_t. NFC

llvm-svn: 280649

7 years ago[AVX-512] Simplify X86InstrInfo::copyPhysReg for 128/256-bit vectors with AVX512...
Craig Topper [Mon, 5 Sep 2016 06:43:06 +0000 (06:43 +0000)]
[AVX-512] Simplify X86InstrInfo::copyPhysReg for 128/256-bit vectors with AVX512, but not VLX. We should use the VEX opcodes and trust the register allocator to not use the extended XMM/YMM register space.

Previously we were extending to copying the whole ZMM register. The register allocator shouldn't use XMM16-31 or YMM16-31 in this configuration as the instructions to spill them aren't available.

llvm-svn: 280648

7 years ago[Target] Remove the AvailableRegClasses vector from TargetLoweringBase. It was a...
Craig Topper [Mon, 5 Sep 2016 06:43:00 +0000 (06:43 +0000)]
[Target] Remove the AvailableRegClasses vector from TargetLoweringBase. It was a private member with no code reading from it.

llvm-svn: 280647

7 years ago[Coroutines] Part11: Add final suspend handling.
Gor Nishanov [Mon, 5 Sep 2016 04:44:30 +0000 (04:44 +0000)]
[Coroutines] Part11: Add final suspend handling.

Summary:
A frontend may designate a particular suspend to be final, by setting the second argument of the coro.suspend intrinsic to true. Such a suspend point has two properties:

* it is possible to check whether a suspended coroutine is at the final suspend point via coro.done intrinsic;
* a resumption of a coroutine stopped at the final suspend point leads to undefined behavior. The only possible action for a coroutine at a final suspend point is destroying it via coro.destroy intrinsic.

This patch adds final suspend handling logic to CoroEarly and CoroSplit passes.
Now, the final suspend point example from docs\Coroutines.rst compiles and produces expected result (see test/Transform/Coroutines/ex5.ll).

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 280646

7 years ago[X86] Add AVX and AVX512 command lines to the vec_ss_load_fold test.
Craig Topper [Mon, 5 Sep 2016 02:20:53 +0000 (02:20 +0000)]
[X86] Add AVX and AVX512 command lines to the vec_ss_load_fold test.

llvm-svn: 280645

7 years ago[X86] Remove FsVMOVAPSrm/FsVMOVAPDrm/FsMOVAPSrm/FsMOVAPDrm. Due to their placement...
Craig Topper [Mon, 5 Sep 2016 02:20:49 +0000 (02:20 +0000)]
[X86] Remove FsVMOVAPSrm/FsVMOVAPDrm/FsMOVAPSrm/FsMOVAPDrm. Due to their placement in the td file they had lower precedence than (V)MOVSS/SD and could almost never be selected.

The only way to select them was in AVX512 mode because EVEX VMOVSS/SD was below them and the patterns weren't qualified properly for AVX only. So if you happened to have an aligned FR32/FR64 load in AVX512 you could get a VEX encoded VMOVAPS/VMOVAPD.

I tried to search back through history and it seems like these instructions were probably unselectable for at least 5 years, at least to the time the VEX versions were added. But I can't prove they ever were.

llvm-svn: 280644

7 years agoFix Bug 30240 - std::string: append(first, last) error when aliasing. Add test cases...
Marshall Clow [Mon, 5 Sep 2016 01:54:30 +0000 (01:54 +0000)]
Fix Bug 30240 - std::string: append(first, last) error when aliasing.  Add test cases for append/insert/assign/replace while we're at it, and fix a similar bug in insert.

llvm-svn: 280643

7 years ago[CMake] [OCaml] Allow building OCaml bindings out of tree.
Peter Zotov [Mon, 5 Sep 2016 01:42:22 +0000 (01:42 +0000)]
[CMake] [OCaml] Allow building OCaml bindings out of tree.

That is, add build system support for building the OCaml bindings
against preinstalled LLVM libraries. This is important for package
managers such as OPAM, because OCaml libraries need to be built
against a specific OCaml compiler installation.

llvm-svn: 280642

7 years agolit/util.py: Another fix for py3.
NAKAMURA Takumi [Mon, 5 Sep 2016 00:00:40 +0000 (00:00 +0000)]
lit/util.py: Another fix for py3.

  'str' object has no attribute 'decode'.

llvm-svn: 280641

7 years ago[clang-rename] Enforce LLVM policy about braces around single line control flow state...
Kirill Bobyrev [Sun, 4 Sep 2016 22:50:41 +0000 (22:50 +0000)]
[clang-rename] Enforce LLVM policy about braces around single line control flow statement body.

Although it is not explicitly stated in LLVM Coding Standards, LLVM developers
prefer to omit braces around flow control statements with single line body.

For example the following piece of code

```
if (condition)
  std::cout << "Hello, world!" << std::endl;
```

is preferred to

```
if (condition) {
  std::cout << "Hello, world!" << std::endl;
}
```

So far clang-rename has ignored this. This patch makes clang-rename more
"LLVM-ish".

llvm-svn: 280640

7 years ago[clang-rename] add failing test
Kirill Bobyrev [Sun, 4 Sep 2016 22:28:39 +0000 (22:28 +0000)]
[clang-rename] add failing test

For some reason clang-rename fails to rename method of templated class. Add
XFAIL test reproducing the issue.

llvm-svn: 280639

7 years ago[clang-rename] Fix Clang-tidy and IWYU warnings; other minor fixes
Kirill Bobyrev [Sun, 4 Sep 2016 22:19:52 +0000 (22:19 +0000)]
[clang-rename] Fix Clang-tidy and IWYU warnings; other minor fixes

Patch by Eugene Zelenko!

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

Reviewers: omtcyfz
llvm-svn: 280638

7 years ago[InstCombine] allow icmp (and X, C2), C1 folds for splat constant vectors
Sanjay Patel [Sun, 4 Sep 2016 20:58:27 +0000 (20:58 +0000)]
[InstCombine] allow icmp (and X, C2), C1 folds for splat constant vectors

The code to calculate 'UsesRemoved' could be simplified.
As-is, that code is a victim of PR30273:
https://llvm.org/bugs/show_bug.cgi?id=30273

llvm-svn: 280637

7 years ago[AVX-512] Add EVEX encoded scalar FMA intrinsic instructions to isNonFoldablePartialR...
Craig Topper [Sun, 4 Sep 2016 19:33:47 +0000 (19:33 +0000)]
[AVX-512] Add EVEX encoded scalar FMA intrinsic instructions to isNonFoldablePartialRegisterLoad.

llvm-svn: 280636

7 years ago[AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div builtins...
Craig Topper [Sun, 4 Sep 2016 18:30:17 +0000 (18:30 +0000)]
[AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div builtins and replace with native operations.

We can't do the 512-bit ones because they take a rounding mode argument that we can't represent.

llvm-svn: 280635

7 years ago[X86] Regenerate x64 mmx/f64 return value tests
Simon Pilgrim [Sun, 4 Sep 2016 18:14:45 +0000 (18:14 +0000)]
[X86] Regenerate x64 mmx/f64 return value tests

llvm-svn: 280634

7 years ago[AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div intrinsics...
Craig Topper [Sun, 4 Sep 2016 18:13:33 +0000 (18:13 +0000)]
[AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div intrinsics and upgrade to native IR.

llvm-svn: 280633

7 years ago[ORC] Clone module flags metadata into the globals module in the
Lang Hames [Sun, 4 Sep 2016 17:53:30 +0000 (17:53 +0000)]
[ORC] Clone module flags metadata into the globals module in the
CompileOnDemandLayer.

Also contains a tweak to the orc-lazy jit in LLI to enable the test case.

llvm-svn: 280632

7 years ago[X86] Regenerate trunc-store legalization test
Simon Pilgrim [Sun, 4 Sep 2016 17:50:03 +0000 (17:50 +0000)]
[X86] Regenerate trunc-store legalization test

llvm-svn: 280631

7 years ago[ELF][MIPS] Do not emit DT_REL[A]COUNT for MIPS targets
Simon Atanasyan [Sun, 4 Sep 2016 17:40:12 +0000 (17:40 +0000)]
[ELF][MIPS] Do not emit DT_REL[A]COUNT for MIPS targets

It looks like MIPS dynamic loader does not support RELCOUNT tag.
Both gold/bfd linkers does not emit this tag on MIPS. I will investigate
the problem further but for now it is better to behave like GNU linkers.

llvm-svn: 280630

7 years ago[X86][SSE] Regenerate fcmp/uitofp combine tests
Simon Pilgrim [Sun, 4 Sep 2016 17:16:01 +0000 (17:16 +0000)]
[X86][SSE] Regenerate fcmp/uitofp combine tests

llvm-svn: 280629

7 years ago[ORC] Fix an unfinished comment.
Lang Hames [Sun, 4 Sep 2016 16:31:41 +0000 (16:31 +0000)]
[ORC] Fix an unfinished comment.

llvm-svn: 280628

7 years ago[InstCombine] recode icmp fold in a vector-friendly way; NFC
Sanjay Patel [Sun, 4 Sep 2016 14:32:15 +0000 (14:32 +0000)]
[InstCombine] recode icmp fold in a vector-friendly way; NFC

The transform in question:
icmp (and (trunc W), C2), C1 -> icmp (and W, C2'), C1'

...is still not enabled for vectors, thus no functional change intended.
It's not clear to me if this is a good transform for vectors or even
scalars in general. Changing that behavior may be a follow-on patch.

llvm-svn: 280627

7 years ago[PowerPC] During branch relaxation, recompute padding offsets before each iteration
Hal Finkel [Sun, 4 Sep 2016 14:18:29 +0000 (14:18 +0000)]
[PowerPC] During branch relaxation, recompute padding offsets before each iteration

We used to compute the padding contributions to the block sizes during branch
relaxation only at the start of the transformation. As we perform branch
relaxation, we change the sizes of the blocks, and so the amount of inter-block
padding might change. Accordingly, we need to recompute the (alignment-based)
padding in between every iteration on our way toward the fixed point.

Unfortunately, I don't have a test case (and none was provided in the bug
report), and while this obviously seems needed, algorithmically, I don't have
any way of generating a small and/or non-fragile regression test.

llvm-svn: 280626

7 years agorevert r279960.
Igor Breger [Sun, 4 Sep 2016 14:03:52 +0000 (14:03 +0000)]
revert r279960.
https://llvm.org/bugs/show_bug.cgi?id=30249

llvm-svn: 280625

7 years agoEOL fixes
Simon Pilgrim [Sun, 4 Sep 2016 13:30:46 +0000 (13:30 +0000)]
EOL fixes

llvm-svn: 280624

7 years agoStrip trailing whitespace
Simon Pilgrim [Sun, 4 Sep 2016 13:28:46 +0000 (13:28 +0000)]
Strip trailing whitespace

llvm-svn: 280623

7 years agoTest case for r280607 to check presence and sanity of the *_LOCK_FREE
Joerg Sonnenberger [Sun, 4 Sep 2016 11:21:27 +0000 (11:21 +0000)]
Test case for r280607 to check presence and sanity of the *_LOCK_FREE
macros.

llvm-svn: 280622

7 years ago[libcxx] Fix a data race in call_once
Kuba Brecka [Sun, 4 Sep 2016 09:55:12 +0000 (09:55 +0000)]
[libcxx] Fix a data race in call_once

call_once is using relaxed atomic load to perform double-checked locking, which contains a data race. The fast-path load has to be an acquire atomic load.

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

llvm-svn: 280621

7 years ago[PM] Revert r280447: Add a unittest for invalidating module analyses with an SCC...
Chandler Carruth [Sun, 4 Sep 2016 08:42:31 +0000 (08:42 +0000)]
[PM] Revert r280447: Add a unittest for invalidating module analyses with an SCC pass.

This was mistakenly committed. The world isn't ready for this test, the
test code has horrible debugging code in it that should never have
landed in tree, it currently passes because of bugs elsewhere, and it
needs to be rewritten to not be susceptible to passing for the wrong
reasons.

I'll re-land this in a better form when the prerequisite patches land.

So sorry that I got this mixed into a series of commits that *were*
ready to land. I shouldn't have. =[ What's worse is that it stuck around
for so long and I discovered it while fixing the underlying bug that
caused it to pass.

llvm-svn: 280620

7 years ago[LCG] Clean up and make NDEBUG verify calls more rigorous with
Chandler Carruth [Sun, 4 Sep 2016 08:34:31 +0000 (08:34 +0000)]
[LCG] Clean up and make NDEBUG verify calls more rigorous with
make_scope_exit now that we have that utility.

This makes the code much more clear and readable by isolating the check.
It also makes it easy to go through and make sure all the interesting
update routines have a start and end verify so we don't slowly let the
graph drift into an invalid state.

llvm-svn: 280619

7 years ago[LCG] A NFC refactoring to extract the logic for doing
Chandler Carruth [Sun, 4 Sep 2016 08:34:24 +0000 (08:34 +0000)]
[LCG] A NFC refactoring to extract the logic for doing
a postorder-sequence based update after edge insertion into a generic
helper function.

This separates the SCC-specific logic into two fairly simple lambdas and
extracts the rest into a generic helper template function. I think this
is a net win on its own merits because it disentangles different pieces
of the algorithm. Now there is one place that does the two-step
partition to identify a set of newly connected components and at the
same time update the postorder sequence.

However, I'm also hoping to re-use this an upcoming patch to update
a cached post-order sequence of RefSCCs when doing the analogous update
to the RefSCC graph, and I don't want to have two copies.

The diff is quite messy but this really is just moving things around and
making types generic rather than specific.

llvm-svn: 280618

7 years ago[InstCombine] Preserve llvm.mem.parallel_loop_access metadata when replacing
Dorit Nuzman [Sun, 4 Sep 2016 07:49:39 +0000 (07:49 +0000)]
[InstCombine] Preserve llvm.mem.parallel_loop_access metadata when replacing
memcpy with ld/st.

When InstCombine replaces a memcpy with loads+stores it does not copy over the
llvm.mem.parallel_loop_access from the memcpy instruction. This patch fixes
that.

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

llvm-svn: 280617

7 years ago[ExecutionEngine] Move ObjectCache::anchor from MCJIT to ExecutionEngine.
Lang Hames [Sun, 4 Sep 2016 07:24:11 +0000 (07:24 +0000)]
[ExecutionEngine] Move ObjectCache::anchor from MCJIT to ExecutionEngine.

ObjectCache is an ExecutionEngine utility, so its anchor belongs there. The
practical impact of this change is that ORC users no longer need to link MCJIT
to use ObjectCaches.

llvm-svn: 280616

7 years agoTest commit.
Dorit Nuzman [Sun, 4 Sep 2016 07:06:00 +0000 (07:06 +0000)]
Test commit.

llvm-svn: 280615

7 years ago[PowerPC] Zero-extend constants in FastISel
Hal Finkel [Sun, 4 Sep 2016 06:07:19 +0000 (06:07 +0000)]
[PowerPC] Zero-extend constants in FastISel

As it turns out, whether we zero-extend or sign-extend i8/i16 constants, which
are illegal types promoted to i32 on PowerPC, is a choice constrained by
assumptions within the infrastructure. Specifically, the logic in
FunctionLoweringInfo::ComputePHILiveOutRegInfo assumes that constant PHI
operands will be zero extended, and so, at least when materializing constants
that are PHI operands, we must do the same.

The rest of our fast-isel implementation does not appear to depend on the fact
that we were sign-extending i8/i16 constants, and all other targets also appear
to zero-extend small-bitwidth constants in fast-isel; we'll now do the same (we
had been doing this only for i1 constants, and sign-extending the others).

Fixes PR27721.

llvm-svn: 280614

7 years ago[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.
Elad Cohen [Sun, 4 Sep 2016 06:00:42 +0000 (06:00 +0000)]
[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

This adds support for modules that require (non-)freestanding
environment, such as the compiler builtin mm_malloc submodule.

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

llvm-svn: 280613

7 years agoApply curr_symbol.pass.cpp test fix to missed test case
Eric Fiselier [Sun, 4 Sep 2016 04:09:25 +0000 (04:09 +0000)]
Apply curr_symbol.pass.cpp test fix to missed test case

llvm-svn: 280612

7 years ago[AVX-512] Remove masked integer add/sub/mull intrinsics and upgrade to native IR.
Craig Topper [Sun, 4 Sep 2016 02:09:53 +0000 (02:09 +0000)]
[AVX-512] Remove masked integer add/sub/mull intrinsics and upgrade to native IR.

llvm-svn: 280611

7 years agoFix inliner funclet unwind memoization
Joseph Tremoulet [Sun, 4 Sep 2016 01:23:20 +0000 (01:23 +0000)]
Fix inliner funclet unwind memoization

Summary:
The inliner may need to determine where a given funclet unwinds to,
and this determination may depend on other funclets throughout the
funclet tree.  The code that performs this walk in getUnwindDestToken
memoizes results to avoid redundant computations.  In the case that
a funclet's unwind destination is derived from its ancestor, there's
code to walk back down the tree from the ancestor updating the memo
map of its descendants to record the unwind destination.  This change
fixes that code to account for the case that some descendant has a
different unwind destination, which can happen if that unwind dest
is a descendant of the EHPad being queried and thus didn't determine
its unwind destination.

Also update test inline-funclets.ll, which is supposed to cover such
scenarios, to include a case that fails an assertion without this fix
but passes with it.

Fixes PR29151.

Reviewers: majnemer

Subscribers: llvm-commits

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

llvm-svn: 280610

7 years agoTrailing dot that shouldn't have been committed.
Joerg Sonnenberger [Sun, 4 Sep 2016 00:51:02 +0000 (00:51 +0000)]
Trailing dot that shouldn't have been committed.

llvm-svn: 280609

7 years agoFix bad locale test data when using the newest glibc
Eric Fiselier [Sun, 4 Sep 2016 00:48:54 +0000 (00:48 +0000)]
Fix bad locale test data when using the newest glibc

llvm-svn: 280608

7 years agoPR 27200: Fix names of the atomic lock-free macros.
Joerg Sonnenberger [Sun, 4 Sep 2016 00:44:10 +0000 (00:44 +0000)]
PR 27200: Fix names of the atomic lock-free macros.

llvm-svn: 280607

7 years agoXFAIL TestGdbRemoteExitCode failing tests
Todd Fiala [Sun, 4 Sep 2016 00:43:10 +0000 (00:43 +0000)]
XFAIL TestGdbRemoteExitCode failing tests

Tracked by:
llvm.org/pr30271

llvm-svn: 280606

7 years agoMark test as XFAIL for C++03, rather than providing a dummy pass.
Marshall Clow [Sun, 4 Sep 2016 00:37:06 +0000 (00:37 +0000)]
Mark test as XFAIL for C++03, rather than providing a dummy pass.

llvm-svn: 280605

7 years ago[NFC] Darwin llgs support from Week of Code
Todd Fiala [Sun, 4 Sep 2016 00:18:56 +0000 (00:18 +0000)]
[NFC] Darwin llgs support from Week of Code

This code represents the Week of Code work I did on bringing up
lldb-server LLGS support for Darwin.  It does not include the
Xcode project changes needed, as we don't want to throw that switch
until more support is implemented (i.e. this change is inert, no
build systems use it yet.  I've verified on Ubuntu 16.04, macOS
Xcode and macOS cmake builds).

This change does some minimal refactoring of code that is shared
with the Linux LLGS portion, moving it from NativeProcessLinux into
NativeProcessProtocol.  That code is also used by NativeProcessDarwin.

Current state on Darwin:
* Process launching is implemented.  (Attach is not).
  Launching on devices has not yet been tested (FBS/BKS might
  need a bit of work).
* Inferior waitpid monitoring and communication of exit status
  via MainLoop callback is implemented.
* Memory read/write, breakpoints, thread register context, etc.
  are not yet implemented.  This impacts process stop/resume, as
  the initial launch suspended immediately starts the process
  up and running because it doesn't know it is supposed to remain
  stopped.
* I implemented the equivalent of MachThreadList as
  NativeThreadListDarwin, in anticipation that we might want to
  factor out common parts into NativeThreadList{Protocol} and share
  some code here.  After writing it, though, the fallout from merging
  Mach Task/Process into a single concept plus some other minor
  changes makes the whole NativeThreadListDarwin concept nothing more
  than dead weight.  I am likely going to get rid of this class and
  just manage it directly in NativeProcessDarwin, much like I did
  for NativeProcessLinux.
* There is a stub-out call for starting a STDIO thread.  That will
  go away and adopt the MainLoop pselect-based IOObject reading.

I am developing the fully-integrated changes in the following repo,
which contains the necessary Xcode bits and the glue that enables
lldb-debugserver on a macOS system:

  https://github.com/tfiala/lldb/tree/llgs-darwin

This change also breaks out a few of the lldb-server tests into
their own directory, and adds some $qHostInfo tests (not sure why
I didn't write those tests back when I initially implemented that
on the Linux side).

llvm-svn: 280604

7 years ago[X86] Combine some of the strings in autoupgrade code.
Craig Topper [Sat, 3 Sep 2016 23:55:13 +0000 (23:55 +0000)]
[X86] Combine some of the strings in autoupgrade code.

llvm-svn: 280603

7 years agoCleanup : Use metadata preserving API for branch creation
Xinliang David Li [Sat, 3 Sep 2016 22:26:11 +0000 (22:26 +0000)]
Cleanup : Use metadata preserving API for branch creation

Use the wrapper API in IRBuilder that does meta data copy
to create new branch in LoopUnswitch.

llvm-svn: 280602

7 years agoScopInfo: Do not derive assumptions from all GEP pointer instructions
Tobias Grosser [Sat, 3 Sep 2016 21:55:25 +0000 (21:55 +0000)]
ScopInfo: Do not derive assumptions from all GEP pointer instructions

... but instead rely on the assumptions that we derive for load/store
instructions.

Before we were able to delinearize arrays, we used GEP pointer instructions
to derive information about the likely range of induction variables, which
gave us more freedom during loop scheduling. Today, this is not needed
any more as we delinearize multi-dimensional memory accesses and as part
of this process also "assume" that all accesses to these arrays remain
inbounds. The old derive-assumptions-from-GEP code has consequently become
mostly redundant. We drop it both to clean up our code, but also to improve
compile time. This change reduces the scop construction time for 3mm in
no-asserts mode on my machine from 48 to 37 ms.

llvm-svn: 280601

7 years ago[Profile] preserve branch metadata lowering select in CGP
Xinliang David Li [Sat, 3 Sep 2016 21:26:36 +0000 (21:26 +0000)]
[Profile] preserve branch metadata lowering select in CGP

CGP currently drops select's MD_prof profile data when
generating conditional branch which can lead to bad
code layout. The patch fixes the issue.

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

llvm-svn: 280600

7 years agoFix ThinLTO crash with debug info
Mehdi Amini [Sat, 3 Sep 2016 21:12:33 +0000 (21:12 +0000)]
Fix ThinLTO crash with debug info

Because the recent change about ODR type uniquing in the context,
we can reach types defined in another module during IR linking.
This triggered some assertions in case we IR link without starting
from an empty module. To alleviate that, we can self-map metadata
defined in the destination module so that they won't be visited.

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

llvm-svn: 280599

7 years agoStrip trailing whitespace
Simon Pilgrim [Sat, 3 Sep 2016 20:36:05 +0000 (20:36 +0000)]
Strip trailing whitespace

llvm-svn: 280598

7 years ago[AVX-512] Remove masked integer mullo builtins and replace with native IR.
Craig Topper [Sat, 3 Sep 2016 19:19:49 +0000 (19:19 +0000)]
[AVX-512] Remove masked integer mullo builtins and replace with native IR.

llvm-svn: 280597

7 years ago[AVX-512] Remove masked integer add/sub builtins and replace with native IR.
Craig Topper [Sat, 3 Sep 2016 18:29:35 +0000 (18:29 +0000)]
[AVX-512] Remove masked integer add/sub builtins and replace with native IR.

llvm-svn: 280596

7 years agoAMDGPU: Set sizes of spill pseudos
Matt Arsenault [Sat, 3 Sep 2016 17:25:44 +0000 (17:25 +0000)]
AMDGPU: Set sizes of spill pseudos

llvm-svn: 280595

7 years agoAMDGPU: Fix adding duplicate implicit exec uses
Matt Arsenault [Sat, 3 Sep 2016 17:25:39 +0000 (17:25 +0000)]
AMDGPU: Fix adding duplicate implicit exec uses

I'm not sure if this should be considered a bug in
copyImplicitOps or not, but implicit operands that are part
of the static instruction definition should not be copied.

llvm-svn: 280594

7 years ago[AVX-512] Add integer ADD/SUB instructions to load folding tables. Add an AVX512...
Craig Topper [Sat, 3 Sep 2016 17:20:07 +0000 (17:20 +0000)]
[AVX-512] Add integer ADD/SUB instructions to load folding tables. Add an AVX512 stack folding test.

llvm-svn: 280593

7 years ago[AVX-512] Mark EVEX encoded vpcmpeq as commutable just like its AVX and SSE equivalent.
Craig Topper [Sat, 3 Sep 2016 16:28:03 +0000 (16:28 +0000)]
[AVX-512] Mark EVEX encoded vpcmpeq as commutable just like its AVX and SSE equivalent.

llvm-svn: 280592

7 years agoFix the attribute documentation build.
Aaron Ballman [Sat, 3 Sep 2016 15:36:52 +0000 (15:36 +0000)]
Fix the attribute documentation build.

llvm-svn: 280591

7 years agoAMDGPU: Reduce the duration of whole-quad-mode
Nicolai Haehnle [Sat, 3 Sep 2016 12:26:38 +0000 (12:26 +0000)]
AMDGPU: Reduce the duration of whole-quad-mode

Summary:
This contains two changes that reduce the time spent in WQM, with the
intention of reducing bandwidth required by VMEM loads:

1. Sampling instructions by themselves don't need to run in WQM, only their
   coordinate inputs need it (unless of course there is a dependent sampling
   instruction). The initial scanInstructions step is modified accordingly.

2. When switching back from WQM to Exact, switch back as soon as possible.
   This affects the logic in processBlock.

This should always be a win or at best neutral.

There are also some cleanups (e.g. remove unused ExecExports) and some new
debugging output.

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 280590

7 years agoAMDGPU: Fix an interaction between WQM and polygon stippling
Nicolai Haehnle [Sat, 3 Sep 2016 12:26:32 +0000 (12:26 +0000)]
AMDGPU: Fix an interaction between WQM and polygon stippling

Summary:
This fixes a rare bug in polygon stippling with non-monolithic pixel shaders.

The underlying problem is as follows: the prolog part contains the polygon
stippling sequence, i.e. a kill. The main part then enables WQM based on the
_reduced_ exec mask, effectively undoing most of the polygon stippling.

Since we cannot know whether polygon stippling will be used, the main part
of a non-monolithic shader must always return to exact mode to fix this
problem.

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 280589

7 years agoFix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.
Eric Fiselier [Sat, 3 Sep 2016 08:07:40 +0000 (08:07 +0000)]
Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.

Summary:
This patch allows threads not created using `std::thread` to use `std::notify_all_at_thread_exit` by ensuring the TL state has been initialized within `std::notify_all_at_thread_exit`.

Additionally this patch "fixes" a potential oddity in `__thread_local_pointer::reset(pointer)`, which would previously delete the old thread local data. However there should *never* be old thread local data because pthread *should* null it out on thread exit. Unfortunately it's possible that pthread failed to do this according to the spec:

>
> Upon key creation, the value NULL shall be associated with the new key in all active threads. Upon thread creation, the value NULL shall be associated with all defined keys in the new thread.
>
> An optional destructor function may be associated with each key value. At thread exit, if a key value has a non-NULL destructor pointer, and the thread has a non-NULL value associated with that key, the value of the key is set to NULL, and then the function pointed to is called with the previously associated value as its sole argument. The order of destructor calls is unspecified if more than one destructor exists for a thread when it exits.
>
> If, after all the destructors have been called for all non-NULL values with associated destructors, there are still some non-NULL values with associated destructors, then the process is repeated. If, after at least {PTHREAD_DESTRUCTOR_ITERATIONS} iterations of destructor calls for outstanding non-NULL values, there are still some non-NULL values with associated destructors, implementations may stop calling destructors, or they may continue calling destructors until no non-NULL values with associated destructors exist, even though this might result in an infinite loop.

However if pthread fails to delete the value it is probably incorrect for us to do it. Destroying the value performs all of the "at thread exit" actions registered with it but we are way past "at thread exit".

Reviewers: mclow.lists, bcraig, EricWF

Subscribers: cfe-commits

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

llvm-svn: 280588

7 years agoReplace the Radeon GCN GPU family names by more descriptive ones
Niels Ole Salscheider [Sat, 3 Sep 2016 07:13:54 +0000 (07:13 +0000)]
Replace the Radeon GCN GPU family names by more descriptive ones

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

llvm-svn: 280587

7 years agoAMDGPU: Do basic folding of class intrinsic
Matt Arsenault [Sat, 3 Sep 2016 07:06:58 +0000 (07:06 +0000)]
AMDGPU: Do basic folding of class intrinsic

This allows more of the OCML builtin library to be
constant folded.

llvm-svn: 280586

7 years agomemory_resource still needs init_priority when built with GCC 4.9
Eric Fiselier [Sat, 3 Sep 2016 07:05:40 +0000 (07:05 +0000)]
memory_resource still needs init_priority when built with GCC 4.9

llvm-svn: 280585

7 years agoAMDGPU: Fix spilling of m0
Matt Arsenault [Sat, 3 Sep 2016 06:57:55 +0000 (06:57 +0000)]
AMDGPU: Fix spilling of m0

readlane/writelane do not support using m0 as the output/input.
Constrain the register class of spill vregs to try to avoid this,
but also handle spilling of the physreg when necessary by inserting
an additional copy to a normal SGPR.

llvm-svn: 280584

7 years agoImprove debug error message with register name
Matt Arsenault [Sat, 3 Sep 2016 06:57:49 +0000 (06:57 +0000)]
Improve debug error message with register name

llvm-svn: 280583

7 years ago[AVX-512] Add EVEX encoded VPCMPEQ and VPCMPGT to the load folding tables.
Craig Topper [Sat, 3 Sep 2016 04:37:50 +0000 (04:37 +0000)]
[AVX-512] Add EVEX encoded VPCMPEQ and VPCMPGT to the load folding tables.

llvm-svn: 280581

7 years agoAdd a test Aaron asked for that I forgot to add before landing r280578.
Nico Weber [Sat, 3 Sep 2016 04:27:14 +0000 (04:27 +0000)]
Add a test Aaron asked for that I forgot to add before landing r280578.

llvm-svn: 280580

7 years agoMake lit/util.py py3-compatible.
NAKAMURA Takumi [Sat, 3 Sep 2016 04:06:37 +0000 (04:06 +0000)]
Make lit/util.py py3-compatible.

llvm-svn: 280579

7 years ago[ms] Add support for parsing uuid as a Microsoft attribute.
Nico Weber [Sat, 3 Sep 2016 03:25:22 +0000 (03:25 +0000)]
[ms] Add support for parsing uuid as a Microsoft attribute.

Some Windows SDK classes, for example
Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling
attributes:

  [uuid("....")] class IBufferByteAccess {};

To be able to use __uuidof() to grab the uuid off these types, clang needs to
support uuid as a Microsoft attribute. There was already code to skip Microsoft
attributes, extend that to look for uuid and parse it.  Use the new "Microsoft"
attribute type added in r280575 (and r280574, r280576) for this.

Final part of https://reviews.llvm.org/D23895

llvm-svn: 280578

7 years agoRevert r280549.
Nico Weber [Sat, 3 Sep 2016 03:18:49 +0000 (03:18 +0000)]
Revert r280549.

The test it added doesn't pass:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15318/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Apdbdump-yaml-types.test

Command Output (stdout):
--
$ "D:/buildslave/clang-x64-ninja-win7/stage1/./bin\llvm-pdbdump.EXE" "pdb2yaml" "-tpi-stream" "D:\buildslave\clang-x64-ninja-win7\llvm\test\DebugInfo\PDB/Inputs/empty.pdb"
$ "D:/buildslave/clang-x64-ninja-win7/stage1/./bin\FileCheck.EXE" "-check-prefix=YAML" "D:\buildslave\clang-x64-ninja-win7\llvm\test\DebugInfo\PDB\pdbdump-yaml-types.test"
# command stderr:
D:\buildslave\clang-x64-ninja-win7\llvm\test\DebugInfo\PDB\pdbdump-yaml-types.test:36:7: error: expected string not found in input
YAML: Name: apartment
      ^
<stdin>:153:10: note: scanning from here
 Value: 161
         ^

llvm-svn: 280577