platform/upstream/llvm.git
6 years agoAttempt to fix inscrutible build break...
David Blaikie [Thu, 16 Nov 2017 22:40:02 +0000 (22:40 +0000)]
Attempt to fix inscrutible build break...

llvm-svn: 318463

6 years agoFix some undefined beahvior in FileMapping.
Zachary Turner [Thu, 16 Nov 2017 22:39:55 +0000 (22:39 +0000)]
Fix some undefined beahvior in FileMapping.

This was broken when building a 32-bit native toolchain, as
shifting a size_t right by 32 is UB when sizeof(size_t) == 8.

llvm-svn: 318462

6 years agollvm-readobj/ARMEHABIPrinter.h: Make this a real/modular header
David Blaikie [Thu, 16 Nov 2017 22:30:36 +0000 (22:30 +0000)]
llvm-readobj/ARMEHABIPrinter.h: Make this a real/modular header

Had several non-inline/strong function definitions that needed to be
marked inline, etc.

llvm-svn: 318461

6 years ago[asan] Avoid assert failure for non-default shadow scale
Walter Lee [Thu, 16 Nov 2017 22:02:58 +0000 (22:02 +0000)]
[asan] Avoid assert failure for non-default shadow scale

Rather than assertion failing, we can fall back to the
non-optimized version which works for any shadow scale.

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

llvm-svn: 318460

6 years agoConvert the last use of sys::fs::createUniqueFile in bugpoint.
Rafael Espindola [Thu, 16 Nov 2017 21:53:51 +0000 (21:53 +0000)]
Convert the last use of sys::fs::createUniqueFile in bugpoint.

llvm-svn: 318459

6 years agoConvert another use of createUniqueFile to TempFile::create.
Rafael Espindola [Thu, 16 Nov 2017 21:40:10 +0000 (21:40 +0000)]
Convert another use of createUniqueFile to TempFile::create.

This one requires a new small feature in TempFile: the ability to keep
the temporary file with the temporary name.

llvm-svn: 318458

6 years ago[CMake][runtimes] Use cmake_parse_arguments in runtimes functions
Petr Hosek [Thu, 16 Nov 2017 21:28:54 +0000 (21:28 +0000)]
[CMake][runtimes] Use cmake_parse_arguments in runtimes functions

Passing lists to functions in CMake is tricky, any list argument
has to be quoted otherwise it'll be expanded. To avoid this issue,
use cmake_parse_arguments in runtime functions and pass lists using
a keyword argument which eliminates any ambiguity when dealing with
lists.

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

llvm-svn: 318457

6 years agoIssue -Wempty-body warnings for else blocks
Reid Kleckner [Thu, 16 Nov 2017 21:26:18 +0000 (21:26 +0000)]
Issue -Wempty-body warnings for else blocks

This looks like it was just an oversight.

Fixes http://llvm.org/pr35319

llvm-svn: 318456

6 years agoRevert "[SelectionDAG] Consolidate (t|T)ransferDbgValues methods, NFC."
Vedant Kumar [Thu, 16 Nov 2017 21:08:51 +0000 (21:08 +0000)]
Revert "[SelectionDAG] Consolidate (t|T)ransferDbgValues methods, NFC."

This reverts commit r318448. It looks like some of the asserts need to
be weakened.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/16296

llvm-svn: 318455

6 years ago[RISCV] Fix 64-bit data layout mismatch between backend and target description
Mandeep Singh Grang [Thu, 16 Nov 2017 20:30:49 +0000 (20:30 +0000)]
[RISCV] Fix 64-bit data layout mismatch between backend and target description

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, llvm-commits

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

llvm-svn: 318454

6 years ago[libFuzzer] add more tests for merge
Kostya Serebryany [Thu, 16 Nov 2017 20:25:45 +0000 (20:25 +0000)]
[libFuzzer] add more tests for merge

llvm-svn: 318453

6 years ago[X86] Pre-truncate gather/scatter indices that have element sizes larger than 64...
Craig Topper [Thu, 16 Nov 2017 20:23:22 +0000 (20:23 +0000)]
[X86] Pre-truncate gather/scatter indices that have element sizes larger than 64-bits before Legalize.

The wider element type will normally cause legalize to try to split and scalarize the gather/scatter, but we can't handle that. Instead, truncate the index early so the gather/scatter node is insulated from the legalization.

This really shouldn't happen in practice since InstCombine will normalize index types to the same size as pointers.

llvm-svn: 318452

6 years ago[X86] DAGCombinerInfo is in TargetLowering not X86TargetLowering.
Craig Topper [Thu, 16 Nov 2017 20:23:17 +0000 (20:23 +0000)]
[X86] DAGCombinerInfo is in TargetLowering not X86TargetLowering.

llvm-svn: 318451

6 years ago[DAGCombiner] Use cast instead of an unchecked dyn_cast.
Craig Topper [Thu, 16 Nov 2017 20:23:12 +0000 (20:23 +0000)]
[DAGCombiner] Use cast instead of an unchecked dyn_cast.

llvm-svn: 318450

6 years agollvm-objdump: Add missing requires for the test in r313921
Justin Bogner [Thu, 16 Nov 2017 20:20:56 +0000 (20:20 +0000)]
llvm-objdump: Add missing requires for the test in r313921

This test needs an arm backend in addition to the arm64 one that's
already checked in the test directory.

