platform/upstream/llvm.git
6 years ago[WebAssembly] Remove final -wasm component of target triple. NFC.
Sam Clegg [Thu, 10 May 2018 17:59:41 +0000 (17:59 +0000)]
[WebAssembly] Remove final -wasm component of target triple. NFC.

This has been the default for a while now.

llvm-svn: 332009

6 years ago[WebAsembly] Update default triple in test files to wasm32-unknown-unkown.
Sam Clegg [Thu, 10 May 2018 17:49:11 +0000 (17:49 +0000)]
[WebAsembly] Update default triple in test files to wasm32-unknown-unkown.

Summary: The final -wasm component has been the default for some time now.

Subscribers: jfb, dschuff, jgravelle-google, eraman, aheejin, JDevlieghere, sunfish, llvm-commits

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

llvm-svn: 332007

6 years ago[X86][Znver1] Remove unnecessary SchedWritePMULLD InstRW overrides.
Simon Pilgrim [Thu, 10 May 2018 17:42:26 +0000 (17:42 +0000)]
[X86][Znver1] Remove unnecessary SchedWritePMULLD InstRW overrides.

llvm-svn: 332006

6 years ago[WebAssembly] Create section start symbols automatically for all sections
Sam Clegg [Thu, 10 May 2018 17:38:35 +0000 (17:38 +0000)]
[WebAssembly] Create section start symbols automatically for all sections

These symbols only get included in the output symbols table if
they are used in a relocation.

This behaviour matches more closely the ELF object writer.

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

llvm-svn: 332005

6 years ago[PM/LoopUnswitch] Avoid pointlessly creating an exit block set.
Chandler Carruth [Thu, 10 May 2018 17:33:20 +0000 (17:33 +0000)]
[PM/LoopUnswitch] Avoid pointlessly creating an exit block set.

This code can just test whether blocks are *in* the loop, which we
already have a dedicated set tracking in the loop itself.

llvm-svn: 332004

6 years agowrong usages of sem_open in the libFuzzer
Kamil Rytarowski [Thu, 10 May 2018 17:31:06 +0000 (17:31 +0000)]
wrong usages of sem_open in the libFuzzer

Summary:
Fixed two non-standard usages of sem_open in the libFuzzer library and
one NetBSD-related modification with test script.

  - The return value to indicate error should be SEM_FAILED instead of
    (void *)-1 (please refer to "RETURN VALUE" section in this [[
    http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html
    | page ]]). Actually, SEM_FAILED != (void *)-1 holds in NetBSD.

  - The SharedMemoryRegion::SemName function should return name
    starting with slash. Because the behaviour of name which does not
    start with slash is unspecified as the [[
    http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html
    | "DESCRIPTION" section ]] specified:

> If name does not begin with the <slash> character, the effect is implementation-defined.

  - The length of name is limited to 14 in NetBSD, it is suggested to
    reduce the length of equivalence server name in the test script.

Patch by: Yang Zheng

Reviewers: vitalybuka, krytarowski, kcc

Reviewed By: kcc

Subscribers: kcc, #sanitizers, llvm-commits, joerg

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

llvm-svn: 332003

6 years ago[X86][SNB] Fix typo in PEXTRDmr instregex, was missing VPEXTRDmr.
Simon Pilgrim [Thu, 10 May 2018 17:30:49 +0000 (17:30 +0000)]
[X86][SNB] Fix typo in PEXTRDmr instregex, was missing VPEXTRDmr.

llvm-svn: 332002

6 years agoMore notes on Rapperswil issues
Marshall Clow [Thu, 10 May 2018 17:07:38 +0000 (17:07 +0000)]
More notes on Rapperswil issues

llvm-svn: 332000

6 years ago[X86] Split WriteVecALU/WriteVecLogic/WriteShuffle/WriteVarShuffle/WritePSADBW/WriteP...
Simon Pilgrim [Thu, 10 May 2018 17:06:09 +0000 (17:06 +0000)]
[X86] Split WriteVecALU/WriteVecLogic/WriteShuffle/WriteVarShuffle/WritePSADBW/WritePHAdd scheduler classes

Split off XMM classes from the default (MMX) classes.

llvm-svn: 331999

6 years ago[InstCombine] regenerate full checks; NFC
Sanjay Patel [Thu, 10 May 2018 17:05:38 +0000 (17:05 +0000)]
[InstCombine] regenerate full checks; NFC

llvm-svn: 331998

6 years ago[mips] Accept 32-bit offsets for ld/sd/lld commands
Simon Atanasyan [Thu, 10 May 2018 16:01:36 +0000 (16:01 +0000)]
[mips] Accept 32-bit offsets for ld/sd/lld commands

This is a follow up to the rL330983. The patch teaches ld, sd, and lld
commands accept 32-bit memory offsets by replacing `mem_simm16` operand
to `mem_simmptr`. In fact, these commands should accept 64-bit offsets,
but so large offsets require another command expanding and will be
supported by a separate patch.

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

llvm-svn: 331997

6 years ago[mips] Accept 32-bit offsets for lh and lhu commands
Simon Atanasyan [Thu, 10 May 2018 16:01:18 +0000 (16:01 +0000)]
[mips] Accept 32-bit offsets for lh and lhu commands

This is a follow up to the rL330983. The patch teaches lh and lhu
commands accepts 32-bit memory offsets by replacing `mem_simm16` operand
to `mem_simmptr`.

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

llvm-svn: 331996

