platform/upstream/llvm.git
6 years ago[X86][Btver2] Add support for multiple pipelines stages for x86 scalar schedules...
Simon Pilgrim [Thu, 15 Mar 2018 23:46:12 +0000 (23:46 +0000)]
[X86][Btver2] Add support for multiple pipelines stages for x86 scalar schedules. NFCI.

This allows us to use JWriteResIntPair for complex schedule classes (like WriteIDiv) as well as single pipe instructions.

llvm-svn: 327686

6 years ago[X86][Btver2] Tweak pipes test to remove register dependencies
Simon Pilgrim [Thu, 15 Mar 2018 23:15:11 +0000 (23:15 +0000)]
[X86][Btver2] Tweak pipes test to remove register dependencies

It gives us a better view of pipe usage in the timeline which is what the test is trying to show.

llvm-svn: 327685

6 years agoFix linker script operator precedence.
Rui Ueyama [Thu, 15 Mar 2018 23:12:33 +0000 (23:12 +0000)]
Fix linker script operator precedence.

"&" should have higher priority than "|" [1]. Previously, they had
the same priority.

[1] https://sourceware.org/binutils/docs/ld/Operators.html

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

llvm-svn: 327684

6 years ago[SelectionDAG][ARM][X86] Teach PromoteIntRes_SETCC to do a better job picking the...
Craig Topper [Thu, 15 Mar 2018 23:04:11 +0000 (23:04 +0000)]
[SelectionDAG][ARM][X86] Teach PromoteIntRes_SETCC to do a better job picking the result type for the setcc.

Previously if getSetccResultType returned an illegal type we just fell back to using the default promoted type. This appears to have been to handle the case where for vectors getSetccResultType returns the input type, but the input type itself isn't legal and will need to be promoted. Without the legality check we would never reach a legal type.

But just picking the promoted type to be the setcc type can create strange setccs where the result type is 128 bits and the operand type is 256 bits. If for example the result type was promoted to v8i16 from v8i1, but the input type was promoted from v8i23 to v8i32. We currently handle this with custom lowering code in X86.

This legality check also caused us reject the getSetccResultType when the input type needed to be widened or split. Even though that result wouldn't have caused legalization to get stuck.

This patch tries to fix this by detecting the getSetccResultType needs to be promoted. If its input type also needs to be promoted we'll try a ask for a new setcc result type based on its eventual promoted value. Otherwise we fall back to default type to promote to.

For any other illegal values we might get back from the initial call to getSetccResultType we just keep and allow it to be re-legalized later via splitting or widening or scalarizing.

llvm-svn: 327683

6 years ago[X86][Btver2] Fix ymm div/sqrt to use fmul unit
Simon Pilgrim [Thu, 15 Mar 2018 23:00:47 +0000 (23:00 +0000)]
[X86][Btver2] Fix ymm div/sqrt to use fmul unit

YMM FDiv/FSqrt are dispatched on pipe JFPU1 but should be performed on the JFPM unit - that is where most of the cycles are spent.

This matches the pipes for WriteFSqrt/WriteFDiv definitions.

llvm-svn: 327682

6 years agoUse standard `print(dbgs())` pattern to implement DebugLoc::dump
Sean Silva [Thu, 15 Mar 2018 22:51:55 +0000 (22:51 +0000)]
Use standard `print(dbgs())` pattern to implement DebugLoc::dump

The open-coded implementation had a bug. It didn't print filenames.

llvm-svn: 327681

6 years ago[InstCombine] add tests for fcmp+select -> fabs; NFC
Sanjay Patel [Thu, 15 Mar 2018 22:48:23 +0000 (22:48 +0000)]
[InstCombine] add tests for fcmp+select -> fabs; NFC

llvm-svn: 327680

6 years agoFix PDB injected sources test.
Zachary Turner [Thu, 15 Mar 2018 22:47:04 +0000 (22:47 +0000)]
Fix PDB injected sources test.

This test was originally disabled because it was failing on a bot.
It turns out I had run dos2unix on the file, and that removed a
necessary byte from the file.  I'm just recomitting the proper
file and updating the test to test a little bit more now.

llvm-svn: 327679

6 years agoMSan, FreeBSD few tests fixes
Vitaly Buka [Thu, 15 Mar 2018 22:41:28 +0000 (22:41 +0000)]
MSan, FreeBSD few tests fixes

Summary:
pthread_getattr_np_deadlock support
pthread_getname_np unsupported

Reviewers: krytarowski, vitalybuka

Reviewed By: vitalybuka

Subscribers: eugenis, srhines, krytarowski, llvm-commits, #sanitizers

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

llvm-svn: 327678

6 years agoOpenBSD UBsan support procmaps
Vitaly Buka [Thu, 15 Mar 2018 22:40:47 +0000 (22:40 +0000)]
OpenBSD UBsan support procmaps

Summary: procmaps OpenBSD specifics

Patch by David CARLIER

Reviewers: krytarowski, vitalybuka

Reviewed By: vitalybuka

Subscribers: mgorny, emaste, kubamracek, fedor.sergeev, llvm-commits, #sanitizers

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

llvm-svn: 327677

6 years ago[X86][Btver2] Add test to show timeline of fpu instructions on different pipes/units
Simon Pilgrim [Thu, 15 Mar 2018 22:34:24 +0000 (22:34 +0000)]
[X86][Btver2] Add test to show timeline of fpu instructions on different pipes/units

Try to demonstrate the scheduling from fpu0/fpu1 pipes to the valu0/vimul/fpa or valu1/stc/fpm functional units

llvm-svn: 327676

6 years ago[PDB] Fix a bug where we were serializing hash tables incorrectly.
Zachary Turner [Thu, 15 Mar 2018 22:31:00 +0000 (22:31 +0000)]
[PDB] Fix a bug where we were serializing hash tables incorrectly.