llvm-svn: 318449

6 years ago[SelectionDAG] Consolidate (t|T)ransferDbgValues methods, NFC.
Vedant Kumar [Thu, 16 Nov 2017 19:50:24 +0000 (19:50 +0000)]
[SelectionDAG] Consolidate (t|T)ransferDbgValues methods, NFC.

TransferDbgValues (capital 'T') is wired into ReplaceAllUsesWith, and
transferDbgValues (lowercase 't') is used elsewhere (e.g in Legalize).

Both functions should be doing the exact same thing. This patch
consolidates the logic into one place.

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

llvm-svn: 318448

6 years agoFix my typo of PDB_TableType
Reid Kleckner [Thu, 16 Nov 2017 19:41:12 +0000 (19:41 +0000)]
Fix my typo of PDB_TableType

llvm-svn: 318447

6 years agoRemove a FIXME about truncated section names
Martin Storsjo [Thu, 16 Nov 2017 19:36:48 +0000 (19:36 +0000)]
Remove a FIXME about truncated section names

If the linker chose to store the full section name instead of truncating
it, this field doesn't contain a truncated name, but an offset into
the string table of the binary. The string table isn't loaded/mapped
into memory during runtime though, so it's not possible to read the
full section name, unless we try to locate the DLL/EXE on disk that
the HMODULE corresponds to and load that manually.

Due to this, lld now always prefers writing a truncated section name
for sections that will be mapped at runtime, even when debug info is
enabled.

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

llvm-svn: 318446

6 years ago[VirtualFileSystem] Support creating directories then adding files inside
Ben Hamilton [Thu, 16 Nov 2017 19:34:08 +0000 (19:34 +0000)]
[VirtualFileSystem] Support creating directories then adding files inside

Summary:
In https://reviews.llvm.org/D39572 , I added support for specifying
`Type` when invoking `InMemoryFileSystem::addFile()`.

However, I didn't account for the fact that when `Type` is
`directory_file`, we need to construct an `InMemoryDirectory`, not an
`InMemoryFile`, or else clients cannot create files inside that
directory.

This diff fixes the bug and adds a test.

Test Plan: New test added. Ran test with:

  % make -j12 check-clang-tools

Reviewers: bkramer, hokein

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 318445

6 years agoFix -Wreturn-type falling off the end of a function in new DIA code
Reid Kleckner [Thu, 16 Nov 2017 19:32:53 +0000 (19:32 +0000)]
Fix -Wreturn-type falling off the end of a function in new DIA code

llvm-svn: 318444

6 years ago[arc] Fix ambiguous overloaded operator error
Daniel Sanders [Thu, 16 Nov 2017 19:16:56 +0000 (19:16 +0000)]
[arc] Fix ambiguous overloaded operator error

lib/Target/ARC/ARCISelLowering.cpp:490:22: error: use of overloaded operator '<<' is ambiguous (with operand types 'llvm::raw_ostream' and 'llvm::MVT::SimpleValueType')
                     << RegVT.getSimpleVT().SimpleTy << "\n");
                     ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

llvm-svn: 318443

6 years agobpf: print backward branch target properly
Yonghong Song [Thu, 16 Nov 2017 19:15:36 +0000 (19:15 +0000)]
bpf: print backward branch target properly

Currently, it prints the backward branch offset as unsigned value
like below:
       7:       7d 34 0b 00 00 00 00 00         if r4 s>= r3 goto 11 <LBB0_3>
       8:       b7 00 00 00 00 00 00 00         r0 = 0
LBB0_2:
       9:       07 00 00 00 01 00 00 00         r0 += 1
      ......
      17:       bf 31 00 00 00 00 00 00         r1 = r3
      18:       6d 32 f6 ff 00 00 00 00         if r2 s> r3 goto 65526 <LBB0_3+0x7FFB0>

The correct print insn 18 should be:
      18:       6d 32 f6 ff 00 00 00 00         if r2 s> r3 goto -10 <LBB0_2>

To provide better clarity and be consistent with kernel verifier output,
the insn 7 output is changed to the following with "+" added to
non-negative branch offset:
       7:       7d 34 0b 00 00 00 00 00         if r4 s>= r3 goto +11 <LBB0_3>

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 318442

6 years ago[arc] Update TargetInfo to include the new backend name argument
Daniel Sanders [Thu, 16 Nov 2017 19:10:26 +0000 (19:10 +0000)]
[arc] Update TargetInfo to include the new backend name argument

Also update a comment about the usage of RegisterTarget() that didn't mention
the new argument.

llvm-svn: 318441

6 years ago[MS] Apply adjustments after storing 'this'
Reid Kleckner [Thu, 16 Nov 2017 19:09:36 +0000 (19:09 +0000)]
[MS] Apply adjustments after storing 'this'

Summary:
The MS ABI convention is that the 'this' pointer on entry is the address
of the vfptr that was used to make the virtual method call. In other
words, the pointer on entry always points to the base subobject that
introduced the virtual method. Consider this hierarchy:

  struct A { virtual void f() = 0; };
  struct B { virtual void g() = 0; };
  struct C : A, B {
    void f() override;
    void g() override;
  };

On entry to C::g, [ER]CX will contain the address of C's B subobject,
and C::g will have to subtract sizeof(A) to recover a pointer to C.