6 years ago[ELF][MIPS] Add test case to check some microMIPS R6 relocations. NFC
Simon Atanasyan [Thu, 10 May 2018 15:56:27 +0000 (15:56 +0000)]
[ELF][MIPS] Add test case to check some microMIPS R6 relocations. NFC

llvm-svn: 331995

6 years ago[ELF][MIPS] Add test case to check N32 ABI PLT generation. NFC
Simon Atanasyan [Thu, 10 May 2018 15:56:22 +0000 (15:56 +0000)]
[ELF][MIPS] Add test case to check N32 ABI PLT generation. NFC

llvm-svn: 331994

6 years ago[llvm-objcopy] Add tests for help messages
Alexander Shaposhnikov [Thu, 10 May 2018 15:56:04 +0000 (15:56 +0000)]
[llvm-objcopy] Add tests for help messages

This diff slightly reorganizes the tests  and improves
the test coverage of help messages / error reports.

Test plan: make check-all

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

llvm-svn: 331993

6 years ago[x86] fix fmaxnum/fminnum with nnan
Sanjay Patel [Thu, 10 May 2018 15:40:49 +0000 (15:40 +0000)]
[x86] fix fmaxnum/fminnum with nnan

With nnan, there's no need for the masked merge / blend
sequence (that probably costs much more than the min/max
instruction).

Somewhere between clang 5.0 and 6.0, we started producing
these intrinsics for fmax()/fmin() in C source instead of
libcalls or fcmp/select. The backend wasn't prepared for
that, so we regressed perf in those cases.

Note: it's possible that other targets have similar problems
as seen here.

Noticed while investigating PR37403 and related bugs:
https://bugs.llvm.org/show_bug.cgi?id=37403

The IR FMF propagation cases still don't work. There's
a proposal that might fix those cases in D46563.

llvm-svn: 331992

6 years ago[DSE] Teach the pass about partial overwrite of atomic memory intrinsics
Daniel Neilson [Thu, 10 May 2018 15:12:49 +0000 (15:12 +0000)]
[DSE] Teach the pass about partial overwrite of atomic memory intrinsics

Summary:
This change teaches DSE that the atomic memory intrinsics can be overwriten
partially in the same way as the non-atomic forms. Specifically, that the
atomic memcpy & memset can be shortened at the end and that the atomic memset
can be shortened at the beginning, if they partially overwritten
by later stores.

Reviewers: mkazantsev, skatkov, apilipenko, efriedma, rsmith, spatel, filcab, sanjoy

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 331991

6 years ago[PR37339] Fix assertion in FunctionComparator::cmpInlineAsm
whitequark [Thu, 10 May 2018 15:05:47 +0000 (15:05 +0000)]
[PR37339] Fix assertion in FunctionComparator::cmpInlineAsm

Fixes bug https://bugs.llvm.org/show_bug.cgi?id=37339.

InlineAsm is only uniqued if the FunctionTypes are exactly the
same, while cmpTypes() for example considers all pointer types
in the default address space to be the same. For this reason
the end of cmpInlineAsm() can be reached.

This patch replaces the unreachable assertion with a check that
the function types are not identical.

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

Reviewers: jfb
llvm-svn: 331990

6 years ago[x86] fix test names; NFC
Sanjay Patel [Thu, 10 May 2018 14:58:47 +0000 (14:58 +0000)]
[x86] fix test names; NFC

llvm-svn: 331989

6 years ago[x86] add tests for maxnum/minnum intrinsics with nnan; NFC
Sanjay Patel [Thu, 10 May 2018 14:48:42 +0000 (14:48 +0000)]
[x86] add tests for maxnum/minnum intrinsics with nnan; NFC

Clang 6.0 was updated to create these intrinsics rather than
libcalls or fcmp/select, but the backend wasn't prepared to
handle that optimally.

This bug is not the primary reason for PR37403:
https://bugs.llvm.org/show_bug.cgi?id=37403
...but it's probably more important for x86 perf.

llvm-svn: 331988

6 years agoDon't redefine a bunch of defines from llvm-config.h in config.h.
Nico Weber [Thu, 10 May 2018 14:45:05 +0000 (14:45 +0000)]
Don't redefine a bunch of defines from llvm-config.h in config.h.

r210144 made config.h include llvm-config.h and deduplicated defines. Then
rL239987 later added back some of the duplication.
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150914/300329.html
suggests this was done for the configure/make build, which no longer exists.

No intended behavior change.

https://reviews.llvm.org/D46288

llvm-svn: 331987

6 years ago[DWARF] Remove unused member and fix(?) the unit-tests on big endian hosts
James Henderson [Thu, 10 May 2018 14:36:24 +0000 (14:36 +0000)]
[DWARF] Remove unused member and fix(?) the unit-tests on big endian hosts

I can't verified the fix on a big endian host, so I'm not 100% certain it
will work.

llvm-svn: 331986

6 years ago[DAG] Avoid using deleted node in rebuildSetCC
Nirav Dave [Thu, 10 May 2018 14:28:54 +0000 (14:28 +0000)]
[DAG] Avoid using deleted node in rebuildSetCC

Summary:
The combine in rebuildSetCC may be combined to another
node leaving our references stale. Keep a handle on
it to avoid stale references.

Fixes PR36602.

Reviewers: dbabokin, RKSimon, eli.friedman, davide

Subscribers: hiraditya, uabelho, JesperAntonsson, qcolombet, llvm-commits

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

llvm-svn: 331985