There was some code that tried to calculate the number of 4-byte
words required to hold N bits, but it was instead computing the
number of bytes required to hold N bits.  This was leading to
extraneous data being output into the hash table, which would
cause certain operations in DIA (the Microsoft PDB reader) to
fail.

llvm-svn: 327675

6 years agoOpenBSD UBsan support common functions
Vitaly Buka [Thu, 15 Mar 2018 22:19:39 +0000 (22:19 +0000)]
OpenBSD UBsan support common functions

Summary: Ripped off OpenBSD specific from the common Linux implementation

Patch by David Carlier

Reviewers: krytarowski, vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers

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

llvm-svn: 327674

6 years ago[WebAssembly] Add DebugLoc information to WebAssembly block and loop.
Derek Schuff [Thu, 15 Mar 2018 22:06:51 +0000 (22:06 +0000)]
[WebAssembly] Add DebugLoc information to WebAssembly block and loop.

Patch by Yury Delendik
Differential Revision: https://reviews.llvm.org/D44448

llvm-svn: 327673

6 years ago[NVPTX] TblGen-ized lowering of WMMA intrinsics.
Artem Belevich [Thu, 15 Mar 2018 21:40:56 +0000 (21:40 +0000)]
[NVPTX] TblGen-ized lowering of WMMA intrinsics.

NFC.

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

llvm-svn: 327672

6 years ago[LoopUnroll] Peel off iterations if it makes conditions true/false.
Florian Hahn [Thu, 15 Mar 2018 21:34:43 +0000 (21:34 +0000)]
[LoopUnroll] Peel off iterations if it makes conditions true/false.

If the loop body contains conditions of the form IndVar < #constant, we
can remove the checks by peeling off #constant iterations.

This improves codegen for PR34364.

Reviewers: mkuper, mkazantsev, efriedma

Reviewed By: mkazantsev

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

llvm-svn: 327671

6 years agoRe-land r327620 "[CodeView] Initial support for emitting S_BLOCK32 symbols for lexica...
Reid Kleckner [Thu, 15 Mar 2018 21:24:04 +0000 (21:24 +0000)]
Re-land r327620 "[CodeView] Initial support for emitting S_BLOCK32 symbols for lexical scopes"

This is safe to land now that we don't copy FunctionInfo when rehashing
the DenseMap.

llvm-svn: 327670

6 years ago[codeview] Fix sense of the assertion about hashtable insertion
Reid Kleckner [Thu, 15 Mar 2018 21:18:42 +0000 (21:18 +0000)]
[codeview] Fix sense of the assertion about hashtable insertion

llvm-svn: 327669

6 years agoCOFF: Implement string tail merging.
Peter Collingbourne [Thu, 15 Mar 2018 21:14:02 +0000 (21:14 +0000)]
COFF: Implement string tail merging.

In COFF, duplicate string literals are merged by placing them in a
comdat whose leader symbol name contains a specific prefix followed
by the hash and partial contents of the string literal. This gives
us an easy way to identify sections containing string literals in
the linker: check for leader symbol names with the given prefix.

Any sections that are identified in this way as containing string
literals may be tail merged. We do so using the StringTableBuilder
class, which is also used to tail merge string literals in the ELF
linker. Tail merging is enabled only if ICF is enabled, as this
provides a signal as to whether the user cares about binary size.

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

llvm-svn: 327668

6 years agoCOFF: Move assignment of section RVAs to assignAddresses(). NFCI.
Peter Collingbourne [Thu, 15 Mar 2018 21:13:46 +0000 (21:13 +0000)]
COFF: Move assignment of section RVAs to assignAddresses(). NFCI.

This makes the design a little more similar to the ELF linker and
should allow for features such as ARM range extension thunks to be
implemented more easily.

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

llvm-svn: 327667

6 years agoFix structure alignment issue.
Zachary Turner [Thu, 15 Mar 2018 21:12:51 +0000 (21:12 +0000)]
Fix structure alignment issue.

llvm-svn: 327666

6 years ago[codeview] Delete FunctionInfo copy ctor and move out of DenseMap
Reid Kleckner [Thu, 15 Mar 2018 21:12:21 +0000 (21:12 +0000)]
[codeview] Delete FunctionInfo copy ctor and move out of DenseMap

We were unnecessarily copying a bunch of these FunctionInfo objects
around when rehashing the DenseMap.

Furthermore, r327620 introduced pointers referring to objects owned by
FunctionInfo, and the default copy ctor did the wrong thing in this
case, leading to use-after-free when the DenseMap gets rehashed.

I will rebase r327620 on this next and recommit it.

llvm-svn: 327665

6 years ago[LICM] Ignore exits provably not taken on first iteration when computing must execute
Philip Reames [Thu, 15 Mar 2018 21:04:28 +0000 (21:04 +0000)]
[LICM] Ignore exits provably not taken on first iteration when computing must execute

