platform/upstream/llvm.git
5 years ago[Clang][PowerPC] Support constraint 'wi' in asm
Li Jia He [Thu, 1 Nov 2018 02:32:49 +0000 (02:32 +0000)]
[Clang][PowerPC] Support constraint 'wi' in asm
  From the gcc manual, we can see that the specific limit of wi inline asm is “FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS”. The link is https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Machine-Constraints.html#Machine-Constraints. We should accept this constraint.

Reviewed By: jsji

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

llvm-svn: 345809

5 years ago[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic
Mandeep Singh Grang [Thu, 1 Nov 2018 01:35:34 +0000 (01:35 +0000)]
[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic

llvm-svn: 345808

5 years ago[analyzer] SARIF: Suppress version testing in a more downstream-friendly manner.
Artem Dergachev [Thu, 1 Nov 2018 01:27:01 +0000 (01:27 +0000)]
[analyzer] SARIF: Suppress version testing in a more downstream-friendly manner.

No functional change intended.

llvm-svn: 345807

5 years ago[WebAssembly] Remove duplicate function. NFC.
Sam Clegg [Thu, 1 Nov 2018 01:08:37 +0000 (01:08 +0000)]
[WebAssembly] Remove duplicate function. NFC.

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

llvm-svn: 345806

5 years agoFix typo in comment.
Richard Smith [Thu, 1 Nov 2018 01:05:00 +0000 (01:05 +0000)]
Fix typo in comment.

llvm-svn: 345805

5 years ago[WebAssembly] Fix type names in truncation builtins
Thomas Lively [Thu, 1 Nov 2018 01:03:17 +0000 (01:03 +0000)]
[WebAssembly] Fix type names in truncation builtins

Summary: Use the same convention as all the other WebAssembly builtin names.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

llvm-svn: 345804

5 years agoFix regression in behavior of clang -x c++-header -fmodule-name=XXX
Richard Smith [Thu, 1 Nov 2018 00:46:54 +0000 (00:46 +0000)]
Fix regression in behavior of clang -x c++-header -fmodule-name=XXX
-fsyntax-only.

The driver accidentally stopped passing the input filenames on to -cc1
in this mode due to confusion over what action was being requested.

This change also fixes a couple of crashes I encountered when passing
multiple files to such a -cc1 invocation.

llvm-svn: 345803

5 years ago[analyzer] pr39348: MallocChecker: Realize that sized delete isn't custom delete.
Artem Dergachev [Thu, 1 Nov 2018 00:43:35 +0000 (00:43 +0000)]
[analyzer] pr39348: MallocChecker: Realize that sized delete isn't custom delete.

MallocChecker no longer thinks that operator delete() that accepts the size of
the object to delete (available since C++14 or under -fsized-deallocation)
is some weird user-defined operator. Instead, it handles it like normal delete.

Additionally, it exposes a regression in NewDelete-intersections.mm's
testStandardPlacementNewAfterDelete() test, where the diagnostic is delayed
from before the call of placement new into the code of placement new
in the header. This happens because the check for pass-into-function-after-free
for placement arguments is located in checkNewAllocator(), which happens after
the allocator is inlined, which is too late. Move this use-after-free check
into checkPreCall instead, where it works automagically because the guard
that prevents it from working is useless and can be removed as well.

This commit causes regressions under -analyzer-config
c++-allocator-inlining=false but this option is essentially unsupported
because the respective feature has been enabled by default quite a while ago.

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

llvm-svn: 345802

5 years agoX86: Consistently declare pass initializers in X86.h; NFC
Matthias Braun [Thu, 1 Nov 2018 00:38:01 +0000 (00:38 +0000)]
X86: Consistently declare pass initializers in X86.h; NFC

This avoids declaring them twice: in X86TargetMachine.cpp and the file
implementing the pass.

llvm-svn: 345801

5 years ago[FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.
Jonas Devlieghere [Thu, 1 Nov 2018 00:33:27 +0000 (00:33 +0000)]
[FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.

This patch moves the EnumerateDirectory functionality and related enum
and typedef from FileSpec to FileSystem.

This is part of a set of patches that extracts file system related
convenience methods from FileSpec. The long term goal is to remove this
method altogether and use the iterators directly, but for introducing
the VFS into LLDB this change is sufficient.

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

llvm-svn: 345800

5 years ago[FileSystem] Re-add EnumerateDirectory
Jonas Devlieghere [Thu, 1 Nov 2018 00:26:09 +0000 (00:26 +0000)]
[FileSystem] Re-add EnumerateDirectory

Re-enable EnumerateDirectory now that no_push is available in llvm (r345793).

llvm-svn: 345799

5 years ago[XRay] Add CPU ID in Custom Event FDR Records
Dean Michael Berris [Thu, 1 Nov 2018 00:18:52 +0000 (00:18 +0000)]
[XRay] Add CPU ID in Custom Event FDR Records

Summary:
This change cuts across compiler-rt and llvm, to increment the FDR log
version number to 4, and include the CPU ID in the custom event records.

This is a step towards allowing us to change the `llvm::xray::Trace`
object to start representing both custom and typed events in the stream
of records. Follow-on changes will allow us to change the kinds of
records we're presenting in the stream of traces, to incorporate the
data in custom/typed events.

A follow-on change will handle the typed event case, where it may not
fit within the 15-byte buffer for metadata records.

This work is part of the larger effort to enable writing analysis and
processing tools using a common in-memory representation of the events
found in traces. The work will focus on porting existing tools in LLVM
to use the common representation and informing the design of a
library/framework for expressing trace event analysis as C++ programs.

Reviewers: mboerger, eizan

Subscribers: hiraditya, mgrang, llvm-commits

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

llvm-svn: 345798

5 years ago[WebAssembly] Lower vselect
Thomas Lively [Thu, 1 Nov 2018 00:01:02 +0000 (00:01 +0000)]
[WebAssembly] Lower vselect

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 345797

5 years agoCompile and test i128 math builtins for Win64
Reid Kleckner [Thu, 1 Nov 2018 00:00:03 +0000 (00:00 +0000)]
Compile and test i128 math builtins for Win64

Summary:
Windows has always been LLP64, not LP64, so the macros were incorrect.
Check for _WIN64, since AArch64 sets that too.

The tests have to be fixed up in two main ways:
1. Use 'ULL' suffixes to avoid sign extension when passing hex literals
   with the sign bit set to signed 128 arguments. Clang
   -fms-compatibility makes such hex literals signed, not unsigned.
2. Disable various tests for 80-bit long double interoperation with i128
   values.

Reviewers: joerg, mstorsjo

Subscribers: javed.absar, kristof.beyls, hiraditya, aheejin, llvm-commits

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

llvm-svn: 345796

5 years ago[WebAssembly] Process p2align operands for SIMD loads and stores
Thomas Lively [Wed, 31 Oct 2018 23:58:20 +0000 (23:58 +0000)]
[WebAssembly] Process p2align operands for SIMD loads and stores

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 345795

5 years ago[WebAssembly] Handle vector IMPLICIT_DEFs.
Thomas Lively [Wed, 31 Oct 2018 23:50:53 +0000 (23:50 +0000)]
[WebAssembly] Handle vector IMPLICIT_DEFs.

Summary:
Also reduce the test case for implicit defs and test it with all
register classes.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 345794

5 years ago[VFS] Add support for "no_push" to VFS recursive iterators.
Jonas Devlieghere [Wed, 31 Oct 2018 23:36:10 +0000 (23:36 +0000)]
[VFS] Add support for "no_push" to VFS recursive iterators.

The "regular" file system has a useful feature that makes it possible to
stop recursing when using the recursive directory iterators. This
functionality was missing for the VFS recursive iterator and this patch
adds that.

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

llvm-svn: 345793

5 years ago[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
Mandeep Singh Grang [Wed, 31 Oct 2018 23:17:36 +0000 (23:17 +0000)]
[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry

Summary: ARM64 setjmp expects sp on entry instead of framepointer.

Reviewers: mgrang, rnk, TomTan, compnerd, mstorsjo, efriedma

Reviewed By: mstorsjo

Subscribers: javed.absar, kristof.beyls, chrib, cfe-commits

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

llvm-svn: 345792

5 years ago[COFF, ARM64] Implement Intrinsic.sponentry for AArch64
Mandeep Singh Grang [Wed, 31 Oct 2018 23:16:20 +0000 (23:16 +0000)]
[COFF, ARM64] Implement Intrinsic.sponentry for AArch64

Summary: This patch adds Intrinsic.sponentry. This intrinsic is required to correctly support setjmp for AArch64 Windows platform.

Reviewers: mgrang, TomTan, rnk, compnerd, mstorsjo, efriedma

Reviewed By: efriedma

Subscribers: majnemer, chrib, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 345791

5 years ago[IR] Allow increasing the alignment of dso-local globals.
Eli Friedman [Wed, 31 Oct 2018 23:03:58 +0000 (23:03 +0000)]
[IR] Allow increasing the alignment of dso-local globals.

I think this is the actual important property; the previous visibility
check was an approximation.

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

llvm-svn: 345790

5 years ago[InlineCost] Remove a dead constant; NFC
George Burgess IV [Wed, 31 Oct 2018 22:45:31 +0000 (22:45 +0000)]
[InlineCost] Remove a dead constant; NFC

My `grep`-fu indicates that this hasn't been used for years. It also no
longer makes much sense to have this flavor of penalty in general, since
a call to a noreturn should mean that we're in a BB that's terminated by
`unreachable`. That case is accounted for by
CallAnalyzer::allowSizeGrowth.

llvm-svn: 345789

5 years ago[compiler-rt] Pass CMake C and C++ flags to the custom libc++
Petr Hosek [Wed, 31 Oct 2018 22:40:25 +0000 (22:40 +0000)]
[compiler-rt] Pass CMake C and C++ flags to the custom libc++

When building the custom libc++ that's used by libFuzzer as well as
MSan and TSan tests, passthrough the C and C++ flags that were passed
to the compiler-rt CMake build. These may be needed to successfuly
compile the library on a particular platform.

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

llvm-svn: 345788

5 years ago[FileSystem] Remove EnumerateDirectory
Jonas Devlieghere [Wed, 31 Oct 2018 22:09:58 +0000 (22:09 +0000)]
[FileSystem] Remove EnumerateDirectory

The new implementation of EnumerateDirectory relies on `::no_push()`
being implemented for the VFS recursive directory iterators. However
this patch (D53465) hasn't been landed yet.

llvm-svn: 345787

5 years ago[AArch64] Sort switch cases (NFC)
Evandro Menezes [Wed, 31 Oct 2018 21:56:49 +0000 (21:56 +0000)]
[AArch64] Sort switch cases (NFC)

llvm-svn: 345786

5 years agoRevert r345165 "[X86] Bring back the MOV64r0 pseudo instruction"
Craig Topper [Wed, 31 Oct 2018 21:53:24 +0000 (21:53 +0000)]
Revert r345165 "[X86] Bring back the MOV64r0 pseudo instruction"

Google is reporting regressions on some benchmarks.

llvm-svn: 345785

5 years agoRevert "[ASTImporter][Structural Eq] Check for isBeingDefined"
Shafik Yaghmour [Wed, 31 Oct 2018 21:53:15 +0000 (21:53 +0000)]
Revert "[ASTImporter][Structural Eq] Check for isBeingDefined"

This reverts commit r345760

because it caused an assertion in the lldb test suite. This is the log from the build bot: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12003/

llvm-svn: 345784

5 years ago[FileSystem] Extend file system and have it use the VFS.
Jonas Devlieghere [Wed, 31 Oct 2018 21:49:27 +0000 (21:49 +0000)]
[FileSystem] Extend file system and have it use the VFS.

This patch extends the FileSystem class with a bunch of functions that
are currently implemented as methods of the FileSpec class. These
methods will be removed in future commits and replaced by calls to the
file system.

The new functions are operated in terms of the virtual file system which
was recently moved from clang into LLVM so it could be reused in lldb.
Because the VFS is stateful, we turned the FileSystem class into a
singleton.

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

llvm-svn: 345783

5 years ago[ARM] Add missing pseudo-instruction for Thumb1 RSBS.
Eli Friedman [Wed, 31 Oct 2018 21:45:48 +0000 (21:45 +0000)]
[ARM] Add missing pseudo-instruction for Thumb1 RSBS.

Shows up rarely for 64-bit arithmetic, more frequently for the compare
patterns added in r325323.

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

llvm-svn: 345782

5 years ago[AArch64] [Windows] Emit unwind tables by default.
Eli Friedman [Wed, 31 Oct 2018 21:39:41 +0000 (21:39 +0000)]
[AArch64] [Windows] Emit unwind tables by default.

Unwind tables are necessary even in code that doesn't support
exceptions.  The tables are used for setjmp(), and by debuggers.

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

llvm-svn: 345781

5 years agorevert rL345717 : [InstSimplify] fold icmp based on range of abs/nabs
Sanjay Patel [Wed, 31 Oct 2018 21:37:40 +0000 (21:37 +0000)]
revert rL345717 : [InstSimplify] fold icmp based on range of abs/nabs

This can miscompile as shown in PR39510:
https://bugs.llvm.org/show_bug.cgi?id=39510

llvm-svn: 345780

5 years ago[ARM64] [Windows] Implement _InterlockedExchangeAdd*_* builtins.
Eli Friedman [Wed, 31 Oct 2018 21:31:09 +0000 (21:31 +0000)]
[ARM64] [Windows] Implement _InterlockedExchangeAdd*_* builtins.

These apparently need to be proper builtins to handle the Windows
SDK.

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

llvm-svn: 345779

5 years agoCheck shouldReduceLoadWidth from SimplifySetCC
Stanislav Mekhanoshin [Wed, 31 Oct 2018 21:24:30 +0000 (21:24 +0000)]
Check shouldReduceLoadWidth from SimplifySetCC

SimplifySetCC could shrink a load without checking for
profitability or legality of such shink with a target.

Added checks to prevent shrinking of aligned scalar loads
in AMDGPU below dword as scalar engine does not support it.

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

llvm-svn: 345778

5 years ago[ValueTracking] add tests for fmin/fmax; NFC
Sanjay Patel [Wed, 31 Oct 2018 21:11:59 +0000 (21:11 +0000)]
[ValueTracking] add tests for fmin/fmax; NFC

llvm-svn: 345777

5 years ago[DWARF][NFC] Refactor a function to return Optional<> instead of bool
Wolfgang Pieb [Wed, 31 Oct 2018 21:05:51 +0000 (21:05 +0000)]
[DWARF][NFC] Refactor a function to return Optional<> instead of bool

Minor refactor of DWARFUnit::getStringOffsetSectionItem().

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

llvm-svn: 345776

5 years ago[ELF] Refactor per-target TLS layout configuration. NFC.
Ryan Prichard [Wed, 31 Oct 2018 20:53:17 +0000 (20:53 +0000)]
[ELF] Refactor per-target TLS layout configuration. NFC.

Summary:
There are really three different kinds of TLS layouts:

 * A fixed TLS-to-TP offset. On architectures like PowerPC, MIPS, and
   RISC-V, the thread pointer points to a fixed offset from the start
   of the executable's TLS segment. The offset is 0x7000 for PowerPC
   and MIPS, which allows a signed 16-bit offset to reach 0x1000 of
   per-thread implementation data and 0xf000 of the application's TLS
   segment. The size and layout of the TCB isn't relevant to the static
   linker and might not be known.

 * A fixed TCB size. This is the format documented as "variant 1" in
   Ulrich Drepper's TLS spec. The thread pointer points to a 2-word TCB
   followed by the executable's TLS segment. The first word is always
   the DTV pointer. Used on ARM. The thread pointer must be aligned to
   the TLS segment's alignment, possibly creating alignment padding.

 * Variant 2. This format predates variant 1 and is also documented in
   Drepper's TLS spec. It allocates the executable's TLS segment before
   the thread pointer, apparently for backwards-compatibility. It's
   used on x86 and SPARC.

Factor out an lld::elf::getTlsTpOffset() function for use in a
follow-up patch for Android. The TcbSize/TlsTpOffset fields are only used
in getTlsTpOffset, so replace them with a switch on Config->EMachine.

Reviewers: espindola, ruiu, PkmX, jrtc27

Reviewed By: ruiu, PkmX, jrtc27

Subscribers: jyknight, emaste, sdardis, nemanjai, javed.absar, arichardson, kristof.beyls, kbarton, fedor.sergeev, atanasyan, PkmX, jsji, llvm-commits

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

llvm-svn: 345775

5 years agoPart of PR39508: Emit an @llvm.invariant.start after storing to
Richard Smith [Wed, 31 Oct 2018 20:39:26 +0000 (20:39 +0000)]
Part of PR39508: Emit an @llvm.invariant.start after storing to
__tls_guard.

__tls_guard can only ever transition from 0 to 1, and only once. This
permits LLVM to remove repeated checks for TLS initialization and
repeated initialization code in cases like:

  int g();
  thread_local int n = g();
  int a = n + n;

where we could not prove that __tls_guard was still 'true' when checking
it for the second reference to 'n' in the initializer of 'a'.

llvm-svn: 345774

5 years agoRemove unused internal template parameter.
Richard Smith [Wed, 31 Oct 2018 20:38:41 +0000 (20:38 +0000)]
Remove unused internal template parameter.

llvm-svn: 345773

5 years ago[adt] SparseBitVector::test() should be const
Daniel Sanders [Wed, 31 Oct 2018 20:05:32 +0000 (20:05 +0000)]
[adt] SparseBitVector::test() should be const

Summary:
Re-worked SparseBitVector's most-recently-used-word caching (CurrElementIter)
such that SparseBitVector::test() can be made const. This came up when
attempting to test individual bits in a SparseBitVector which was a member of a
const object.

The cached iterator has no bearing on the externally visible state, it's merely
a performance optimization. Therefore it has been made mutable and
FindLowerBound() has been split into a const and non-const function
(FindLowerBound/FindLowerBoundConst) for the const/non-const
interfaces.

Reviewers: rtereshin

Reviewed By: rtereshin

Subscribers: rtereshin, dexonsmith, kristina, llvm-commits

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

llvm-svn: 345772

5 years ago[InstCombine] add tests for fmin/fmax pattern matching failure; NFC
Sanjay Patel [Wed, 31 Oct 2018 20:03:27 +0000 (20:03 +0000)]
[InstCombine] add tests for fmin/fmax pattern matching failure; NFC

llvm-svn: 345771

5 years ago[SelectionDAG] Handle constant range [0,1) in lowerRangeToAssertZExt
Scott Linder [Wed, 31 Oct 2018 19:57:36 +0000 (19:57 +0000)]
[SelectionDAG] Handle constant range [0,1) in lowerRangeToAssertZExt

lowerRangeToAssertZExt currently relies on something like EarlyCSE having
eliminated the constant range [0,1). At -O0 this leads to an assert.

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

llvm-svn: 345770

5 years ago[globalisel] Add comments indicating the operand order
Daniel Sanders [Wed, 31 Oct 2018 19:49:37 +0000 (19:49 +0000)]
[globalisel] Add comments indicating the operand order

llvm-svn: 345769

5 years agoMakefile.rules: Don't use code signing on macOS; it isn't necessary.
Adrian Prantl [Wed, 31 Oct 2018 19:42:02 +0000 (19:42 +0000)]
Makefile.rules: Don't use code signing on macOS; it isn't necessary.

llvm-svn: 345768

5 years ago[WedAssembly] Add -s and -S alias for --strip-all and --strip-debug
Sam Clegg [Wed, 31 Oct 2018 19:30:43 +0000 (19:30 +0000)]
[WedAssembly] Add -s and -S alias for --strip-all and --strip-debug

llvm-svn: 345767

5 years agoRemoving a reliance on system headers from this test; NFC.
Aaron Ballman [Wed, 31 Oct 2018 19:17:44 +0000 (19:17 +0000)]
Removing a reliance on system headers from this test; NFC.

llvm-svn: 345766

5 years ago[compiler-rt][Fuzzer] Use the new C++ ABI namespace CMake support
Petr Hosek [Wed, 31 Oct 2018 19:15:48 +0000 (19:15 +0000)]
[compiler-rt][Fuzzer] Use the new C++ ABI namespace CMake support

libc++ now supports customizing the ABI namespace directly from the
CMake build so we no longer need to rely on custom CFLAGS.

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

llvm-svn: 345765

5 years agoImplement the readability-const-return-type check.
Aaron Ballman [Wed, 31 Oct 2018 19:11:38 +0000 (19:11 +0000)]
Implement the readability-const-return-type check.

This check flags function top-level const-qualified return types and suggests removing the mostly-superfluous const qualifier where possible.

Patch by Yitzhak Mandelbaum.

llvm-svn: 345764

5 years ago[AMDGPU] Remove FeatureVGPRSpilling
Scott Linder [Wed, 31 Oct 2018 18:54:06 +0000 (18:54 +0000)]
[AMDGPU] Remove FeatureVGPRSpilling

This feature is only relevant to shaders, and is no longer used. When disabled,
lowering of reserved registers for shaders causes a compiler crash.

Remove the feature and add a test for compilation of shaders at OptNone.

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

llvm-svn: 345763

5 years ago[NFC] Replace C++1y and C++1z by C++14 and C++17, respectively
Louis Dionne [Wed, 31 Oct 2018 18:53:31 +0000 (18:53 +0000)]
[NFC] Replace C++1y and C++1z by C++14 and C++17, respectively

llvm-svn: 345762

5 years ago[SelectionDAGISel] Suppress a -Wunused-but-set-variable warning in release builds...
Craig Topper [Wed, 31 Oct 2018 18:46:15 +0000 (18:46 +0000)]
[SelectionDAGISel] Suppress a -Wunused-but-set-variable warning in release builds. NFC

llvm-svn: 345761

5 years ago[ASTImporter][Structural Eq] Check for isBeingDefined
Gabor Marton [Wed, 31 Oct 2018 18:46:13 +0000 (18:46 +0000)]
[ASTImporter][Structural Eq] Check for isBeingDefined

Summary:
If one definition is currently being defined, we do not compare for
equality and we assume that the decls are equal.

Reviewers: a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

llvm-svn: 345760

5 years ago[NFC] Mark "Splicing Maps and Sets" as done in LLVM 8.0
Louis Dionne [Wed, 31 Oct 2018 18:33:11 +0000 (18:33 +0000)]
[NFC] Mark "Splicing Maps and Sets" as done in LLVM 8.0

llvm-svn: 345759

5 years agoFix comment typo. NFCI.
Simon Pilgrim [Wed, 31 Oct 2018 18:19:52 +0000 (18:19 +0000)]
Fix comment typo. NFCI.

llvm-svn: 345758

5 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Wed, 31 Oct 2018 18:17:51 +0000 (18:17 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 345757

5 years ago[SelectionDAG] SelectionDAGLegalize::ExpandBITREVERSE - ensure we use ShiftTy
Simon Pilgrim [Wed, 31 Oct 2018 18:14:14 +0000 (18:14 +0000)]
[SelectionDAG] SelectionDAGLegalize::ExpandBITREVERSE - ensure we use ShiftTy

We should be using the getShiftAmountTy value type for shift amounts.

llvm-svn: 345756

5 years ago[NFC] Fixed -Wsign-compare warning
David Bolvansky [Wed, 31 Oct 2018 18:03:36 +0000 (18:03 +0000)]
[NFC] Fixed -Wsign-compare warning

llvm-svn: 345755

5 years ago[globalisel][irtranslator] Fix test from r345743 on non-asserts builds.
Daniel Sanders [Wed, 31 Oct 2018 17:58:47 +0000 (17:58 +0000)]
[globalisel][irtranslator] Fix test from r345743 on non-asserts builds.

llvm-svn: 345754

5 years ago[clang-format] tweaked another case of lambda formatting
Krasimir Georgiev [Wed, 31 Oct 2018 17:56:57 +0000 (17:56 +0000)]
[clang-format] tweaked another case of lambda formatting

Summary:
This is done in order to improve cases where the lambda's body is moved too far to the right. Consider the following snippet with column limit set to 79:

```
void f() {
  leader::MakeThisCallHere(&leader_service_,
                           cq_.get(),
                           [this, liveness](const leader::ReadRecordReq& req,
                                            std::function<void()> done) {
                             logger_->HandleReadRecord(
                                 req, resp, std::move(done));
                           });

  leader::MakeAnother(&leader_service_,
                      cq_.get(),
                      [this, liveness](const leader::ReadRecordReq& req,
                                       std::function<void()> done) {
                        logger_->HandleReadRecord(
                            req, resp, std::move(done), a);
                      });
}
```

The tool favors extra indentation for the lambda body and so the code incurs extra wrapping and adjacent calls are indented to a different level. I find this behavior annoying and I'd like the tool to favor new lines and, thus, use the extra width.

The fix, reduced, brings the following formatting.

Before:

    function(1,
             [] {
               DoStuff();
               //
             },
             1);

After:

    function(
        1,
        [] {
          DoStuff();
          //
        },
        1);

Refer to the new tests in FormatTest.cpp

Contributed by oleg.smolsky!

Reviewers: djasper, klimek, krasimir

Subscribers: cfe-commits, owenpan

Tags: #clang

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

llvm-svn: 345753

5 years ago[InstCombine] add tests for fcmp with -0.0; NFC
Sanjay Patel [Wed, 31 Oct 2018 17:55:40 +0000 (17:55 +0000)]
[InstCombine] add tests for fcmp with -0.0; NFC

From IEEE754: "Comparisons shall ignore the sign of zero (so +0 = −0)."

llvm-svn: 345752

5 years ago[InstCombine] Combine nested min/max intrinsics with constants
Volkan Keles [Wed, 31 Oct 2018 17:50:52 +0000 (17:50 +0000)]
[InstCombine] Combine nested min/max intrinsics with constants

Reviewers: arsenm, spatel

Reviewed By: spatel

Subscribers: lebedev.ri, wdng, llvm-commits

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

llvm-svn: 345751

5 years ago[llvm-mca] Remove the verb 'assemble' from a few options in help. NFC.
Matt Davis [Wed, 31 Oct 2018 17:47:25 +0000 (17:47 +0000)]
[llvm-mca] Remove the verb 'assemble' from a few options in help. NFC.

* MCA does not assemble anything.
* Ran clang-format.

llvm-svn: 345750

5 years agoTableGen: Fix ASAN error
Nicolai Haehnle [Wed, 31 Oct 2018 17:46:21 +0000 (17:46 +0000)]
TableGen: Fix ASAN error

Summary:
As a bonus, this arguably improves the code by making it simpler.

gcc 8 on Ubuntu 18.10 reports the following:

==39667==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffffff8ae0 at pc 0x555555dbfc68 bp 0x7fffffff8760 sp 0x7fffffff8750
WRITE of size 8 at 0x7fffffff8ae0 thread T0
    #0 0x555555dbfc67 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::_Alloc_hider(char*, std::allocator<char>&&) /usr/include/c++/8/bits/basic_string.h:149
    #1 0x555555dbfc67 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /usr/include/c++/8/bits/basic_string.h:542
    #2 0x555555dbfc67 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /usr/include/c++/8/bits/basic_string.h:6009
    #3 0x555555dbfc67 in searchableFieldType /home/nha/amd/build/san/llvm-src/utils/TableGen/SearchableTableEmitter.cpp:168
    (...)

Address 0x7fffffff8ae0 is located in stack of thread T0 at offset 864 in frame
    #0 0x555555dbef3f in searchableFieldType /home/nha/amd/build/san/llvm-src/utils/TableGen/SearchableTableEmitter.cpp:148

Reviewers: fhahn, simon_tatham, kparzysz

Subscribers: llvm-commits

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

llvm-svn: 345749

5 years agoRe-land r345676 "[Win64] Handle passing i128 by value"
Reid Kleckner [Wed, 31 Oct 2018 17:43:55 +0000 (17:43 +0000)]
Re-land r345676 "[Win64] Handle passing i128 by value"

Fix the unintended switch/case fallthrough to avoid changing long double
behavior.

llvm-svn: 345748

5 years ago[analyzer] Re-add custom OSIterator rule for RetainCountChecker
George Karpenkov [Wed, 31 Oct 2018 17:38:46 +0000 (17:38 +0000)]
[analyzer] Re-add custom OSIterator rule for RetainCountChecker

Turns out the rule is quite ubiquitous.

Revert of https://reviews.llvm.org/D53628

llvm-svn: 345747

5 years ago[analyzer] RetainCountChecker: for now, do not trust the summaries of inlined code
George Karpenkov [Wed, 31 Oct 2018 17:38:29 +0000 (17:38 +0000)]
[analyzer] RetainCountChecker: for now, do not trust the summaries of inlined code

Trusting summaries of inlined code would require a more thorough work,
as the current approach was causing too many false positives, as the new
example in test.  The culprit lies in the fact that we currently escape
all variables written into a field (but not passed off to unknown
functions!), which can result in inconsistent behavior.

rdar://45655344

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

llvm-svn: 345746

5 years ago[analyzer] Enable retain count checking for OSObject by defa
George Karpenkov [Wed, 31 Oct 2018 17:38:12 +0000 (17:38 +0000)]
[analyzer] Enable retain count checking for OSObject by defa

The FP rate seems to be good enough now.

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

llvm-svn: 345745

5 years agoSecond half of C++17's splicing maps and sets
Erik Pilkington [Wed, 31 Oct 2018 17:31:35 +0000 (17:31 +0000)]
Second half of C++17's splicing maps and sets

This commit adds a merge member function to all the map and set containers,
which splices nodes from the source container. This completes support for
P0083r3.

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

llvm-svn: 345744

5 years ago[globalisel][irtranslator] Verify that DILocations aren't lost in translation
Daniel Sanders [Wed, 31 Oct 2018 17:31:23 +0000 (17:31 +0000)]
[globalisel][irtranslator] Verify that DILocations aren't lost in translation

Summary:
Also fix a couple bugs where DILocations are lost. EntryBuilder wasn't passing
on debug locations for PHI's, constants, GLOBAL_VALUE, etc.

Reviewers: aprantl, vsk, bogner, aditya_nandakumar, volkan, rtereshin, aemerson

Reviewed By: aemerson

Subscribers: aemerson, rovka, kristof.beyls, javed.absar, llvm-commits

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

llvm-svn: 345743

5 years ago[clang-tidy] add missing '--' in RUN-line, unbreak buildbot
Jonas Toth [Wed, 31 Oct 2018 17:26:10 +0000 (17:26 +0000)]
[clang-tidy] add missing '--' in RUN-line, unbreak buildbot

llvm-svn: 345742

5 years ago[Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManager
Kristof Umann [Wed, 31 Oct 2018 17:19:20 +0000 (17:19 +0000)]
[Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManager

I'm currently working on including macro expansions in the Static Analyzer's
plist output, where I can only access a const SourceManager.

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

llvm-svn: 345741

5 years agoMachineModuleInfo: Initialize DbgInfoAvailable depending on debug_cus existing
Matthias Braun [Wed, 31 Oct 2018 17:18:41 +0000 (17:18 +0000)]
MachineModuleInfo: Initialize DbgInfoAvailable depending on debug_cus existing

Before this patch DbgInfoAvailable was set to true in
DwarfDebug::beginModule() or CodeViewDebug::CodeViewDebug(). This made
MIR testing weird since passes would suddenly stop dealing with debug
info just because we stopped the pipeline before the debug printers.

This patch changes the logic to initialize DbgInfoAvailable based on the
fact that debug_compile_units exist in the llvm Module. The debug
printers may then override it with false in case of debug printing being
disabled.

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

llvm-svn: 345740

5 years ago[clang-tidy] add -fexceptions to failing unit-test, unbreak buildbot
Jonas Toth [Wed, 31 Oct 2018 17:08:09 +0000 (17:08 +0000)]
[clang-tidy] add -fexceptions to failing unit-test, unbreak buildbot

llvm-svn: 345738

5 years ago[clang] try-fix broken documentation builder
Jonas Toth [Wed, 31 Oct 2018 17:00:50 +0000 (17:00 +0000)]
[clang] try-fix broken documentation builder

llvm-svn: 345737

5 years ago[clang-tools-extra] fix broken link in release notes
Jonas Toth [Wed, 31 Oct 2018 16:59:41 +0000 (16:59 +0000)]
[clang-tools-extra] fix broken link in release notes

llvm-svn: 345736

5 years ago[clang-tidy] new check 'readability-isolate-declaration'
Jonas Toth [Wed, 31 Oct 2018 16:50:44 +0000 (16:50 +0000)]
[clang-tidy] new check 'readability-isolate-declaration'

Summary:
This patch introduces a new clang-tidy check that matches on all `declStmt` that declare more then one variable
and transform them into one statement per declaration if possible.

It currently only focusses on variable declarations but should be extended to cover more kinds of declarations in the future.
It is related to https://reviews.llvm.org/D27621 and does use it's extensive test-suite. Thank you to firolino for his work!

Reviewers: rsmith, aaron.ballman, alexfh, hokein, kbobyrev

Reviewed By: aaron.ballman

Subscribers: ZaMaZaN4iK, mgehre, nemanjai, kbarton, lebedev.ri, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 345735

5 years ago[InstCombine] refactor fabs+fcmp fold; NFC
Sanjay Patel [Wed, 31 Oct 2018 16:34:43 +0000 (16:34 +0000)]
[InstCombine] refactor fabs+fcmp fold; NFC

Also, remove/replace/minimize/enhance the tests for this fold.
The code drops FMF, so it needs more tests and at least 1 fix.

llvm-svn: 345734

5 years ago[LLDB] - Regroup the switch entries in DWARFFormValue::ExtractValue. NFC.
George Rimar [Wed, 31 Oct 2018 16:12:29 +0000 (16:12 +0000)]
[LLDB] - Regroup the switch entries in DWARFFormValue::ExtractValue. NFC.

This is NFC to clean up the `DWARFFormValue::ExtractValue`.
It groups similar `DW_FORM_*` and removes an excessive
assignment of `ref_addr_size` (it was assigned right after in any case).

llvm-svn: 345733

5 years ago[Hexagon] Make sure not to use GP-relative addressing with PIC
Krzysztof Parzyszek [Wed, 31 Oct 2018 15:54:31 +0000 (15:54 +0000)]
[Hexagon] Make sure not to use GP-relative addressing with PIC

Make sure that -relocation-model=pic prevents use of GP-relative
addressing modes.

llvm-svn: 345731

5 years ago[llvm-mca] Remove namespace prefixes made redundant by r345612. NFC
Andrea Di Biagio [Wed, 31 Oct 2018 15:53:28 +0000 (15:53 +0000)]
[llvm-mca] Remove namespace prefixes made redundant by r345612. NFC

llvm-svn: 345730

5 years agoDelete dependency on config.h
Kadir Cetinkaya [Wed, 31 Oct 2018 15:37:09 +0000 (15:37 +0000)]
Delete dependency on config.h

Summary:
Since llvm/Config/config.h is not available on standalone builds,
use __USE_POSIX instead of HAVE_PTHREAD_H and get rid of the include.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: lebedev.ri, krytarowski, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits

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

llvm-svn: 345729

5 years ago[InstSimplify] fold 'fcmp nnan ult X, 0.0' when X is not negative
Sanjay Patel [Wed, 31 Oct 2018 15:35:46 +0000 (15:35 +0000)]
[InstSimplify] fold 'fcmp nnan ult X, 0.0' when X is not negative

This is the inverted case for the transform added with D53874 / rL345725.

llvm-svn: 345728

5 years ago[InstCombine] add assertion that InstSimplify has folded a fabs+fcmp; NFC
Sanjay Patel [Wed, 31 Oct 2018 15:31:45 +0000 (15:31 +0000)]
[InstCombine] add assertion that InstSimplify has folded a fabs+fcmp; NFC

The 'OLT' case was updated at rL266175, so I assume it was just an
oversight that 'UGE' was not included because that patch handled
both predicates in InstSimplify.

llvm-svn: 345727

5 years agoUpdate ioctl(2) operations for NetBSD 8.99.25
Kamil Rytarowski [Wed, 31 Oct 2018 15:04:20 +0000 (15:04 +0000)]
Update ioctl(2) operations for NetBSD 8.99.25

Eliminate dropped operations, add new operations.

Update included headers for newer need.

Add a fallback definition of nvlist_ref_t, becaue this type
is internal to libnpf and the kernel, not exported into public
headers.

llvm-svn: 345726

5 years ago[InstSimplify] fold 'fcmp nnan oge X, 0.0' when X is not negative
Sanjay Patel [Wed, 31 Oct 2018 14:57:23 +0000 (14:57 +0000)]
[InstSimplify] fold 'fcmp nnan oge X, 0.0' when X is not negative

This re-raises some of the open questions about how to apply and use fast-math-flags in IR from PR38086:
https://bugs.llvm.org/show_bug.cgi?id=38086
...but given the current implementation (no FMF on casts), this is likely the only way to predicate the
transform.

This is part of solving PR39475:
https://bugs.llvm.org/show_bug.cgi?id=39475

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

llvm-svn: 345725

5 years ago[analyzer][PlistMacroExpansion] Part 1.: New expand-macros flag
Kristof Umann [Wed, 31 Oct 2018 14:54:27 +0000 (14:54 +0000)]
[analyzer][PlistMacroExpansion] Part 1.: New expand-macros flag

This is the first part of the implementation of the inclusion of macro
expansions into the plist output. It adds a new flag that adds a new
"macro_expansions" entry to each report that has PathDiagnosticPieces that were
expanded from a macro. While there's an entry for each macro expansion, both
the name of the macro and what it expands to is missing, and will be implemented
in followup patches.

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

llvm-svn: 345724

5 years ago[LoopUnroll] allow customization for new-pass-manager version of LoopUnroll
Fedor Sergeev [Wed, 31 Oct 2018 14:33:14 +0000 (14:33 +0000)]
[LoopUnroll] allow customization for new-pass-manager version of LoopUnroll

Unlike its legacy counterpart new pass manager's LoopUnrollPass does
not provide any means to select which flavors of unroll to run
(runtime, peeling, partial), relying on global defaults.

In some cases having ability to run a restricted LoopUnroll that
does more than LoopFullUnroll is needed.

Introduced LoopUnrollOptions to select optional unroll behaviors.
Added 'unroll<peeling>' to PassRegistry mainly for the sake of testing.

Reviewers: chandlerc, tejohnson
Differential Revision: https://reviews.llvm.org/D53440

llvm-svn: 345723

5 years ago[InstSimplify] add tests for fcmp and known positive; NFC
Sanjay Patel [Wed, 31 Oct 2018 14:29:21 +0000 (14:29 +0000)]
[InstSimplify] add tests for fcmp and known positive; NFC

llvm-svn: 345722

5 years ago[DAGCombiner] Fold 0 div/rem X to 0
David Bolvansky [Wed, 31 Oct 2018 14:18:57 +0000 (14:18 +0000)]
[DAGCombiner] Fold 0 div/rem X to 0

Reviewers: RKSimon, spatel, javed.absar, craig.topper, t.p.northover

Reviewed By: RKSimon

Subscribers: craig.topper, llvm-commits

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

llvm-svn: 345721

5 years ago[LLDB] - Removed unused variable. NFC.
George Rimar [Wed, 31 Oct 2018 13:49:31 +0000 (13:49 +0000)]
[LLDB] - Removed unused variable. NFC.

Introduced in r344119.

Thanks to Dávid Bolvanský fo reporting.

llvm-svn: 345720

5 years agoAMDGPU: Rewrite SILowerI1Copies to always stay on SALU
Nicolai Haehnle [Wed, 31 Oct 2018 13:27:08 +0000 (13:27 +0000)]
AMDGPU: Rewrite SILowerI1Copies to always stay on SALU

Summary:
Instead of writing boolean values temporarily into 32-bit VGPRs
if they are involved in PHIs or are observed from outside a loop,
we use bitwise masking operations to combine lane masks in a way
that is consistent with wave control flow.

Move SIFixSGPRCopies to before this pass, since that pass
incorrectly attempts to move SGPR phis to VGPRs.

This should recover most of the code quality that was lost with
the bug fix in "AMDGPU: Remove PHI loop condition optimization".

There are still some relevant cases where code quality could be
improved, in particular:

- We often introduce redundant masks with EXEC. Ideally, we'd
  have a generic computeKnownBits-like analysis to determine
  whether masks are already masked by EXEC, so we can avoid this
  masking both here and when lowering uniform control flow.

- The criterion we use to determine whether a def is observed
  from outside a loop is conservative: it doesn't check whether
  (loop) branch conditions are uniform.

Change-Id: Ibabdb373a7510e426b90deef00f5e16c5d56e64b

Reviewers: arsenm, rampitec, tpr

Subscribers: kzhuravl, jvesely, wdng, mgorny, yaxunl, dstuttard, t-tye, eraman, llvm-commits

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

llvm-svn: 345719

5 years agoAMDGPU: Remove PHI loop condition optimization
Nicolai Haehnle [Wed, 31 Oct 2018 13:26:48 +0000 (13:26 +0000)]
AMDGPU: Remove PHI loop condition optimization

Summary:
The optimization to early break out of loops if all threads are dead was
never fully implemented.

But the PHI node analyzing is actually causing a number of problems, so
remove all the extra code for it.

(This does actually regress code quality in a few places because it
 ends up relying more heavily on phi's of i1, which we don't do a
 great job with. However, since it fixes real bugs in the wild, we
 should take this change. I have some prototype changes to improve
 i1 lowering in general -- not just for control flow -- which should
 help recover the code quality, I just need to make those changes
 fit for general consumption. -- Nicolai)

Change-Id: I6fc6c6c8961857ac6009fcfb9f7e5e48dc23fbb1
Patch-by: Christian König <christian.koenig@amd.com>
Reviewers: arsenm, rampitec, tpr

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, llvm-commits

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

llvm-svn: 345718

5 years ago[InstSimplify] fold icmp based on range of abs/nabs
Sanjay Patel [Wed, 31 Oct 2018 13:25:10 +0000 (13:25 +0000)]
[InstSimplify] fold icmp based on range of abs/nabs

This is a fix for PR39475:
https://bugs.llvm.org/show_bug.cgi?id=39475

We managed to get some of these patterns using computeKnownBits in D47041, but that
can't be used for nabs(). Instead, put in some range-based logic, so we can fold
both abs/nabs with icmp with a constant value.

Alive proofs:
https://rise4fun.com/Alive/21r

Name: abs_nsw_is_positive
  %cmp = icmp slt i32 %x, 0
  %negx = sub nsw i32 0, %x
  %abs = select i1 %cmp, i32 %negx, i32 %x
  %r = icmp sgt i32 %abs, -1
    =>
  %r = i1 true

Name: abs_nsw_is_not_negative
  %cmp = icmp slt i32 %x, 0
  %negx = sub nsw i32 0, %x
  %abs = select i1 %cmp, i32 %negx, i32 %x
  %r = icmp slt i32 %abs, 0
    =>
  %r = i1 false

Name: nabs_is_negative_or_0
  %cmp = icmp slt i32 %x, 0
  %negx = sub i32 0, %x
  %nabs = select i1 %cmp, i32 %x, i32 %negx
  %r = icmp slt i32 %nabs, 1
    =>
  %r = i1 true

Name: nabs_is_not_over_0
  %cmp = icmp slt i32 %x, 0
  %negx = sub i32 0, %x
  %nabs = select i1 %cmp, i32 %x, i32 %negx
  %r = icmp sgt i32 %nabs, 0
    =>
  %r = i1 false

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

llvm-svn: 345717

5 years ago[clang-tidy] Remove false decoupling in ClangTidyContext. NFC
Sam McCall [Wed, 31 Oct 2018 13:08:19 +0000 (13:08 +0000)]
[clang-tidy] Remove false decoupling in ClangTidyContext. NFC

These getters/setters don't encapsulate any behavior, and can only be
called by friends.

llvm-svn: 345716

5 years agoUpdate generate_netbsd_ioctls.awk for NetBSD 8.99.25
Kamil Rytarowski [Wed, 31 Oct 2018 12:52:08 +0000 (12:52 +0000)]
Update generate_netbsd_ioctls.awk for NetBSD 8.99.25

Add dynamic detection of header files in /usr/include.
Handle "nvlist_ref_t" needed by npf(4) ioctl(2) operations.

llvm-svn: 345715

5 years ago[tblgen][PredicateExpander] Add the ability to describe more complex constraints...
Andrea Di Biagio [Wed, 31 Oct 2018 12:28:05 +0000 (12:28 +0000)]
[tblgen][PredicateExpander] Add the ability to describe more complex constraints on instruction operands.

Before this patch, class PredicateExpander only knew how to expand simple
predicates that performed checks on instruction operands.
In particular, the new scheduling predicate syntax was not rich enough to
express checks like this one:

  Foo(MI->getOperand(0).getImm()) == ExpectedVal;

Here, the immediate operand value at index zero is passed in input to function
Foo, and ExpectedVal is compared against the value returned by function Foo.

While this predicate pattern doesn't show up in any X86 model, it shows up in
other upstream targets. So, being able to support those predicates is
fundamental if we want to be able to modernize all the scheduling models
upstream.

With this patch, we allow users to specify if a register/immediate operand value
needs to be passed in input to a function as part of the predicate check. Now,
register/immediate operand checks all derive from base class CheckOperandBase.

This patch also changes where TIIPredicate definitions are expanded by the
instructon info emitter. Before, definitions were expanded in class
XXXGenInstrInfo (where XXX is a target name).
With the introduction of this new syntax, we may want to have TIIPredicates
expanded directly in XXXInstrInfo. That is because functions used by the new
operand predicates may only exist in the derived class (i.e. XXXInstrInfo).

This patch is a non functional change for the existing scheduling models.
In future, we will be able to use this richer syntax to better describe complex
scheduling predicates, and expose them to llvm-mca.

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

llvm-svn: 345714

5 years ago[NFC] Add tests for loop-simplifycfg for further development
Max Kazantsev [Wed, 31 Oct 2018 11:28:23 +0000 (11:28 +0000)]
[NFC] Add tests for loop-simplifycfg for further development

llvm-svn: 345713

5 years ago[ADT] Remove illegal comparison of singular iterators from SmallSetTest
Florian Hahn [Wed, 31 Oct 2018 11:00:48 +0000 (11:00 +0000)]
[ADT] Remove illegal comparison of singular iterators from SmallSetTest

This removes the assertion that a copy of a moved-from SmallSetIterator
equals the original, which is illegal due to SmallSetIterator including
an instance of a standard `std::set` iterator.

C++ [iterator.requirements.general] states that comparing singular
iterators has undefined result:

> Iterators can also have singular values that are not associated with
> any sequence. [...] Results of most expressions are undefined for
> singular values; the only exceptions are destroying an iterator that
> holds a singular value, the assignment of a non-singular value to an
> iterator that holds a singular value, and, for iterators that satisfy
> the Cpp17DefaultConstructible requirements, using a value-initialized
> iterator as the source of a copy or move operation.

This assertion triggers the following error in the GNU C++ Library in
debug mode under EXPENSIVE_CHECKS:

  /usr/include/c++/8.2.1/debug/safe_iterator.h:518:
  Error: attempt to compare a singular iterator to a singular iterator.

  Objects involved in the operation:
      iterator "lhs" @ 0x0x7fff86420670 {
        state = singular;
      }
      iterator "rhs" @ 0x0x7fff86420640 {
        state = singular;
      }

Patch by Eugene Sharygin.

Reviewers: fhahn, dblaikie, chandlerc

Reviewed By: fhahn, dblaikie

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

llvm-svn: 345712

5 years ago[lldb] Fix race condition in framework installation
Shoaib Meenai [Wed, 31 Oct 2018 10:41:12 +0000 (10:41 +0000)]
[lldb] Fix race condition in framework installation

We need the install-liblldb-stripped target to depend on the
lldb-framework target in order for the installation to be guaranteed to
behave correctly, otherwise it's possible for the lldb-framework and
install-liblldb-stripped targets to run in parallel, resulting in
temporary or partially processed files being copied into the framework.
install-liblldb already depends on lldb-framework for this reason.

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

llvm-svn: 345711

5 years ago[AMDGPU] support image load/store a16
Neil Henning [Wed, 31 Oct 2018 10:34:48 +0000 (10:34 +0000)]
[AMDGPU] support image load/store a16

Our a16 support was only enabled for sample/gather and buffer
load/store, but not for image load/store operations (which take an i16
as the pixel index rather than a half).

Fix our isel lowering and add test cases to prove it out.

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

llvm-svn: 345710

5 years agoFollow-up to r345699: Call CheckStaticLocalForDllExport later for templates
Hans Wennborg [Wed, 31 Oct 2018 10:34:46 +0000 (10:34 +0000)]
Follow-up to r345699: Call CheckStaticLocalForDllExport later for templates

Calling it too early might cause dllimport to get inherited onto the
VarDecl before the initializer got attached. See the test case for an
example where this broke things.

llvm-svn: 345709

5 years ago[IndVars] Strengthen restricton in rewriteLoopExitValues
Max Kazantsev [Wed, 31 Oct 2018 10:30:50 +0000 (10:30 +0000)]
[IndVars] Strengthen restricton in rewriteLoopExitValues

For some unclear reason rewriteLoopExitValues considers recalculation
after the loop profitable if it has some "soft uses" outside the loop (i.e. any
use other than call and return), even if we have proved that it has a user inside
the loop which we think will not be optimized away.

There is no existing unit test that would explain this. This patch provides an
example when rematerialisation of exit value is not profitable but it passes
this check due to presence of a "soft use" outside the loop.

It makes no sense to recalculate value on exit if we are going to compute it
due to some irremovable within the loop. This patch disallows applying this
transform in the described situation.

Differential Revision: https://reviews.llvm.org/D51581
Reviewed By: etherzhhb

llvm-svn: 345708