6 years ago[DWARF] DwarfGenerator.h LineTable: explicitly mark DG as unused
Roman Lebedev [Thu, 10 May 2018 14:16:45 +0000 (14:16 +0000)]
[DWARF] DwarfGenerator.h LineTable: explicitly mark DG as unused

Just want to unbreak the build.

llvm-svn: 331984

6 years ago[DWARF] dwarfgen::LineTable::writeData(): pacify -Wcovered-switch-default
Roman Lebedev [Thu, 10 May 2018 14:16:41 +0000 (14:16 +0000)]
[DWARF] dwarfgen::LineTable::writeData(): pacify -Wcovered-switch-default

llvm-svn: 331983

6 years ago[DWARF] DWARFDebugLineTest: fix a few more signed/unsigned mismatch warnings
Roman Lebedev [Thu, 10 May 2018 14:16:37 +0000 (14:16 +0000)]
[DWARF] DWARFDebugLineTest: fix a few more signed/unsigned mismatch warnings

llvm-svn: 331982

6 years ago[ELF] - Improve the test cases for notes sections.
George Rimar [Thu, 10 May 2018 13:45:34 +0000 (13:45 +0000)]
[ELF] - Improve the test cases for notes sections.

A minor clean up and improvement for our tests for notes sections.

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

llvm-svn: 331980

6 years agoThis patch provides that bitfields are splitted even in case
Strahinja Petrovic [Thu, 10 May 2018 12:31:12 +0000 (12:31 +0000)]
This patch provides that bitfields are splitted even in case
when current field is not legal integer type.

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

llvm-svn: 331979

6 years agoFix signed/unsigned comparison warning and print format
James Henderson [Thu, 10 May 2018 12:15:43 +0000 (12:15 +0000)]
Fix signed/unsigned comparison warning and print format

The print format was causing at least 2 unit-test failures from r331971.

The signed/unsigned comparison warnings only appeared to affect two lines but
it was unclear whether it might just pop up on other lines, so I have been
explicit in all the literals in the tests.

There were other bot unit-test failures that I am still investigating.

llvm-svn: 331978

6 years agoFix one more RunShellcommand occurence in mac code
Pavel Labath [Thu, 10 May 2018 12:02:24 +0000 (12:02 +0000)]
Fix one more RunShellcommand occurence in mac code

llvm-svn: 331977

6 years ago[CFLGraph] Fixed Select instruction handling
David Bolvansky [Thu, 10 May 2018 11:47:36 +0000 (11:47 +0000)]
[CFLGraph] Fixed Select instruction handling

Summary:
Operand 0 is the condition, not the true value.

Use op 1 and op 2 as the correct values.

Reviewers: george.burgess.iv, nlopes, efriedma

Reviewed By: george.burgess.iv

Subscribers: craig.topper, rjmccall, lebedev.ri, llvm-commits

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

llvm-svn: 331976

6 years ago[InstCombine] Only propagate known leading zeros from udiv input to output.
Benjamin Kramer [Thu, 10 May 2018 11:45:18 +0000 (11:45 +0000)]
[InstCombine] Only propagate known leading zeros from udiv input to output.

Put in a conservatively correct estimate for now. Avoids miscompiling
clang in FDO mode. This is really tricky to trigger in reality as
basically all interesting cases will be folded away by computeKnownBits
earlier, I was unable to find a reasonably small test case.

llvm-svn: 331975

6 years agoFix windows&mac builds broken by r331970 (RunShellCommand/Timeout) refactor
Pavel Labath [Thu, 10 May 2018 11:27:43 +0000 (11:27 +0000)]
Fix windows&mac builds broken by r331970 (RunShellCommand/Timeout) refactor

llvm-svn: 331974

6 years ago[ELF] Omit PT_NOTE for SHT_NOTE without SHF_ALLOC
Ed Maste [Thu, 10 May 2018 11:12:18 +0000 (11:12 +0000)]
[ELF] Omit PT_NOTE for SHT_NOTE without SHF_ALLOC

A non-alloc note section should not have a PT_NOTE program header.

Found while linking ghc (Haskell compiler) with lld on FreeBSD.
ghc emits a .debug-ghc-link-info note section (as the name suggests, it
contains link information) as a SHT_NOTE section without SHF_ALLOC set.

For this case ld.bfd does not emit a PT_NOTE segment for the
.debug-ghc-link-info section.  lld previously emitted a PT_NOTE with
p_vaddr = 0 and FreeBSD's rtld segfaulted when trying to parse a note at
address 0.

llvm.org/pr37361

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

llvm-svn: 331973

6 years ago[ELF] Rework debug line parsing to use llvm::Error and callbacks (LLD-side)
James Henderson [Thu, 10 May 2018 10:52:21 +0000 (10:52 +0000)]
[ELF] Rework debug line parsing to use llvm::Error and callbacks (LLD-side)

Reviewed by: ruiu, grimar, espindola

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

Summary:
r331971 changes the debug line parser interface to report LLVM errors in an
interface that different executables can use, rather than always being printed
directly as warnings to stderr. This change allows LLD to make use of the new
interface and call its own warning methods to report problems.

llvm-svn: 331972

6 years ago[DWARF] Rework debug line parsing to use llvm::Error and callbacks
James Henderson [Thu, 10 May 2018 10:51:33 +0000 (10:51 +0000)]
[DWARF] Rework debug line parsing to use llvm::Error and callbacks

Reviewed by: dblaikie, JDevlieghere, espindola

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