It is common to have conditional exits within a loop which are known not to be taken on some iterations, but not necessarily all. This patches extends our reasoning around guaranteed to execute (used when establishing whether it's safe to dereference a location from the preheader) to handle the case where an exit is known not to be taken on the first iteration and the instruction of interest *is* known to be taken on the first iteration.

This case comes up in two major ways:
* If we have a range check which we've been unable to eliminate, we frequently know that it doesn't fail on the first iteration.
* Pass ordering. We may have a check which will be eliminated through some sequence of other passes, but depending on the exact pass sequence we might never actually do so or we might miss other optimizations from passes run before the check is finally eliminated.

The initial version (here) is implemented via InstSimplify. At the moment, it catches a few cases, but misses a lot too. I added test cases for missing cases in InstSimplify which I'll follow up on separately. Longer term, we should probably wire SCEV through to here to get much smarter loop aware simplification of the first iteration predicate.

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

llvm-svn: 327664

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Thu, 15 Mar 2018 20:37:32 +0000 (20:37 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Fix typo.

llvm-svn: 327663

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Thu, 15 Mar 2018 20:31:25 +0000 (20:31 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Add special case for rotate right.

llvm-svn: 327662

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Thu, 15 Mar 2018 20:31:13 +0000 (20:31 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Increase the number of cheap as move cases of register reset.

llvm-svn: 327661

6 years ago[X86] Make sure we use FSUB instruction as the reference for operand order in isAddSu...
Craig Topper [Thu, 15 Mar 2018 20:30:54 +0000 (20:30 +0000)]
[X86] Make sure we use FSUB instruction as the reference for operand order in isAddSubOrSubAdd when recognizing subadd

The FADD part of the addsub/subadd pattern can have its operands commuted, but when checking for fsubadd we were using the fadd as reference and commuting the fsub node.

llvm-svn: 327660

6 years ago[X86] Add test case showing bad fmsubadd creation due to bad commuting.
Craig Topper [Thu, 15 Mar 2018 20:30:51 +0000 (20:30 +0000)]
[X86] Add test case showing bad fmsubadd creation due to bad commuting.

The code that creates fmsubadd from shuffle vector has some code to allow commuting the operands of the fadd node. This code was originally created when we only recognized fmaddsub. When fmsubadd support was added this code was not updated and is now commuting the fsub operands instead.

llvm-svn: 327659

6 years agoRemove empty file
David Blaikie [Thu, 15 Mar 2018 20:29:14 +0000 (20:29 +0000)]
Remove empty file

I should've deleted this in r320768 but accidentally just deleted its
contents instead.

llvm-svn: 327658

6 years agoRevert r327620 "[CodeView] Initial support for emitting S_BLOCK32 symbols for lexical...
Reid Kleckner [Thu, 15 Mar 2018 20:12:16 +0000 (20:12 +0000)]
Revert r327620 "[CodeView] Initial support for emitting S_BLOCK32 symbols for lexical scopes"

It is causing crashes when compiling Chrome in debug mode.

I'll try to debug it in a second.

llvm-svn: 327657

6 years ago[LV] Test commit. Removing white space.
Diego Caballero [Thu, 15 Mar 2018 19:34:27 +0000 (19:34 +0000)]
[LV] Test commit. Removing white space.

This is just to check that I have commit access privilege.

llvm-svn: 327656

6 years ago[EarlyCSE] Don't hide earler invariant.scopes
Philip Reames [Thu, 15 Mar 2018 18:12:27 +0000 (18:12 +0000)]
[EarlyCSE] Don't hide earler invariant.scopes

If we've already established an invariant scope with an earlier generation, we don't want to hide it in the scoped hash table with one with a later generation.  I noticed this when working on the invariant-load handling, but it also applies to the invariant.start case as well.

Without this change, my previous patch for invariant-load regresses some cases, so I'm pushing this without waiting for review.  This is why you don't make last minute tweaks to patches to catch "obvious cases" after it's already been reviewed.  Bad Philip!

llvm-svn: 327655

6 years ago[OPENMP, NVPTX] Improve globalization of the variables captured by value.
Alexey Bataev [Thu, 15 Mar 2018 18:10:54 +0000 (18:10 +0000)]
[OPENMP, NVPTX] Improve globalization of the variables captured by value.

If the variable is captured by value and the corresponding parameter in
the outlined function escapes its declaration context, this parameter
must be globalized. To globalize it we need to get the address of the
original parameter, load the value, store it to the global address and
use this global address instead of the original.

Patch improves globalization for parallel|teams regions + functions in
declare target regions.

llvm-svn: 327654

6 years agoMove some function declarations higher so they can be found.
Zachary Turner [Thu, 15 Mar 2018 17:56:44 +0000 (17:56 +0000)]
Move some function declarations higher so they can be found.

llvm-svn: 327653

6 years agoAdd missing #includes.
Zachary Turner [Thu, 15 Mar 2018 17:51:10 +0000 (17:51 +0000)]
Add missing #includes.

llvm-svn: 327652

6 years ago[PPC] Avoid non-simple MVT in STBRX optimization
Guozhi Wei [Thu, 15 Mar 2018 17:49:12 +0000 (17:49 +0000)]
[PPC] Avoid non-simple MVT in STBRX optimization

PR35402 triggered this case. It bswap and stores a 48bit value, current STBRX optimization transforms it into STBRX. Unfortunately 48bit is not a simple MVT, there is no PPC instruction to support it, and it can't be automatically expanded by llvm, so caused a crash.

This patch detects the non-simple MVT and returns early.

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

llvm-svn: 327651

6 years ago[X86][Btver2] Attach AES/CLMUL instructions to a scheduler pipe
Simon Pilgrim [Thu, 15 Mar 2018 17:45:10 +0000 (17:45 +0000)]
[X86][Btver2] Attach AES/CLMUL instructions to a scheduler pipe

llvm-svn: 327650

6 years ago[X86] Simplify the type legality checking for (FM)ADDSUB/SUBADD matching. NFCI
Craig Topper [Thu, 15 Mar 2018 17:38:59 +0000 (17:38 +0000)]
[X86] Simplify the type legality checking for (FM)ADDSUB/SUBADD matching. NFCI

Rather than enumerating all specific types, for the DAG combine we can just use TLI::isTypeLegal and an SSE3 check. For the BUILD_VECTOR version we already know the type is legal so we just need to check SSE3.

llvm-svn: 327649

6 years ago[X86] Fix 80 column violations.
Craig Topper [Thu, 15 Mar 2018 17:38:55 +0000 (17:38 +0000)]
[X86] Fix 80 column violations.

llvm-svn: 327648

6 years agoRefactor the PDB HashTable class.
Zachary Turner [Thu, 15 Mar 2018 17:38:26 +0000 (17:38 +0000)]
Refactor the PDB HashTable class.

It previously only worked when the key and value types were
both 4 byte integers.  We now have a use case for a non trivial
value type, so we need to extend it to support arbitrary value
types, which means templatizing it.

llvm-svn: 327647

6 years ago[EarlyCSE] Reuse invariant scopes for invariant load
Philip Reames [Thu, 15 Mar 2018 17:29:32 +0000 (17:29 +0000)]
[EarlyCSE] Reuse invariant scopes for invariant load

This is a follow up to https://reviews.llvm.org/D43716 which rewrites the invariant load handling using the new infrastructure. It's slightly more powerful, but only in somewhat minor ways for the moment. It's not clear that DSE of stores to invariant locations is actually interesting since why would your IR have such a construct to start with?

Note: The submitted version is slightly different than the reviewed one.  I realized the scope could start for an invariant load which was proven redundant and removed.  Added a test case to illustrate that as well.

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

llvm-svn: 327646

6 years agoAdd a comment about ELF spec and the symbol table's sh_info.
Rui Ueyama [Thu, 15 Mar 2018 17:10:50 +0000 (17:10 +0000)]
Add a comment about ELF spec and the symbol table's sh_info.

llvm-svn: 327645

6 years agoSplit skipIf decorator, the condition is supposed to be OR
Adrian Prantl [Thu, 15 Mar 2018 17:07:05 +0000 (17:07 +0000)]
Split skipIf decorator, the condition is supposed to be OR

llvm-svn: 327644

6 years ago[dotest] remove confirm_directory_exclusivity remnants
Pavel Labath [Thu, 15 Mar 2018 16:52:37 +0000 (16:52 +0000)]
[dotest] remove confirm_directory_exclusivity remnants

llvm-svn: 327643

6 years ago[InstSimplify] peek through unsigned FP casts for sign-bit compares (PR36682)
Roman Lebedev [Thu, 15 Mar 2018 16:17:46 +0000 (16:17 +0000)]
[InstSimplify] peek through unsigned FP casts for sign-bit compares (PR36682)

This pattern came up in PR36682 / D44390
https://bugs.llvm.org/show_bug.cgi?id=36682
https://reviews.llvm.org/D44390
https://godbolt.org/g/oKvT5H

See also D44421, D44424

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits

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

llvm-svn: 327642

6 years ago[InstSimplify][NFC] simplifyICmpWithConstant(): refactor GetCompareTy() calls
Roman Lebedev [Thu, 15 Mar 2018 16:17:40 +0000 (16:17 +0000)]
[InstSimplify][NFC] simplifyICmpWithConstant(): refactor GetCompareTy() calls

Preparation for D44425.

llvm-svn: 327641

6 years ago[llvm-mca] Simplify code. NFC.
Andrea Di Biagio [Thu, 15 Mar 2018 16:13:12 +0000 (16:13 +0000)]
[llvm-mca] Simplify code. NFC.

Now both method DispatchUnit::checkRAT() and DispatchUnit::canDispatch take as
input an Instruction refrence instead of an instruction descriptor.
This was requested by Simon in D44488 to simplify the diff.

llvm-svn: 327640

6 years ago[OpenMP][libomptarget] Enable usage of shared memory slots
Gheorghe-Teodor Bercea [Thu, 15 Mar 2018 16:05:34 +0000 (16:05 +0000)]
[OpenMP][libomptarget] Enable usage of shared memory slots

Summary:
Allow the runtime to use the existing shared memory statically allocated slots.

When a variable is globalized, the underlying memory can be either shared or global memory (both have block-wide visibility). In this case, we allow that the storage to use a limited amount of shared memory that has been statically allocated already. Only if shared memory doesn't prove to be enough do we then invoke malloc() to create a new global memory slot.

Reviewers: ABataev, carlo.bertolli, grokos, caomhin

Reviewed By: grokos

Subscribers: guansong, openmp-commits

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

llvm-svn: 327639

6 years ago[ConstantFolding, InstSimplify] Handle more vector GEPs
Matthew Simpson [Thu, 15 Mar 2018 16:00:29 +0000 (16:00 +0000)]
[ConstantFolding, InstSimplify] Handle more vector GEPs

This patch addresses some additional cases where the compiler crashes upon
encountering vector GEPs. This should fix PR36116.

Differential Revision: https://reviews.llvm.org/D44219
Reference: https://bugs.llvm.org/show_bug.cgi?id=36116

llvm-svn: 327638

6 years ago[OpenMP][libomptarget] Enable multiple frames per global memory slot
Gheorghe-Teodor Bercea [Thu, 15 Mar 2018 15:56:04 +0000 (15:56 +0000)]
[OpenMP][libomptarget] Enable multiple frames per global memory slot

Summary: To save on calls to malloc, this patch enables the re-use of pre-allocated global memory slots.

Reviewers: ABataev, grokos, carlo.bertolli, caomhin

Reviewed By: grokos

Subscribers: guansong, openmp-commits

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

llvm-svn: 327637

6 years ago[OPENMP] Codegen for `omp declare target` construct.
Alexey Bataev [Thu, 15 Mar 2018 15:47:20 +0000 (15:47 +0000)]
[OPENMP] Codegen for `omp declare target` construct.

Added initial codegen for device side of declarations inside `omp
declare target` construct + codegen for implicit `declare target`
functions, which are used in the target regions.

llvm-svn: 327636

6 years ago[PowerPC] Optimize TLS initial-exec sequence to use X-Form loads/stores
Zaara Syeda [Thu, 15 Mar 2018 15:34:41 +0000 (15:34 +0000)]
[PowerPC] Optimize TLS initial-exec sequence to use X-Form loads/stores

This patch adds new load/store instructions for integer scalar types
which can be used for X-Form when fed by add with an @tls relocation.

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

llvm-svn: 327635

6 years agoRecommit r326946 after reducing CallArgList memory footprint
Yaxun Liu [Thu, 15 Mar 2018 15:25:19 +0000 (15:25 +0000)]
Recommit r326946 after reducing CallArgList memory footprint

llvm-svn: 327634

6 years agoFix TestProcessLaunch breakage on MacOS
Pavel Labath [Thu, 15 Mar 2018 15:21:54 +0000 (15:21 +0000)]
Fix TestProcessLaunch breakage on MacOS

This test started failing after r327625. The cause seems difference in the
treatment of relative --stdin paths between MacOS (debugserver?) and linux
(lldb-server?). Linux treats this as relative to the debuggers PWD, while MacOS
as relative to (I think) the future PWD of the launched process.

This fixes the issue by using absolute paths, which should work everywhere, but
we should probably unify this path handling as well. I'll ask around about what
is the expected behavior here.

llvm-svn: 327633

6 years ago[X86][Btver2] Remove JAny resource, and map system/microcoded instructions to JALU...
Simon Pilgrim [Thu, 15 Mar 2018 15:12:12 +0000 (15:12 +0000)]
[X86][Btver2] Remove JAny resource, and map system/microcoded instructions to JALU pipes

Simplifies throughput to the issue width (1/2) instead of permitting any pipe (1/6)

llvm-svn: 327632

6 years ago[InstSimplify] add tests with NaN operand for fp binops; NFC
Sanjay Patel [Thu, 15 Mar 2018 14:48:39 +0000 (14:48 +0000)]
[InstSimplify] add tests with NaN operand for fp binops; NFC

llvm-svn: 327631

6 years ago[X86][SSE] Introduce Float/Vector WriteMove, WriteLoad and Writetore scheduler classes
Simon Pilgrim [Thu, 15 Mar 2018 14:45:30 +0000 (14:45 +0000)]
[X86][SSE] Introduce Float/Vector WriteMove, WriteLoad and Writetore scheduler classes

As discussed on D44428 and PR36726, this patch splits off WriteFMove/WriteVecMove, WriteFLoad/WriteVecLoad and WriteFStore/WriteVecStore scheduler classes to permit vectors to be handled separately from gpr/scalar types.

I've minimised the diff here by only moving various basic SSE/AVX vector instructions across - we can fix the rest when called for. This does fix the MOVDQA vs MOVAPS/MOVAPD discrepancies mentioned on D44428.

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

llvm-svn: 327630

6 years ago[change-namespace] Don't match a function call/ref multiple times.
Eric Liu [Thu, 15 Mar 2018 14:45:02 +0000 (14:45 +0000)]
[change-namespace] Don't match a function call/ref multiple times.

Summary:
Previously, the matcher matches a function call/ref multiple times, one
for each decl ancestor. This might cause problems. For example, in the following
case, `func()` would be matched once (with namespace context) before using decl is
seen and once after using decl is seeing, which would result in different conflicting
replacements as the first match would replace `func` with "ns::func" as it doesn't
know about the using decl.

```
namespace x {
namespace {
using ::ns::func;
void f() { func(); }
}
}
```

Switching from `hasDescendant` matching to `hasAncestor` matching solves the
problem.

Reviewers: hokein

Subscribers: klimek, cfe-commits

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

llvm-svn: 327629

6 years ago[X86] Regenerate schedule tests with zero latency comments
Simon Pilgrim [Thu, 15 Mar 2018 14:30:59 +0000 (14:30 +0000)]
[X86] Regenerate schedule tests with zero latency comments

llvm-svn: 327628

6 years ago[PatternMatch, InstSimplify] allow undef elements when matching any vector FP zero
Sanjay Patel [Thu, 15 Mar 2018 14:29:27 +0000 (14:29 +0000)]
[PatternMatch, InstSimplify] allow undef elements when matching any vector FP zero

This matcher implementation appears to be slightly more efficient than
the generic constant check that it is replacing because every use was
for matching FP patterns, but the previous code would check int and
pointer type nulls too.

llvm-svn: 327627

6 years ago[InstSimplify] remove 'nsz' requirement for frem 0, X
Sanjay Patel [Thu, 15 Mar 2018 14:04:31 +0000 (14:04 +0000)]
[InstSimplify] remove 'nsz' requirement for frem 0, X

From the LangRef definition for frem:
"The value produced is the floating-point remainder of the two operands.
This is the same output as a libm â€˜fmod‘ function, but without any
possibility of setting errno. The remainder has the same sign as the
dividend. This instruction is assumed to execute in the default
floating-point environment."

llvm-svn: 327626

6 years agoNext batch of test-tree-cleaning changes
Pavel Labath [Thu, 15 Mar 2018 13:47:09 +0000 (13:47 +0000)]
Next batch of test-tree-cleaning changes

Summary:
The changes here fall into several categories.

- some tests were redirecting inferior stdout/err to a file. For these I
  make sure we use an absolute path for the file. I also create a
  lldbutil.read_file_on_target helper function to encapsulate the
  differences between reading a file locally and remotely.
- some tests were redirecting the pexpect I/O into a file. For these I
  use a python StringIO object to avoid creating a file altogether.
- the TestSettings inferior was creating a file. Here, I make sure the
  inferior is launched with pwd=build-dir so that the files end up
  created there.
- lldb-mi --log (used by some tests) creates a log file in PWD without
  the ability say differently. To make this work I make sure to run
  lldb-mi with PWD=build_dir. This in turn necessitated a couple of
  changes in other lldb-mi tests, which were using relative paths to
  access the source tree.

Reviewers: aprantl

Subscribers: ki.stfu, mehdi_amini, lldb-commits

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

llvm-svn: 327625

6 years ago[AArch64] Codegen tests for the Armv8.2-A FP16 intrinsics
Sjoerd Meijer [Thu, 15 Mar 2018 13:42:28 +0000 (13:42 +0000)]
[AArch64] Codegen tests for the Armv8.2-A FP16 intrinsics

This is a follow up of the AArch64 FP16 intrinsics work;
the codegen tests had not been added yet.

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

llvm-svn: 327624

6 years ago[AAch64] Tests for ACLE FP16 macros
Sjoerd Meijer [Thu, 15 Mar 2018 13:36:30 +0000 (13:36 +0000)]
[AAch64] Tests for ACLE FP16 macros

This adds some missing tests for the AArch64 FP16 macros.

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

llvm-svn: 327623

6 years ago[Debug] Retain both copies of debug intrinsics in HoistThenElseCodeToIf
Ulrich Weigand [Thu, 15 Mar 2018 12:28:48 +0000 (12:28 +0000)]
[Debug] Retain both copies of debug intrinsics in HoistThenElseCodeToIf

When hoisting common code from the "then" and "else" branches of a condition
to before the "if", the HoistThenElseCodeToIf routine will attempt to merge
the debug location associated with the two original copies of the hoisted
instruction.

This is a problem in the special case where the hoisted instruction is a
debug info intrinsic, since for those the debug location is considered
part of the intrinsic and attempting to modify it may resut in invalid
IR.  This is the underlying cause of PR36410.

This patch fixes the problem by handling debug info intrinsics specially:
instead of hoisting one copy and merging the two locations, the code now
simply hoists both copies, each with its original location intact.  Note
that this is still only done in the case where both original copies are
otherwise (i.e. apart from location metadata) identical.

Reviewed By: aprantl

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

llvm-svn: 327622

6 years ago[TSan] fix Go runtime test on amd64 with PIE
Martin Pelikan [Thu, 15 Mar 2018 12:10:43 +0000 (12:10 +0000)]
[TSan] fix Go runtime test on amd64 with PIE

Summary:
Without this diff, the test segfaults.  Examining the generated executable
(which gets auto-deleted likely by cmake/ninja) yields this error message:

ThreadSanitizer failed to allocate 0x4000 (16384) bytes at address 1755558480000 (errno: 12)

Note that the address has more than 47 bits, which on amd64 means special
treatment and therefore points out an overflow.  The allocation came from
__tsan_map_shadow on a .data pointer, which (on my work Debian-based box)
means the 0x550000000000 range.  This doesn't correspond to the constants
mentioned in tsan_platform.h for Go binaries on Linux/amd64.

The diff therefore allocates memory in the sort of area Go programs would,
and prevents the test from crashing.  It would be nice if reviewers kindly
considered other setups and architectures :-)

Reviewers: kcc, dvyukov

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 327621

6 years ago[CodeView] Initial support for emitting S_BLOCK32 symbols for lexical scopes
Brock Wyma [Thu, 15 Mar 2018 11:52:17 +0000 (11:52 +0000)]
[CodeView] Initial support for emitting S_BLOCK32 symbols for lexical scopes

This patch sorts local variables by lexical scope and emits them inside
an appropriate S_BLOCK32 CodeView symbol.

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

llvm-svn: 327620

6 years ago[New PM][IRCE] port of Inductive Range Check Elimination pass to the new pass manager
Fedor Sergeev [Thu, 15 Mar 2018 11:01:19 +0000 (11:01 +0000)]
[New PM][IRCE] port of Inductive Range Check Elimination pass to the new pass manager

There are two nontrivial details here:
* Loop structure update interface is quite different with new pass manager,
  so the code to add new loops was factored out

* BranchProbabilityInfo is not a loop analysis, so it can not be just getResult'ed from
  within the loop pass. It cant even be queried through getCachedResult as LoopCanonicalization
  sequence (e.g. LoopSimplify) might invalidate BPI results.

  Complete solution for BPI will likely take some time to discuss and figure out,
  so for now this was partially solved by making BPI optional in IRCE
  (skipping a couple of profitability checks if it is absent).

Most of the IRCE tests got their corresponding new-pass-manager variant enabled.
Only two of them depend on BPI, both marked with TODO, to be turned on when BPI
starts being available for loop passes.

Reviewers: chandlerc, mkazantsev, sanjoy, asbirlea
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D43795

llvm-svn: 327619

6 years agoMore warnings when double truncation to float: compound assignment is supported now.
Andrew V. Tischenko [Thu, 15 Mar 2018 10:03:35 +0000 (10:03 +0000)]
More warnings when double truncation to float: compound assignment is supported now.

llvm-svn: 327618

6 years ago[LoopUnroll] Ignore ephemeral values when checking full unroll profitability.
Andrei Elovikov [Thu, 15 Mar 2018 09:59:15 +0000 (09:59 +0000)]
[LoopUnroll] Ignore ephemeral values when checking full unroll profitability.

Summary:
Before this patch call graph is like this in the LoopUnrollPass:

  tryToUnrollLoop
    ApproximateLoopSize
      collectEphemeralValues
      /* Use collected ephemeral values */
    computeUnrollCount
      analyzeLoopUnrollCost
        /* Bail out from the analysis if loop contains CallInst */

This patch moves collection of the ephemeral values to the tryToUnrollLoop
function and passes the collected values into both ApproximateLoopsize (as
before) and additionally starts using them in analyzeLoopUnrollCost:

  tryToUnrollLoop
    collectEphemeralValues
    ApproximateLoopSize(EphValues)
      /* Use EphValues */
    computeUnrollCount(EphValues)
      analyzeLoopUnrollCost(EphValues)
        /* Ignore ephemeral values - they don't contribute to the final cost */
        /* Bail out from the analysis if loop contains CallInst */

Reviewers: mzolotukhin, evstupac, sanjoy

Reviewed By: evstupac

Subscribers: llvm-commits

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

llvm-svn: 327617

6 years ago[ELF] - Fix build bot after rL327612.
George Rimar [Thu, 15 Mar 2018 09:40:25 +0000 (09:40 +0000)]
[ELF] - Fix build bot after rL327612.

Missed this one.

llvm-svn: 327616

6 years ago[SCEV][NFC] Remove TBB, FBB parameters from exit limit computations
Max Kazantsev [Thu, 15 Mar 2018 09:38:00 +0000 (09:38 +0000)]
[SCEV][NFC] Remove TBB, FBB parameters from exit limit computations

Methods `computeExitLimitFromCondCached` and `computeExitLimitFromCondImpl` take
true and false branches as parameters and only use them for asserts and for identifying
whether true/false branch belongs to the loop (which can be done once earlier). This fact
complicates generalization of exit limit computation logic on guards because the guards
don't have blocks to which they go in case of failure explicitly.

The motivation of this patch is that currently this part of SCEV knows nothing about guards
and only works with explicit branches. As result, it fails to prove that a loop

  for (i = 0; i < 100; i++)
    guard(i < 10);

exits after 10th iteration, while in the equivalent example

  for (i = 0; i < 100; i++)
    if (i >= 10) break;

SCEV easily proves this fact. We are going to change it in near future, and this is why
we need to make these methods operate on more abstract level.

This patch refactors this code to get rid of these parameters as meaningless and prepare
ground for teaching these methods to work with guards as well as they work with explicit
branching instructions.

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

llvm-svn: 327615

6 years ago[ELF] - Simplify test case. NFCI.
George Rimar [Thu, 15 Mar 2018 09:26:08 +0000 (09:26 +0000)]
[ELF] - Simplify test case. NFCI.

llvm-svn: 327614

6 years ago[ELF] - Fix build bot after rL327612.
George Rimar [Thu, 15 Mar 2018 09:24:51 +0000 (09:24 +0000)]
[ELF] - Fix build bot after rL327612.

Error was:
error: field 'Size' will be initialized after field 'CommandString' [-Werror,-Wreorder]

llvm-svn: 327613

6 years ago[ELF] - Show data and assignment commands in the map file.
George Rimar [Thu, 15 Mar 2018 09:16:40 +0000 (09:16 +0000)]
[ELF] - Show data and assignment commands in the map file.

Patch teaches LLD to print BYTE/SHORT/LONG/QUAD and
location move commands to the map file.

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

llvm-svn: 327612

6 years ago@skipUnlessDarwin TestTargetSourceMap
Pavel Labath [Thu, 15 Mar 2018 09:16:15 +0000 (09:16 +0000)]
@skipUnlessDarwin TestTargetSourceMap

Our MachO parser works only on darwin.

llvm-svn: 327611

6 years ago[clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name...
Alexander Kornienko [Thu, 15 Mar 2018 08:27:42 +0000 (08:27 +0000)]
[clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name=UnusedRAIICheck

llvm-svn: 327610

6 years agoFixed filename in a comment. NFC
Alexander Kornienko [Thu, 15 Mar 2018 08:26:58 +0000 (08:26 +0000)]
Fixed filename in a comment. NFC

llvm-svn: 327609

6 years ago[clang-tidy] rename_check.py misc-sizeof-container bugprone-sizeof-container
Alexander Kornienko [Thu, 15 Mar 2018 08:26:47 +0000 (08:26 +0000)]
[clang-tidy] rename_check.py misc-sizeof-container bugprone-sizeof-container

llvm-svn: 327608

6 years ago[clang-tidy] rename_check.py misc-sizeof-expression bugprone-sizeof-expression
Alexander Kornienko [Thu, 15 Mar 2018 08:26:19 +0000 (08:26 +0000)]
[clang-tidy] rename_check.py misc-sizeof-expression bugprone-sizeof-expression

llvm-svn: 327607

6 years ago[clang-tidy] rename_check.py {misc,bugprone}-macro-parentheses
Alexander Kornienko [Thu, 15 Mar 2018 08:25:39 +0000 (08:25 +0000)]
[clang-tidy] rename_check.py {misc,bugprone}-macro-parentheses

llvm-svn: 327606

6 years ago[X86] Add test cases for 512-bit addsub from build_vector.
Craig Topper [Thu, 15 Mar 2018 06:49:01 +0000 (06:49 +0000)]
[X86] Add test cases for 512-bit addsub from build_vector.

There is no 512 bit addsub instruction, but we partially match it handle fmaddsub matching. We explicitly bail out for 512 bit vectors after failing the fmaddsub match, but we had no test coverage for that bail out.

We might want to consider splitting and using 256 bit instructions instead of the long sequence seen here.

llvm-svn: 327605

6 years ago[X86] Add support for matching FMSUBADD from build_vector.
Craig Topper [Thu, 15 Mar 2018 06:14:55 +0000 (06:14 +0000)]
[X86] Add support for matching FMSUBADD from build_vector.

llvm-svn: 327604

6 years ago[X86] Remove old TODO. We have coverage for this now.
Craig Topper [Thu, 15 Mar 2018 06:14:53 +0000 (06:14 +0000)]
[X86] Remove old TODO. We have coverage for this now.

Coverage was added in r320950.

llvm-svn: 327603

6 years ago[X86] Use MVT in a couple places where we know the type is legal.
Craig Topper [Thu, 15 Mar 2018 06:14:51 +0000 (06:14 +0000)]
[X86] Use MVT in a couple places where we know the type is legal.

llvm-svn: 327602

6 years ago[DebugInfo] Add a new method IPDBSession::findLineNumbersBySectOffset
Aaron Smith [Thu, 15 Mar 2018 06:04:51 +0000 (06:04 +0000)]
[DebugInfo] Add a new method IPDBSession::findLineNumbersBySectOffset

Summary:
Some PDB symbols do not have a valid VA or RVA but have Addr by Section and Offset. For example, a variable in thread-local storage has the following properties:

     get_addressOffset: 0
     get_addressSection: 5
     get_lexicalParentId: 2
     get_name: g_tls
     get_symIndexId: 12
     get_typeId: 4
     get_dataKind: 6
     get_symTag: 7
     get_locationType: 2

This change provides a new method to locate line numbers by Section and Offset from those symbols.

Reviewers: zturner, rnk, llvm-commits

Subscribers: asmith, JDevlieghere

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

llvm-svn: 327601

6 years agoFix a bug in "target.source-map" where we would resolve unmapped paths incorrectly
Greg Clayton [Thu, 15 Mar 2018 05:13:15 +0000 (05:13 +0000)]
Fix a bug in "target.source-map" where we would resolve unmapped paths incorrectly

When using:

(lldb) settings set target.source-map ./ /path/to/source
LLDB would fail to set a source file and line breakpoint with:

(lldb) breakpoint set --file /path/to/source/main.c --line 2
Because code in the target was undoing the remapping of "/path/to/source/main.c" to "./main.c" and then it would resolve this path, which would append the current working directory to the path. We don't want to resolve paths that we unmap.

Test case added.

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

llvm-svn: 327600

6 years ago[PowerPC][NFC] formatting-only fix
Lei Huang [Thu, 15 Mar 2018 03:06:44 +0000 (03:06 +0000)]
[PowerPC][NFC] formatting-only fix

llvm-svn: 327599

6 years agoRefactoring code around move/copy initialization. NFC.
Richard Trieu [Thu, 15 Mar 2018 03:00:55 +0000 (03:00 +0000)]
Refactoring code around move/copy initialization.  NFC.

Use an enum parameter instead of a bool for more control on how the copy elision
functions work.  Extract the move initialization code from the move or copy
initialization block.

Patch by: Arthur O'Dwyer

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

llvm-svn: 327598

6 years agoRemove unused variable; NFC
George Burgess IV [Thu, 15 Mar 2018 02:58:36 +0000 (02:58 +0000)]
Remove unused variable; NFC

llvm-svn: 327597

6 years ago[sanitizer] Fix off type in mmap64 interceptor
Vitaly Buka [Thu, 15 Mar 2018 01:13:29 +0000 (01:13 +0000)]
[sanitizer] Fix off type in mmap64 interceptor

llvm-svn: 327596

6 years ago[test] cmake: Ensure liblldb builds before tests run
Vedant Kumar [Thu, 15 Mar 2018 01:09:13 +0000 (01:09 +0000)]
[test] cmake: Ensure liblldb builds before tests run

Without liblldb as a test dependency, tests which link it in from an
lldb framework (via Base.buildDriver()) won't work.

llvm-svn: 327595

6 years ago[ORC] Re-apply r327566 with a fix for test-global-ctors.ll.
Lang Hames [Thu, 15 Mar 2018 00:30:14 +0000 (00:30 +0000)]
[ORC] Re-apply r327566 with a fix for test-global-ctors.ll.

Also clang-formats the patch, which I should have done the first time around.

llvm-svn: 327594

6 years ago[CFG] Allow CallExpr's to be looked up in CFG's
Richard Trieu [Thu, 15 Mar 2018 00:09:26 +0000 (00:09 +0000)]
[CFG] Allow CallExpr's to be looked up in CFG's

r327343 changed the handling for CallExpr in a CFG, which prevented lookups for
CallExpr while other Stmt kinds still worked.  This change carries over the
necessary bits from Stmt function to CallExpr function.

llvm-svn: 327593

6 years ago[Dictionary] Rewrite the test added in r327587 as an inline test.
Davide Italiano [Thu, 15 Mar 2018 00:07:05 +0000 (00:07 +0000)]
[Dictionary] Rewrite the test added in r327587 as an inline test.

Until we have a better story for putting commands and check lines
in the same file (they're currently ignored), it seems that inline
tests are actually more concise and easier to understand.
Too bad we have still some python boilerplate, but that's not
really substantial so we can live with it.

Thanks to Fred for pointing out and Jim for explaining me how
to use the inline test format.

<rdar://problem/34806516>

llvm-svn: 327592

6 years ago[analyzer] Explicitly set an -std level for the analyzer test.
George Karpenkov [Wed, 14 Mar 2018 23:50:18 +0000 (23:50 +0000)]
[analyzer] Explicitly set an -std level for the analyzer test.

llvm-svn: 327591

6 years ago[clang-tidy] Add Zircon module to clang-tidy
Julie Hockett [Wed, 14 Mar 2018 23:47:50 +0000 (23:47 +0000)]
[clang-tidy] Add Zircon module to clang-tidy

Adding a Zircon module to clang-tidy for checks specific to the Zircon
kernel, and adding a checker to fuchsia-zx (for zircon) to flag instances
where specific objects are temporarily created.

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

llvm-svn: 327590

6 years ago[CleanUp] Remove NumInstructions field from LoopVectorizer's RegisterUsage struct.
Matt Davis [Wed, 14 Mar 2018 23:30:31 +0000 (23:30 +0000)]
[CleanUp] Remove NumInstructions field from LoopVectorizer's RegisterUsage struct.

Summary:
This variable is largely going unused; aside from reporting number of instructions for in DEBUG builds.

The only use of NumInstructions is in debug output to represent the LoopSize.  That value can be can be misleading as it also includes metadata instructions (e.g., DBG_VALUE) which have no real impact.  If we do choose to keep this around, we probably should guard it by a DEBUG macro, as it's not used in production builds.

Reviewers: majnemer, congh, rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin

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

llvm-svn: 327589

6 years ago[X86][Btver2] Add support for multiple pipelines stages for fpu schedules. NFCI.
Simon Pilgrim [Wed, 14 Mar 2018 23:12:09 +0000 (23:12 +0000)]
[X86][Btver2] Add support for multiple pipelines stages for fpu schedules. NFCI.

This allows us to use JWriteResFpuPair for complex schedule classes as well as single pipe instructions.

llvm-svn: 327588

6 years ago[DataFormatters] Implement summary for __NSDictionary0.
Davide Italiano [Wed, 14 Mar 2018 23:09:36 +0000 (23:09 +0000)]
[DataFormatters] Implement summary for __NSDictionary0.

Before the patch:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x0000000100304420

After:

(lldb) frame var emptyDictionary
(__NSDictionary0 *) emptyDictionary = 0x0000000100304420 0 key/value pairs

There's nothing much else we can do, as this is always empty by
definition.

<rdar://problem/34806516>

llvm-svn: 327587