Before this change, we applied this adjustment in the prologue and
stored the new value into the "this" local variable alloca used for
debug info. However, MSVC does not do this, presumably because it is
often profitable to fold the adjustment into later field accesses. This
creates a problem, because the debugger expects the variable to be
unadjusted. Unfortunately, CodeView doesn't have anything like DWARF
expressions for computing variables that aren't in the program anymore,
so we have to declare 'this' to be the unadjusted value if we want the
debugger to see the right value.

This has the side benefit that, in optimized builds, the 'this' pointer
will usually be available on function entry because it doesn't require
any adjustment.

Reviewers: hans

Subscribers: aprantl, cfe-commits

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

llvm-svn: 318440

6 years ago[libFuzzer] add docs for -reduce_inputs
Kostya Serebryany [Thu, 16 Nov 2017 18:58:14 +0000 (18:58 +0000)]
[libFuzzer] add docs for -reduce_inputs

llvm-svn: 318439

6 years ago[sanitizer] Revert rL318410
Kostya Kortchinsky [Thu, 16 Nov 2017 18:53:18 +0000 (18:53 +0000)]
[sanitizer] Revert rL318410

Summary:
The patch seems to have turned some Android tests flaky. The reason is unclear.
This reverts D40100 in case we can't figure out what is happening.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: srhines, kubamracek

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

llvm-svn: 318438

6 years agoFix RISCV build after r318352
Azharuddin Mohammed [Thu, 16 Nov 2017 18:39:31 +0000 (18:39 +0000)]
Fix RISCV build after r318352

Reviewers: asb, apazos, mgrang

Reviewed By: mgrang

Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, llvm-commits

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

llvm-svn: 318437

6 years ago[PPC] Change i32 constant in store instruction to i64
Guozhi Wei [Thu, 16 Nov 2017 18:27:34 +0000 (18:27 +0000)]
[PPC] Change i32 constant in store instruction to i64

This patch changes all i32 constant in store instruction to i64 with truncation, to increase the chance that the referenced constant can be shared with other i64 constant.

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

llvm-svn: 318436

6 years agoResubmit "Refactor debuginfo-tests"
Zachary Turner [Thu, 16 Nov 2017 18:26:20 +0000 (18:26 +0000)]
Resubmit "Refactor debuginfo-tests"

This was reverted due to some failures on specific darwin buildbots,
the issue being that the new lit configuration was not setting the
SDKROOT environment variable.  We've tested a fix locally and confirmed
that it works, so this patch resubmits everything with the fix
applied.

llvm-svn: 318435

6 years ago[OPENMP] Add support for cancelling inside target parallel for
Alexey Bataev [Thu, 16 Nov 2017 18:20:21 +0000 (18:20 +0000)]
[OPENMP] Add support for cancelling inside target parallel for
directive.

Added missed support for cancelling of target parallel for construct.

llvm-svn: 318434

6 years agoAdd ELF dynamic symbol support to yaml2obj/obj2yaml
Dave Lee [Thu, 16 Nov 2017 18:10:15 +0000 (18:10 +0000)]
Add ELF dynamic symbol support to yaml2obj/obj2yaml

Summary:
This change introduces a `DynamicSymbols` field to the ELF specific YAML
supported by `yaml2obj` and `obj2yaml`. This grouping of symbols provides a way
to represent ELF dynamic symbols. The `DynamicSymbols` structure is identical to
the existing `Symbols`.

Reviewers: compnerd, jakehehrlich, silvas

Reviewed By: silvas

Subscribers: silvas, jakehehrlich, llvm-commits

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

llvm-svn: 318433

6 years agoMark free functions size/empty/data conditionally noexcept.
Marshall Clow [Thu, 16 Nov 2017 17:55:41 +0000 (17:55 +0000)]
Mark free functions size/empty/data conditionally noexcept.

llvm-svn: 318432

6 years agoImplement GetTls() for NetBSD
Kamil Rytarowski [Thu, 16 Nov 2017 17:54:14 +0000 (17:54 +0000)]
Implement GetTls() for NetBSD

Summary:
Reuse the existing code for FreeBSD that is compatible with NetBSD.

Add NetBSD support in tests: tls_race.cc and tls_race2.cc.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, vitalybuka, kcc, eugenis

Reviewed By: dvyukov

Subscribers: srhines, emaste, kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 318431

6 years ago[InstCombine] add tests for pow(); NFC
Sanjay Patel [Thu, 16 Nov 2017 17:49:54 +0000 (17:49 +0000)]
[InstCombine] add tests for pow(); NFC

Also, increase test diversity (and show another bug) by varying the types.

llvm-svn: 318430

6 years agomake exitDsymutil static.
Rafael Espindola [Thu, 16 Nov 2017 17:46:43 +0000 (17:46 +0000)]
make exitDsymutil static.

The objective is to remove it completelly.

This first patch removes the last use outside dsymutil.cpp and makes
it static.

llvm-svn: 318429

6 years agoAllow empty mappings for optional YAML input
Dave Lee [Thu, 16 Nov 2017 17:46:11 +0000 (17:46 +0000)]
Allow empty mappings for optional YAML input

Summary:
This change fixes a bug where `obj2yaml` can in some cases produce YAML that
causes `yaml2obj` to error.

The ELF YAML document structure has a `Sections` mapping, which contains three
mappings, all of which are optional: `Local`, `Global`, and `Weak.` Any one of
these can be missing, but if all three are missing, then `yaml2obj` errors. This
change allows YAML input for cases like this one.