Summary:
The .debug_line parser previously reported errors by printing to stderr and
return false. This is not particularly helpful for clients of the library code,
as it prevents them from handling the errors in a manner based on the calling
context. This change switches to using llvm::Error and callbacks to indicate
what problems were detected during parsing, and has updated clients to handle
the errors in a location-specific manner. In general, this means that they
continue to do the same thing to external users. Below, I have outlined what
the known behaviour changes are, relating to this change.

There are two levels of "errors" in the new error mechanism, to broadly
distinguish between different fail states of the parser, since not every
failure will prevent parsing of the unit, or of subsequent unit. Malformed
table errors that prevent reading the remainder of the table (reported by
returning them) and other minor issues representing problems with parsing that
do not prevent attempting to continue reading the table (reported by calling a
specified callback funciton). The only example of this currently is when the
last sequence of a unit is unterminated. However, I think it would be good to
change the handling of unrecognised opcodes to report as minor issues as well,
rather than just printing to the stream if --verbose is used (this would be a
subsequent change however).

I have substantially extended the DwarfGenerator to be able to handle
custom-crafted .debug_line sections, allowing for comprehensive unit-testing
of the parser code. For now, I am just adding unit tests to cover the basic
error reporting, and positive cases, and do not currently intend to test every
part of the parser, although the framework should be sufficient to do so at a
later point.

Known behaviour changes:
  - The dump function in DWARFContext now does not attempt to read subsequent
  tables when searching for a specific offset, if the unit length field of a
  table before the specified offset is a reserved value.
  - getOrParseLineTable now returns a useful Error if an invalid offset is
  encountered, rather than simply a nullptr.
  - The parse functions no longer use `WithColor::warning` directly to report
  errors, allowing LLD to call its own warning function.
  - The existing parse error messages have been updated to not specifically
  include "warning" in their message, allowing consumers to determine what
  severity the problem is.
  - If the line table version field appears to have a value less than 2, an
  informative error is returned, instead of just false.
  - If the line table unit length field uses a reserved value, an informative
  error is returned, instead of just false.
  - Dumping of .debug_line.dwo sections is now implemented the same as regular
  .debug_line sections.
  - Verbose dumping of .debug_line[.dwo] sections now prints the prologue, if
  there is a prologue error, just like non-verbose dumping.

As a helper for the generator code, I have re-added emitInt64 to the
AsmPrinter code. This previously existed, but was removed way back in r100296,
presumably because it was dead at the time.

This change also requires a change to LLD, which will be committed separately.

llvm-svn: 331971

6 years agoConvert all RunShellCommand functions to use the Timeout class
Pavel Labath [Thu, 10 May 2018 10:46:03 +0000 (10:46 +0000)]
Convert all RunShellCommand functions to use the Timeout class

this completes the Timeout migration started in r331880 with the
Predicate class.

llvm-svn: 331970

6 years ago[mips] Correct the predicates of cvt.fmt.fmt instructions
Simon Dardis [Thu, 10 May 2018 10:42:30 +0000 (10:42 +0000)]
[mips] Correct the predicates of cvt.fmt.fmt instructions

Reviewers: atanasyan, smaksimovic, abeserminji

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

llvm-svn: 331969

6 years agoCPlusPlusLanguage: Add unit tests for the FindAlternateFunctionManglings method
Pavel Labath [Thu, 10 May 2018 08:59:17 +0000 (08:59 +0000)]
CPlusPlusLanguage: Add unit tests for the FindAlternateFunctionManglings method

I was considering modifying this function, so I wrote some tests to make
sure I don't regress its behavior. I am not sure if I will actually
proceed with the modifications, but the tests seem useful nonetheless.

llvm-svn: 331966

6 years agoAdd support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Sylvestre Ledru [Thu, 10 May 2018 08:45:43 +0000 (08:45 +0000)]
Add support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Patch by Adam Conrad

llvm-svn: 331965

6 years ago[sanitizer] Attempt to fix strace_test.cc on ppc64le
Vitaly Buka [Thu, 10 May 2018 08:16:23 +0000 (08:16 +0000)]
[sanitizer] Attempt to fix strace_test.cc on ppc64le

llvm-svn: 331964

6 years agoRevert "[Itanium] Emit type info names with external linkage."
Eric Fiselier [Thu, 10 May 2018 08:10:57 +0000 (08:10 +0000)]
Revert "[Itanium] Emit type info names with external linkage."

This reverts commit r331957. It seems to be causing failures
on ppc64le-linux.

llvm-svn: 331963

6 years ago[X86] ptwrite intrinsic
Gabor Buella [Thu, 10 May 2018 07:28:54 +0000 (07:28 +0000)]
[X86] ptwrite intrinsic

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper

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

llvm-svn: 331962

6 years ago[X86] ptwrite intrinsic
Gabor Buella [Thu, 10 May 2018 07:26:05 +0000 (07:26 +0000)]
[X86] ptwrite intrinsic

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper, RKSimon

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

llvm-svn: 331961

6 years agoAdjust to debug info metadata format change.
Tobias Grosser [Thu, 10 May 2018 07:09:10 +0000 (07:09 +0000)]
Adjust to debug info metadata format change.

Rename variable to retainedNodes. This unbreaks the Polly builds.

llvm-svn: 331960

6 years ago[X86] Change the implementation of scalar masked load/store intrinsics to not use...
Craig Topper [Thu, 10 May 2018 05:43:43 +0000 (05:43 +0000)]
[X86] Change the implementation of scalar masked load/store intrinsics to not use a 512-bit intermediate vector.

This is unnecessary for AVX512VL supporting CPUs like SKX. We can just emit a 128-bit masked load/store here no matter what. The backend will widen it to 512-bits on KNL CPUs.

Fixes the frontend portion of PR37386. Need to fix the backend to optimize the new sequences well.

llvm-svn: 331958

6 years ago[Itanium] Emit type info names with external linkage.
Eric Fiselier [Thu, 10 May 2018 05:25:15 +0000 (05:25 +0000)]
[Itanium] Emit type info names with external linkage.

Summary:
The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed.  Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos.
For example:

```
// header.h
struct T;
extern std::type_info const& Info;

// tu_one.cpp
#include "header.h"
std::type_info const& Info = typeid(T*);

// tu_two.cpp
#include "header.h"
struct T {};
int main() {
  auto &TI1 = Info;
  auto &TI2 = typeid(T*);
  assert(TI1 == TI2); // Fails
  assert(TI1.hash_code() == TI2.hash_code()); // Fails
}
```

This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type.

Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to:

(A) Always perform strcmp/string hashes.
(B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++.

Reviewers: rsmith, rjmccall, majnemer, vsapsai

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

llvm-svn: 331957

6 years ago[sanitizer] Fix typo in comment
Vitaly Buka [Thu, 10 May 2018 04:21:41 +0000 (04:21 +0000)]
[sanitizer] Fix typo in comment

llvm-svn: 331956

6 years ago[sanitizer] Renamed local variable
Vitaly Buka [Thu, 10 May 2018 04:16:44 +0000 (04:16 +0000)]
[sanitizer] Renamed local variable

llvm-svn: 331955

6 years ago[sanitizer] Fix compilation after invalid rebase
Vitaly Buka [Thu, 10 May 2018 04:10:09 +0000 (04:10 +0000)]
[sanitizer] Fix compilation after invalid rebase

llvm-svn: 331954

6 years ago[sanitizer] Don't miss threads by ThreadSuspender
Vitaly Buka [Thu, 10 May 2018 04:02:59 +0000 (04:02 +0000)]
[sanitizer] Don't miss threads by ThreadSuspender

Summary:
Enumerating /proc/<pid>/task/ dir Linux may stop if thread is dead. In this case
we miss some alive threads and can report false memory leaks.
To solve this issue we repeat enumeration if the last thread is dead.
Do detect dead threads same way as proc_task_readdir we use
/proc/<pid>/task/<tid>/status.

Similarly it also ends enumeration of if proc_fill_cache fails, but in this case
Linux sets inode to 1 (Bad block).

And just in case re-list threads if we had to call internal_getdents more than
twice or result takes more than half of the buffer.

Reviewers: eugenis, dvyukov, glider

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 331953

6 years agoFix tests added in r331924 so that they work on Windows.
Douglas Yung [Thu, 10 May 2018 03:06:42 +0000 (03:06 +0000)]
Fix tests added in r331924 so that they work on Windows.

The test needed to check for the optional executable extension (llvm-objcopy.EXE).

llvm-svn: 331952

6 years ago[libFuzzer] add a simple puzzle that is difficult for today's libFuzzer
Kostya Serebryany [Thu, 10 May 2018 02:02:41 +0000 (02:02 +0000)]
[libFuzzer] add a simple puzzle that is difficult for today's libFuzzer

llvm-svn: 331951

6 years ago[SCEV] Add missed Test for rL331949.
Serguei Katkov [Thu, 10 May 2018 01:42:59 +0000 (01:42 +0000)]
[SCEV] Add missed Test for rL331949.

llvm-svn: 331950

6 years agoSCEV] Do not use induction in isKnownPredicate for simplification umax.
Serguei Katkov [Thu, 10 May 2018 01:40:43 +0000 (01:40 +0000)]
SCEV] Do not use induction in isKnownPredicate for simplification umax.

During simplification umax we trigger isKnownPredicate twice. As a first attempt it
tries the induction. To do that it tries to get post increment of SCEV.
Re-writing the SCEV may result in simplification of umax. If the SCEV contains a lot
of umax operations this recursion becomes very slow.

The added test demonstrates the slow behavior.

To resolve this we use only simple ways to check whether the predicate is known.

Reviewers: sanjoy, mkazantsev
Reviewed By: sanjoy
Subscribers: lebedev.ri, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46046

llvm-svn: 331949

6 years ago[InstCombine] Reorder an if condition to put a cheap check in front of a computeKnown...
Craig Topper [Thu, 10 May 2018 00:53:25 +0000 (00:53 +0000)]
[InstCombine] Reorder an if condition to put a cheap check in front of a computeKnownBits call. NFC

llvm-svn: 331948

6 years ago[InstCombine] Use APInt::getBitsSetFrom to shortern a line and fix an 80 columns...
Craig Topper [Thu, 10 May 2018 00:53:22 +0000 (00:53 +0000)]
[InstCombine] Use APInt::getBitsSetFrom to shortern a line and fix an 80 columns violation. NFC

Fix a similar line in the same function.

llvm-svn: 331947

6 years ago[LIT] Add the missing file
Chris Matthews [Thu, 10 May 2018 00:08:39 +0000 (00:08 +0000)]
[LIT] Add the missing file

I forgot to commit this file.

llvm-svn: 331946

6 years agoRefactor test incase results are backwards
Chris Matthews [Thu, 10 May 2018 00:06:17 +0000 (00:06 +0000)]
Refactor test incase results are backwards