I have tested this with check-llvm and check-lld, and all tests passed.

This change is the result of test failures while working on D39582, which
introduces a `DynamicSymbols` mapping, which will be empty at times.

Reviewers: compnerd, jakehehrlich, silvas, kledzik, mehdi_amini, pcc

Reviewed By: compnerd

Subscribers: silvas, llvm-commits

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

llvm-svn: 318428

6 years agoConvert another use of createUniqueFile to TempFile::create.
Rafael Espindola [Thu, 16 Nov 2017 17:35:50 +0000 (17:35 +0000)]
Convert another use of createUniqueFile to TempFile::create.

llvm-svn: 318427

6 years ago[ELF] Fix broken LTO cache test NFC
Andrew Ng [Thu, 16 Nov 2017 17:25:12 +0000 (17:25 +0000)]
[ELF] Fix broken LTO cache test NFC

Commit r318397 fixed the cache pruning interval which broke this test
as it was assuming that the cache pruning was always being
performed. Explicitly set prune interval to 0s to ensure this.

llvm-svn: 318426

6 years ago[DebugInfo/PDB] Exclude the PDB/DIA files added in my previous commit from modulemap
Aaron Smith [Thu, 16 Nov 2017 17:24:49 +0000 (17:24 +0000)]
[DebugInfo/PDB] Exclude the PDB/DIA files added in my previous commit from modulemap

llvm-svn: 318425

6 years agoFixed up to use a class for the commands, renamed the commands and added a way to...
Greg Clayton [Thu, 16 Nov 2017 17:14:48 +0000 (17:14 +0000)]
Fixed up to use a class for the commands, renamed the commands and added a way to just dump the compile unit full paths and optionally their support files with the new "dump-files"command.

llvm-svn: 318424

6 years ago[InstCombine] add tests for 'afn' FMF; NFC
Sanjay Patel [Thu, 16 Nov 2017 17:06:36 +0000 (17:06 +0000)]
[InstCombine] add tests for 'afn' FMF; NFC

llvm-svn: 318423

6 years ago[asan] Ensure that the minimum redzone is at least SHADOW_GRANULARITY
Walter Lee [Thu, 16 Nov 2017 17:03:25 +0000 (17:03 +0000)]
[asan] Ensure that the minimum redzone is at least SHADOW_GRANULARITY

This is required by the Asan run-time.

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

llvm-svn: 318422

6 years ago[asan] Fix small X86_64 ShadowOffset for non-default shadow scale
Walter Lee [Thu, 16 Nov 2017 17:03:00 +0000 (17:03 +0000)]
[asan] Fix small X86_64 ShadowOffset for non-default shadow scale

The requirement is that shadow memory must be aligned to page
boundaries (4k in this case).  Use a closed form equation that always
satisfies this requirement.

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

llvm-svn: 318421

6 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Thu, 16 Nov 2017 17:01:09 +0000 (17:01 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 318420

6 years agoRevert "[Support][CachePruning] Fix regression in pruning interval"
Rafael Espindola [Thu, 16 Nov 2017 17:00:48 +0000 (17:00 +0000)]
Revert "[Support][CachePruning] Fix regression in pruning interval"

This reverts commit r318397.

It broke tools/gold/X86/cache.ll.

llvm-svn: 318419

6 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Thu, 16 Nov 2017 16:59:49 +0000 (16:59 +0000)]
[InstCombine] regenerate test checks; NFC

Also, remove some unnecessary bits. I don't think we need fcmp in any test here either?

llvm-svn: 318418