Looks like results can come in either way in this file.  Loosen the ordering constraints.

llvm-svn: 331945

6 years ago[Inscombine] fix a signedness warning which broke -Werror builds
Philip Reames [Thu, 10 May 2018 00:05:29 +0000 (00:05 +0000)]
[Inscombine] fix a signedness warning which broke -Werror builds

llvm-svn: 331944

6 years ago[Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to match...
Craig Topper [Thu, 10 May 2018 00:05:13 +0000 (00:05 +0000)]
[Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to match what the middle and backends understand

Previously we emitted something like

rotl(x, n) {
  n &= bitwidth-1;
  return n != 0 ? ((x << n) | (x >> (bitwidth - n)) : x;
}

We use a select to avoid the undefined behavior on the (bitwidth - n) shift.

The middle and backend don't really recognize this as a rotate and end up emitting a cmov or control flow because of the select.

A better pattern is (x << (n & mask)) | (x << (-n & mask)) where mask is bitwidth - 1.

Fixes the main complaint in PR37387. There's still some work to be done if the user writes that sequence directly on a short or char where type promotion rules can prevent it from being recognized. The builtin is emitting direct IR with unpromoted types so that isn't a problem for it.

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

llvm-svn: 331943

6 years ago[LIT] Handle xml characters in test names
Chris Matthews [Wed, 9 May 2018 23:48:32 +0000 (23:48 +0000)]
[LIT] Handle xml characters in test names

Lit creates malformed xml when the test case has an & in the name.

Escape those correctly.

This also adds a test case which I will add other nasty encoding issues to in some followup commits.

llvm-svn: 331942

6 years ago[NVPTX] Added a feature to use short pointers for const/local/shared AS.
Artem Belevich [Wed, 9 May 2018 23:46:19 +0000 (23:46 +0000)]
[NVPTX] Added a feature to use short pointers for const/local/shared AS.

Const/local/shared address spaces are all < 4GB and we can always use
32-bit pointers to access them. This has substantial performance impact
on kernels that uses shared memory for intermediary results.

The feature is disabled by default.

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

llvm-svn: 331941

6 years ago[sanitizer] Use all available rounded up capacity
Vitaly Buka [Wed, 9 May 2018 23:31:05 +0000 (23:31 +0000)]
[sanitizer] Use all available rounded up capacity

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 331940

6 years ago[PhaseOrdering] remove stale comments; NFC
Sanjay Patel [Wed, 9 May 2018 23:10:46 +0000 (23:10 +0000)]
[PhaseOrdering] remove stale comments; NFC

Forgot to update this with rL331937.

llvm-svn: 331939

6 years ago[CUDA] Added -f[no-]cuda-short-ptr option
Artem Belevich [Wed, 9 May 2018 23:10:09 +0000 (23:10 +0000)]
[CUDA] Added -f[no-]cuda-short-ptr option

The option enables use of 32-bit pointers for accessing
const/local/shared memory. The feature is disabled by default.

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

llvm-svn: 331938

6 years ago[AggressiveInstCombine] convert a chain of 'and-shift' bits into masked compare
Sanjay Patel [Wed, 9 May 2018 23:08:15 +0000 (23:08 +0000)]
[AggressiveInstCombine] convert a chain of 'and-shift' bits into masked compare

This is a follow-up to D45986. As suggested there, we should match the "all-bits-set"
pattern in addition to "any-bits-set".

This was a little more complicated than I thought it would be initially because the
"and 1" instruction can be anywhere in the chain. Hopefully, the code comments make
that logic understandable, but if you see a way to simplify or improve that, it's
most appreciated.

This transforms patterns that emerge from bitfield tests as seen in PR37098:
https://bugs.llvm.org/show_bug.cgi?id=37098

I think it would also help reduce the large test from:
D46336
D46595
but we need something to reassociate that case to the forms we're expecting here first.

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

llvm-svn: 331937

6 years ago[lsan] Report unsuspended threads
Vitaly Buka [Wed, 9 May 2018 23:02:14 +0000 (23:02 +0000)]
[lsan] Report unsuspended threads

Summary:
Leak checker needs to suspend all process threads. If we have some running
thread in registry but not suspended we can have false leak report. So we will
report this case here for future debugging.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 331936

6 years ago[InstCombine] Widen guards with conditions between
Philip Reames [Wed, 9 May 2018 22:56:32 +0000 (22:56 +0000)]
[InstCombine] Widen guards with conditions between

The previous handling for guard widening in InstCombine was extremely restrictive. In particular, it didn't handle the common case where we had two guards separated by a single icmp. Handle this by scanning through a small fixed window of instructions to find the next guard if needed.

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

llvm-svn: 331935

6 years agoRevert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"
Julie Hockett [Wed, 9 May 2018 22:28:18 +0000 (22:28 +0000)]
Revert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"

This reverts commit r331930, which was landed by accident.

llvm-svn: 331934

6 years ago[InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits...
Benjamin Kramer [Wed, 9 May 2018 22:27:34 +0000 (22:27 +0000)]
[InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits that are zero in the divisor

This is safe as long as the udiv is not exact. The pattern is not common in
C++ code, but comes up all the time in code generated by XLA's GPU backend.

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

llvm-svn: 331933

6 years agoRevert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"
Julie Hockett [Wed, 9 May 2018 22:25:47 +0000 (22:25 +0000)]
Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"

This reverts commit r331904 because of a memory leak.

llvm-svn: 331932

6 years agoRevert "[tools] Updating PPCallbacks::InclusionDirective calls"
Julie Hockett [Wed, 9 May 2018 22:25:43 +0000 (22:25 +0000)]
Revert "[tools] Updating PPCallbacks::InclusionDirective calls"

This reverts commit r331905, since it's dependent on reverted r331905.

llvm-svn: 331931

6 years ago[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module
Julie Hockett [Wed, 9 May 2018 22:25:42 +0000 (22:25 +0000)]
[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module

Adding a check to restrict system includes to a whitelist. Given a list
of includes that are explicitly allowed, the check issues a fixit to
remove any system include not on that list from the source file.

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

llvm-svn: 331930

6 years ago[ARM] Add support for SETCCCARRY instead of SETCCE
Amaury Sechet [Wed, 9 May 2018 22:15:51 +0000 (22:15 +0000)]
[ARM] Add support for SETCCCARRY instead of SETCCE

Summary: As per title. SETCCE is deprecated and will eventually be removed.

Reviewers: rogfer01, efriedma, rengolin, javed.absar

Subscribers: kristof.beyls, chrib, llvm-commits

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

llvm-svn: 331929

6 years agoUpdate pragma-attribute-supported-attributes-list.test.
Manoj Gupta [Wed, 9 May 2018 22:05:53 +0000 (22:05 +0000)]
Update pragma-attribute-supported-attributes-list.test.

Update the test to include the new attribute NoStackProtector
to fix the build fails.

llvm-svn: 331928

6 years ago[sanitizer] Fix argument type and remove unneeded vector resize
Vitaly Buka [Wed, 9 May 2018 22:03:52 +0000 (22:03 +0000)]
[sanitizer] Fix argument type and remove unneeded vector resize

llvm-svn: 331927

6 years ago[GlobalISel][Legalizer] Widening the second src op of shifts bug fix
Roman Tereshin [Wed, 9 May 2018 21:43:30 +0000 (21:43 +0000)]
[GlobalISel][Legalizer] Widening the second src op of shifts bug fix

The second source operand of G_SHL, G_ASHR, and G_LSHR must preserve its
value as a (small) unsigned integer, therefore its incorrect to widen it
in any way but by zero extending it.

G_SHL was using G_ANYEXT and G_ASHR - G_SEXT (which is correct for their
destination and first source operands, but not the "number of bits to
shift" operand).

Generally, shifts aren't as similar to regular binary operations as it
might seem, for instance, they aren't commutative nor associative and
the second source operand usually requires a special treatment.

Reviewers: bogner, javed.absar, aivchenk, rovka

Reviewed By: bogner

Subscribers: igorb, kristof.beyls, llvm-commits

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

llvm-svn: 331926

6 years ago[Clang] Implement function attribute no_stack_protector.
Manoj Gupta [Wed, 9 May 2018 21:41:18 +0000 (21:41 +0000)]
[Clang] Implement function attribute no_stack_protector.

Summary:
This attribute tells clang to skip this function from stack protector
when -stack-protector option is passed.
GCC option for this is:
__attribute__((__optimize__("no-stack-protector"))) and the
equivalent clang syntax would be: __attribute__((no_stack_protector))

This is used in Linux kernel to selectively disable stack protector
in certain functions.

Reviewers: aaron.ballman, rsmith, rnk, probinson

Reviewed By: aaron.ballman

Subscribers: probinson, srhines, cfe-commits

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

llvm-svn: 331925

6 years ago[llvm-objcopy] Add --strip-symbol (-N) option
Paul Semel [Wed, 9 May 2018 21:36:54 +0000 (21:36 +0000)]
[llvm-objcopy] Add --strip-symbol (-N) option

llvm-svn: 331924

6 years agoAdd SourceManagerForFile helper which sets up SourceManager and dependencies for...
Eric Liu [Wed, 9 May 2018 21:35:52 +0000 (21:35 +0000)]
Add SourceManagerForFile helper which sets up SourceManager and dependencies for a single file with code snippet

Summary: This can be used to create a virtual environment (incl. VFS, source manager) for code snippets.

Reviewers: sammccall, klimek

Reviewed By: sammccall

Subscribers: klimek, mgorny, cfe-commits

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

llvm-svn: 331923

6 years ago[CMake] Build shared version of runtimes for Fuchsia
Petr Hosek [Wed, 9 May 2018 21:24:06 +0000 (21:24 +0000)]
[CMake] Build shared version of runtimes for Fuchsia

Fuchsia is no longer treated as UNIX which means we need to explicitly
enable building of shared versions of runtimes.

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

llvm-svn: 331922

6 years ago[sanitizer] Use tid_t in ThreadLister
Vitaly Buka [Wed, 9 May 2018 21:21:26 +0000 (21:21 +0000)]
[sanitizer] Use tid_t in ThreadLister

llvm-svn: 331921

6 years ago[AMDGPU] Support horizontal vectorization of min/max.
Farhana Aleen [Wed, 9 May 2018 21:18:34 +0000 (21:18 +0000)]
[AMDGPU] Support horizontal vectorization of min/max.

Author: FarhanaAleen

Reviewed By: rampitec

Subscribers: AMDGPU

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

llvm-svn: 331920

6 years agoAMDGPU: Ignore any_extend in mul24 combine
Matt Arsenault [Wed, 9 May 2018 21:11:35 +0000 (21:11 +0000)]
AMDGPU: Ignore any_extend in mul24 combine

If a multiply is truncated, SimplifyDemandedBits
sometimes turns a zero_extend of the inputs into an
any_extend, which makes the known bits computation unhelpful.
Ignore these and compute known bits for the underlying value,
since we insert the correct extend type after.

llvm-svn: 331919

6 years ago[Hexagon] Add patterns for vector shift-and-accumulate
Krzysztof Parzyszek [Wed, 9 May 2018 21:10:41 +0000 (21:10 +0000)]
[Hexagon] Add patterns for vector shift-and-accumulate

llvm-svn: 331918

6 years agoAMDGPU: Handle partial shift reduction for variable shifts
Matt Arsenault [Wed, 9 May 2018 20:52:54 +0000 (20:52 +0000)]
AMDGPU: Handle partial shift reduction for variable shifts

If the variable shift amount has known bits, we can still reduce
the shift.

llvm-svn: 331917

6 years agoAMDGPU: Partially shrink 64-bit shifts if reduced to 16-bit
Matt Arsenault [Wed, 9 May 2018 20:52:43 +0000 (20:52 +0000)]
AMDGPU: Partially shrink 64-bit shifts if reduced to 16-bit

This is an extension of an existing combine to reduce wider
shls if the result fits in the final result type. This
introduces the same combine, but reduces the shift to a middle
sized type to avoid the slow 64-bit shift.

llvm-svn: 331916

6 years ago[sanitizer] Cleanup sorting functions
Vitaly Buka [Wed, 9 May 2018 20:42:11 +0000 (20:42 +0000)]
[sanitizer] Cleanup sorting functions

llvm-svn: 331915

6 years ago[cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple...
Stella Stamenova [Wed, 9 May 2018 19:58:51 +0000 (19:58 +0000)]
[cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple configurations

Summary: The current setup for the unit tests only works correctly when the generator does not support multiple configurations. When the generator supports multiple configurations, the inputs are not copied to the correct per-configuration directory. This change sets up the build to copy the inputs in each configuration directory.

Reviewers: labath, asmith, zturner

Reviewed By: labath

Subscribers: mgorny, llvm-commits

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

llvm-svn: 331914

6 years ago[X86] Fix Broadwell's Shuffle256 schedule classes load latency values.
Simon Pilgrim [Wed, 9 May 2018 19:27:48 +0000 (19:27 +0000)]
[X86] Fix Broadwell's Shuffle256 schedule classes load latency values.

Allows us to remove some unnecessary InstRW overrides.

llvm-svn: 331913

6 years ago[COFF] Fix dangling StringRefs from SVN 331900
Martin Storsjo [Wed, 9 May 2018 19:07:10 +0000 (19:07 +0000)]
[COFF] Fix dangling StringRefs from SVN 331900

llvm-svn: 331912

6 years ago[X86] Merge instregex patterns to reduce InstrRW compile time.
Simon Pilgrim [Wed, 9 May 2018 19:04:15 +0000 (19:04 +0000)]
[X86] Merge instregex patterns to reduce InstrRW compile time.

llvm-svn: 331911

6 years agoAllow copy elision in path concatenation
David Bolvansky [Wed, 9 May 2018 18:57:17 +0000 (18:57 +0000)]
Allow copy elision in path concatenation

Summary:
Just port of libstdc++'s fix to libc++ fs: https://github.com/gcc-mirror/gcc/commit/e6ac4004fe49d785c63bf87aec4b095b5ce1d19f

Author of fix: Jonathan Wakely

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: smeenai, christof, cfe-commits, llvm-commits

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

llvm-svn: 331910

6 years agoAMDGPU: Add combine for trunc of bitcast from build_vector
Matt Arsenault [Wed, 9 May 2018 18:37:39 +0000 (18:37 +0000)]
AMDGPU: Add combine for trunc of bitcast from build_vector

If the truncate is only accessing the first element of the vector,
we can use the original source value.

This helps with some combine ordering issues after operations are
lowered to integer operations between bitcasts of build_vector.
In particular it stops unnecessarily materializing the unused
top half of a vector in some cases.

llvm-svn: 331909

6 years ago[dfsan] add one more sanitizer-coverage hook to the whitelist
Kostya Serebryany [Wed, 9 May 2018 18:35:09 +0000 (18:35 +0000)]
[dfsan] add one more sanitizer-coverage hook to the whitelist

llvm-svn: 331908

6 years ago[Hexagon] Check the end of the correct container (fix typo)
Krzysztof Parzyszek [Wed, 9 May 2018 18:33:59 +0000 (18:33 +0000)]
[Hexagon] Check the end of the correct container (fix typo)

llvm-svn: 331907

6 years agoAMDGPU: Stop special casing constant indexes of extract_vector_elt
Matt Arsenault [Wed, 9 May 2018 18:29:26 +0000 (18:29 +0000)]
AMDGPU: Stop special casing constant indexes of extract_vector_elt

The same result folds out of the dynamic expansion logic if the
index is constant.

llvm-svn: 331906

6 years ago[tools] Updating PPCallbacks::InclusionDirective calls
Julie Hockett [Wed, 9 May 2018 18:27:37 +0000 (18:27 +0000)]
[tools] Updating PPCallbacks::InclusionDirective calls

[revision] added SrcMgr::CharacteristicKind to the InclusionDirective
callback, this revision updates instances of it in clang-tools-extra.

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

llvm-svn: 331905

6 years ago[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective
Julie Hockett [Wed, 9 May 2018 18:27:33 +0000 (18:27 +0000)]
[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective

Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are system
headers.

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

llvm-svn: 331904