6 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Thu, 16 Nov 2017 16:38:42 +0000 (16:38 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 318417

6 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Thu, 16 Nov 2017 16:36:48 +0000 (16:36 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 318416

6 years ago[SI] Fix a potential use-after-free
Philip Pfaffe [Thu, 16 Nov 2017 16:35:19 +0000 (16:35 +0000)]
[SI] Fix a potential use-after-free

Summary:
There is a potential use-after-free bug in Scop::buildSchedule(Region *,
LoopStackTy &, LoopInfo &).  Before, we took a reference to LoopStack.back()
which is a use after free, since back is popped off further below. This didn't
crash before by pure chance, since LoopStack is actually a vector, and the
memory isn't freed upon pop. I turned this into an iterator-based algorithm.

Reviewers: grosser, bollu, Meinersbur

Reviewed By: Meinersbur

Subscribers: llvm-commits, pollydev

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

llvm-svn: 318415

6 years agoUpdate tests for llvm.invariant.group.barrier becoming mangled
Yaxun Liu [Thu, 16 Nov 2017 16:33:04 +0000 (16:33 +0000)]
Update tests for llvm.invariant.group.barrier becoming mangled

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

llvm-svn: 318414

6 years agoLet llvm.invariant.group.barrier accepts pointer to any address space
Yaxun Liu [Thu, 16 Nov 2017 16:32:16 +0000 (16:32 +0000)]
Let llvm.invariant.group.barrier accepts pointer to any address space

llvm.invariant.group.barrier may accept pointers to arbitrary address space.

This patch let it accept pointers to i8 in any address space and returns
pointer to i8 in the same address space.

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

llvm-svn: 318413

6 years ago[clangd] Use in-memory preambles in clangd.
Ilya Biryukov [Thu, 16 Nov 2017 16:25:18 +0000 (16:25 +0000)]
[clangd] Use in-memory preambles in clangd.

Reviewers: klimek, bkramer, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 318412

6 years agoAllow to store precompiled preambles in memory.
Ilya Biryukov [Thu, 16 Nov 2017 16:25:01 +0000 (16:25 +0000)]
Allow to store precompiled preambles in memory.

Summary:
These preambles are built by ASTUnit and clangd. Previously, preambles
were always stored on disk.

In-memory preambles are routed back to the compiler as virtual files in
a custom VFS.

Interface of ASTUnit does not allow to use in-memory preambles, as
ASTUnit::CodeComplete receives FileManager as a parameter, so we can't
change VFS used by the compiler inside the CodeComplete method.

A follow-up commit will update clangd in clang-tools-extra to use
in-memory preambles.

Reviewers: klimek, sammccall, bkramer

Reviewed By: klimek

Subscribers: ioeric, cfe-commits

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

llvm-svn: 318411

6 years ago[sanitizer] Use runtime checks instead of API level for Android logging
Kostya Kortchinsky [Thu, 16 Nov 2017 16:19:44 +0000 (16:19 +0000)]
[sanitizer] Use runtime checks instead of API level for Android logging

Summary:
Recent Bionic have a slew of `async_safe_*` logging functions that are
basically the liblog ones but included within the libc. They have the advantage
of not allocating memory. `async_safe_write_log` does no formatting and is
likely the best candidate for logging.

Use a weak definition to try and use it. Also, avoid API level checks (as
the toolchain is compiled at a rather low API level) for `__android_log_write`
in favor of a weak definition as well.

Keep the fallback to `syslog` if nothing else was found.

I tried to overhaul the code block to only have a single #if SANITIZER_ANDROID
but I am not particularly attached to the form. LMKWYT.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 318410

6 years ago[FuzzMutate] Fix windows build after rL318407.
Igor Laevsky [Thu, 16 Nov 2017 16:17:32 +0000 (16:17 +0000)]
[FuzzMutate] Fix windows build after rL318407.
Add correct library dependence.

llvm-svn: 318409

6 years ago[InstSimplify] add tests for fcmp ord/uno; NFC
Sanjay Patel [Thu, 16 Nov 2017 15:25:59 +0000 (15:25 +0000)]
[InstSimplify] add tests for fcmp ord/uno; NFC

llvm-svn: 318408

6 years ago[FuzzMutate] NFC. Move parseModule and writeModule from llvm-isel-fuzzer into FuzzMutate.
Igor Laevsky [Thu, 16 Nov 2017 15:23:08 +0000 (15:23 +0000)]
[FuzzMutate] NFC. Move parseModule and writeModule from llvm-isel-fuzzer into FuzzMutate.
This is to be able to reuse them in the llvm-opt-fuzzer.

llvm-svn: 318407

6 years agoRemove stray comma in sink-addrmode test
John Brawn [Thu, 16 Nov 2017 15:15:00 +0000 (15:15 +0000)]
Remove stray comma in sink-addrmode test

The extra comma meant it wasn't correctly checking that we weren't getting an
extra getelementptr.

llvm-svn: 318406

6 years ago[InstCombine] include 'sub' in the list of narrow-able binops
Sanjay Patel [Thu, 16 Nov 2017 14:40:51 +0000 (14:40 +0000)]
[InstCombine] include 'sub' in the list of narrow-able binops

      // trunc (binop X, C) --> binop (trunc X, C')
      // trunc (binop (ext X), Y) --> binop X, (trunc Y)

I'm grouping sub with the other binops  because that makes the code simpler
and the transforms are valid:
https://rise4fun.com/Alive/UeF
...so even though we don't expect a sub with constant Op1 or any of the
other opcodes with constant Op0 due to canonicalization rules, we might as
well handle those situations if non-canonical code somehow reaches this
point (it should just make instcombine more efficient in reaching its
end goal).

This should solve the problem that later manifests in the vectorizers in
PR35295:
https://bugs.llvm.org/show_bug.cgi?id=35295

llvm-svn: 318404

6 years ago[DebugInfo/PDB] Adding getUndecoratedNameEx and IPDB interfaces for IDiaEnumTables...
Aaron Smith [Thu, 16 Nov 2017 14:33:09 +0000 (14:33 +0000)]
[DebugInfo/PDB] Adding getUndecoratedNameEx and IPDB interfaces for IDiaEnumTables and IDiaTable.

Initial changes to support debugging PE/COFF files with LLDB on Windows through DIA SDK.
There is another set of changes required on the LLDB side before this does anything.

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

llvm-svn: 318403

6 years ago[X86] Add scheduling tests for SHLD/SHRD
Simon Pilgrim [Thu, 16 Nov 2017 14:13:48 +0000 (14:13 +0000)]
[X86] Add scheduling tests for SHLD/SHRD

llvm-svn: 318402

6 years ago[SCEV] simplify loop. NFC.
Javed Absar [Thu, 16 Nov 2017 13:49:27 +0000 (13:49 +0000)]
[SCEV] simplify loop. NFC.

Change loop to range-based

llvm-svn: 318401

6 years agoTest commit. Add a missing dash to the standard llvm file header; NFC.
Aaron Smith [Thu, 16 Nov 2017 13:42:28 +0000 (13:42 +0000)]
Test commit. Add a missing dash to the standard llvm file header; NFC.

llvm-svn: 318400

6 years agoImplement core dump debugging for PPC64le
Pavel Labath [Thu, 16 Nov 2017 13:38:57 +0000 (13:38 +0000)]
Implement core dump debugging for PPC64le

Summary: Implement core dump debugging for PPC64le.

Reviewers: labath

Reviewed By: labath

Subscribers: JDevlieghere, krytarowski, clayborg, labath, lbianc, nemanjai, gut, anajuliapc, mgorny, kbarton, lldb-commits

Differential Revision: https://reviews.llvm.org/D39681
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>

llvm-svn: 318399

6 years ago[ARM GlobalISel] Add tests for BIC. NFC
Diana Picus [Thu, 16 Nov 2017 13:32:47 +0000 (13:32 +0000)]
[ARM GlobalISel] Add tests for BIC. NFC

Add instruction selector tests for BICrr and BICri, which are handled by
TableGen.

llvm-svn: 318398

6 years ago[Support][CachePruning] Fix regression in pruning interval
Ben Dunbobbin [Thu, 16 Nov 2017 13:15:56 +0000 (13:15 +0000)]
[Support][CachePruning] Fix regression in pruning interval

Fixed broken comparison.
borked by: rL284966 (see: https://reviews.llvm.org/D25730).

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

llvm-svn: 318397

6 years ago[builtins][ARM] re-enable mulsc3_test.c on Arm
Peter Smith [Thu, 16 Nov 2017 13:00:17 +0000 (13:00 +0000)]
[builtins][ARM] re-enable mulsc3_test.c on Arm

The mulsc3_test.c was marked as unsupported due to PR32457, the underlying
cause of this PR was fixed in PR28164 so we can remove the unsupported as
it is no longer needed.

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

llvm-svn: 318396

6 years ago[asan] Fix size/alignment issues with non-default shadow scale
Walter Lee [Thu, 16 Nov 2017 12:57:19 +0000 (12:57 +0000)]
[asan] Fix size/alignment issues with non-default shadow scale

Fix a couple places where the minimum alignment/size should be a
function of the shadow granularity:
- alignment of AllGlobals
- the minimum left redzone size on the stack

Added a test to verify that the metadata_array is properly aligned
for shadow scale of 5, to be enabled when we add build support
for testing shadow scale of 5.

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

llvm-svn: 318395

6 years ago[ELF] - Don't emit broken relocations for SHF_MERGE sections when --emit-relocs is...
George Rimar [Thu, 16 Nov 2017 12:33:36 +0000 (12:33 +0000)]
[ELF] - Don't emit broken relocations for SHF_MERGE sections when --emit-relocs is used.

Previously our relocations we rewrote were broken for that case.
We emited incorrect addend and broken relocation info field
because did not produce section symbol for mergeable synthetic sections.

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

llvm-svn: 318394

6 years ago[ARM GlobalISel] Add tests for REVSH patterns. NFC
Diana Picus [Thu, 16 Nov 2017 12:29:28 +0000 (12:29 +0000)]
[ARM GlobalISel] Add tests for REVSH patterns. NFC

Add instruction selector tests for some of the REVSH patterns handled by
TableGen.

llvm-svn: 318393

6 years agoFix pointer EVT in SelectionDAGBuilder::visitAlloca
Yaxun Liu [Thu, 16 Nov 2017 12:22:19 +0000 (12:22 +0000)]
Fix pointer EVT in SelectionDAGBuilder::visitAlloca

SelectionDAGBuilder::visitAlloca assumes alloca address space is 0, which is
incorrect for triple amdgcn---amdgiz and causes isel failure.

This patch fixes that.

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

llvm-svn: 318392

6 years ago[COFF] Don't write long section names for sections that will be mapped at runtime
Martin Storsjo [Thu, 16 Nov 2017 12:06:42 +0000 (12:06 +0000)]
[COFF] Don't write long section names for sections that will be mapped at runtime

Sections that will be mapped at runtime will only have the short
section name available, since the string table it points into isn't
mapped. Therefore prefer truncating those names over writing a
long name that is unavailable at runtime.

This allows libunwind to find the .eh_frame section at runtime even
if the module was built with debug info enabled.

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

llvm-svn: 318391

6 years ago[DAGCombine] Enable more srl -> load combines
Sam Parker [Thu, 16 Nov 2017 11:28:26 +0000 (11:28 +0000)]
[DAGCombine] Enable more srl -> load combines

Change the calculation for the desired ValueType for non-sign
extending loads, as in those cases we don't care about the
higher bits. This creates a smaller ExtVT and allows for such
combinations as:
(srl (zextload i16, [addr]), 8) -> (zextload i8, [addr + 1])

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

llvm-svn: 318390

6 years ago[mips][mt] Add missing test cases from r318207
Simon Dardis [Thu, 16 Nov 2017 10:50:44 +0000 (10:50 +0000)]
[mips][mt] Add missing test cases from r318207

llvm-svn: 318389

6 years agoExclude untied tasks from checking of task scheduling constraint (TSC).
Andrey Churbanov [Thu, 16 Nov 2017 10:45:07 +0000 (10:45 +0000)]
Exclude untied tasks from checking of task scheduling constraint (TSC).
This can improve performance of tests with untied tasks.

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

llvm-svn: 318388

6 years agoAssert correct removal of SUnit in LatencyPriorityQueue
Benjamin Kramer [Thu, 16 Nov 2017 10:18:07 +0000 (10:18 +0000)]
Assert correct removal of SUnit in LatencyPriorityQueue

The LatencyPriorityQueue doesn't currently check whether the SU being removed really exists in the Queue.
This method fails quietly when SU is not found and removes the last element from the Queue, leading to unexpected behavior.

Unfortunately, this only occurs on our custom target, with the custom scheduler. In our case, when remove() is invoked, it removes the wrong SU at the end of the Queue, which is only discovered later when VerifyScheduledDAG() is invoked and finds that some nodes were not scheduled at all.

As this is only reproducible with a lot of proprietary code, I'm hopeful this assert is straightforward enough to not necessitate a test.

Patch by Ondrej Glasnak!

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

llvm-svn: 318387

6 years ago[TTI][X86] update costs of interleaved load\store of i64\double
Mohammed Agabaria [Thu, 16 Nov 2017 09:38:32 +0000 (09:38 +0000)]
[TTI][X86] update costs of interleaved load\store of i64\double

This patch contains more accurate cost of interelaved load\store of stride 2 for the types int64\double on AVX2.

Reviewers: delena, RKSimon, craig.topper, dorit

Reviewed By: dorit

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

llvm-svn: 318385

6 years ago[COFF] Improve the autoexport check for symbols from import libraries with -opt:noref
Martin Storsjo [Thu, 16 Nov 2017 07:22:44 +0000 (07:22 +0000)]
[COFF] Improve the autoexport check for symbols from import libraries with -opt:noref

If -opt:noref is specified, they can end up with isLive() == 1
when the autoexport check is run.

To reduce the risk of potential issues, only consider exporting
DefinedRegular and DefinedCommon, nothing else.

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

llvm-svn: 318384

6 years ago[docs] Mention that dwarf unwinding should be supported on arm64/windows
Martin Storsjo [Thu, 16 Nov 2017 07:16:36 +0000 (07:16 +0000)]
[docs] Mention that dwarf unwinding should be supported on arm64/windows

This didn't require any further changes to libunwind as long as win64
in general is handled correctly.

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

llvm-svn: 318383

6 years ago[MachineRegisterInfo] Avoid having dbg.values affect code generation
Mikael Holmen [Thu, 16 Nov 2017 07:01:23 +0000 (07:01 +0000)]
[MachineRegisterInfo] Avoid having dbg.values affect code generation

Summary:
Use use_nodbg_empty() rather than use_empty() in
MachineRegisterInfo::EmitLiveInCopies() when determining if a livein
register has any uses or not. Otherwise a single dbg.value can make us
generate different code, meaning -g would affect code generation.

Found when compiling code for my out-of-tree target. Unfortunately I
haven't been able to reproduce the problem on X86 or any of the other
in-tree targets that I tried, so no test case.

Reviewers: MatzeB

Reviewed By: MatzeB

Subscribers: llvm-commits

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

llvm-svn: 318382

6 years ago[IRCE] Fix SCEVExpander's usage in IRCE
Max Kazantsev [Thu, 16 Nov 2017 06:06:27 +0000 (06:06 +0000)]
[IRCE] Fix SCEVExpander's usage in IRCE

When expanding exit conditions for pre- and postloops, we may end up expanding a
recurrency from the loop to in its loop's preheader. This produces incorrect IR.

This patch ensures that IRCE uses SCEVExpander correctly and only expands code which
is safe to expand in this particular location.

Differentian Revision: https://reviews.llvm.org/D39234

llvm-svn: 318381

6 years ago[X86] Update TTI to report that v1iX/v1fX types aren't legal for masked gather/scatte...
Craig Topper [Thu, 16 Nov 2017 06:02:05 +0000 (06:02 +0000)]
[X86] Update TTI to report that v1iX/v1fX types aren't legal for masked gather/scatter/load/store.

The type legalizer will try to scalarize these operations if it sees them, but there is no handling for scalarizing them. This leads to a fatal error. With this change they will now be scalarized by the mem intrinsic scalarizing pass before SelectionDAG.

llvm-svn: 318380

6 years ago[SelectionDAG] Use report_fatal_error instead of llvm_unreachable in some code that...
Craig Topper [Thu, 16 Nov 2017 06:02:03 +0000 (06:02 +0000)]
[SelectionDAG] Use report_fatal_error instead of llvm_unreachable in some code that can be reached if targets don't configure things correctly.

For example, this is currently reachable by X86 if you use a masked store intrinsic with a v1iX type.

Using a fatal error seems like a better user experience if someone were to encounter this on a release build. There are several other similar places that have been converted from unreachable to fatal error previously.

llvm-svn: 318379

6 years agoMore of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in filesyste...
Marshall Clow [Thu, 16 Nov 2017 05:48:32 +0000 (05:48 +0000)]
More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in filesystem::path

llvm-svn: 318378

6 years ago[SCEV][NFC] Introduce isSafeToExpandAt function to SCEVExpander
Max Kazantsev [Thu, 16 Nov 2017 05:10:56 +0000 (05:10 +0000)]
[SCEV][NFC] Introduce isSafeToExpandAt function to SCEVExpander

This function checks that:
1) It is safe to expand a SCEV;
2) It is OK to materialize it at the specified location.
For example, attempt to expand a loop's AddRec to the same loop's preheader should fail.

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

llvm-svn: 318377

6 years ago[libFuzzer] disable test/fuzzer/merge-sigusr.test on Mac while investigating the...
Kostya Serebryany [Thu, 16 Nov 2017 04:52:05 +0000 (04:52 +0000)]
[libFuzzer] disable test/fuzzer/merge-sigusr.test on Mac while investigating the bot failure

llvm-svn: 318376

6 years agoMore of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in match_res...
Marshall Clow [Thu, 16 Nov 2017 04:48:34 +0000 (04:48 +0000)]
More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in match_results. <regex>

llvm-svn: 318375

6 years agoFix thinko in last commit.
Eric Christopher [Thu, 16 Nov 2017 03:25:02 +0000 (03:25 +0000)]
Fix thinko in last commit.

llvm-svn: 318374

6 years agoAdd NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.
Eric Christopher [Thu, 16 Nov 2017 03:18:15 +0000 (03:18 +0000)]
Add NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.

llvm-svn: 318373

6 years agoNeed to work around the gcc Wunused-function bug as far back as gcc 6.1, update accor...
Eric Christopher [Thu, 16 Nov 2017 03:18:13 +0000 (03:18 +0000)]
Need to work around the gcc Wunused-function bug as far back as gcc 6.1, update accordingly.

llvm-svn: 318372

6 years agoAdd NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.
Eric Christopher [Thu, 16 Nov 2017 03:18:09 +0000 (03:18 +0000)]
Add NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.

llvm-svn: 318371

6 years agoFix APInt bit size in processDbgDeclares
Yaxun Liu [Thu, 16 Nov 2017 02:54:49 +0000 (02:54 +0000)]
Fix APInt bit size in processDbgDeclares

processDbgDeclares assumes pointer size is the same for different addr spaces.
It uses pointer size for addr space 0 for all pointers, which causes assertion
in stripAndAccumulateInBoundsConstantOffsets for amdgcn---amdgiz since
pointer in addr space 5 has different size than in addr space 0.

This patch fixes that.

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

llvm-svn: 318370

6 years ago[asan] Fallback to non-ifunc dynamic shadow on android<22.
Evgeniy Stepanov [Thu, 16 Nov 2017 02:52:19 +0000 (02:52 +0000)]
[asan] Fallback to non-ifunc dynamic shadow on android<22.

Summary: Android < 22 does not support ifunc.

Reviewers: pcc

Subscribers: srhines, kubamracek, hiraditya, llvm-commits

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

llvm-svn: 318369

6 years ago[X86] Custom type legalize v2f32 masked gathers instead of trying to cleanup after...
Craig Topper [Thu, 16 Nov 2017 02:07:45 +0000 (02:07 +0000)]
[X86] Custom type legalize v2f32 masked gathers instead of trying to cleanup after type legalization.

llvm-svn: 318368

6 years ago[DeclPrinter] Extract function PrintConstructorInitializers, NFC
Alex Lorenz [Thu, 16 Nov 2017 01:31:27 +0000 (01:31 +0000)]
[DeclPrinter] Extract function PrintConstructorInitializers, NFC

Patch by Nikolai Kosjar!

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

llvm-svn: 318367

6 years agoadd check to avoid throwing objc exception according to Google Objective-C guide
Yan Zhang [Thu, 16 Nov 2017 01:28:29 +0000 (01:28 +0000)]
add check to avoid throwing objc exception according to Google Objective-C guide

Summary:
This is a small check to avoid throwing objc exceptions.
In specific it will detect the usage of @throw statement and throw warning.

Reviewers: hokein, benhamilton

Reviewed By: hokein, benhamilton

Subscribers: cfe-commits, mgorny

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

llvm-svn: 318366

6 years ago[DeclPrinter] Honor TerseOutput for constructors
Alex Lorenz [Thu, 16 Nov 2017 01:28:25 +0000 (01:28 +0000)]
[DeclPrinter] Honor TerseOutput for constructors

Patch by Nikolai Kosjar!

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

llvm-svn: 318365

6 years ago[coff] correctly emit safeseh entries for handlers defined in dlls
Bob Haarman [Thu, 16 Nov 2017 01:22:01 +0000 (01:22 +0000)]
[coff] correctly emit safeseh entries for handlers defined in dlls

Summary:
We previously assumed that all SafeSEH handlers are
DefinedRegular symbols. This is not the case for handlers defined in
DLLs. As a result, we were failing to emit entries in the SafeSEH
table for those handlers. This change fixes that.

Fixes PR35324.

Reviewers: rnk, ruiu

Reviewed By: rnk

Subscribers: llvm-commits

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

llvm-svn: 318364

6 years agoLTO: clarify why we need to gracefully handle sys::fs::rename failures
Bob Haarman [Thu, 16 Nov 2017 01:16:52 +0000 (01:16 +0000)]
LTO: clarify why we need to gracefully handle sys::fs::rename failures

Reviewers: pcc, rafael

Reviewed By: pcc

Subscribers: mehdi_amini, llvm-commits, hiraditya

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

llvm-svn: 318362

6 years agoConvert a use of createUniqueFile to TempFile::create.
Rafael Espindola [Thu, 16 Nov 2017 01:06:36 +0000 (01:06 +0000)]
Convert a use of createUniqueFile to TempFile::create.

llvm-svn: 318361