platform/upstream/llvm.git
6 years ago[SelectionDAG] enhance vector demanded elements to look at a vector select condition...
Sanjay Patel [Sun, 9 Sep 2018 14:13:22 +0000 (14:13 +0000)]
[SelectionDAG] enhance vector demanded elements to look at a vector select condition operand

This is the DAG equivalent of D51433.
If we know we're not using all vector lanes, use that knowledge to potentially simplify a vselect condition.

The reduction/horizontal tests show that we are eliminating AVX1 operations on the upper half of 256-bit
vectors because we don't need those anyway.
I'm not sure what the pr34592 test is showing. That's run with -O0; is SimplifyDemandedVectorElts supposed
to be running there?

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

llvm-svn: 341762

6 years agoFix build bots after a mistake in r341760
Hamza Sood [Sun, 9 Sep 2018 13:12:53 +0000 (13:12 +0000)]
Fix build bots after a mistake in r341760

llvm-svn: 341761

6 years ago[Tooling] Improve handling of CL-style options
Hamza Sood [Sun, 9 Sep 2018 12:06:35 +0000 (12:06 +0000)]
[Tooling] Improve handling of CL-style options

This patch fixes the handling of clang-cl options in InterpolatingCompilationDatabase.
They were previously ignored completely, which led to a lot of bugs:

Additional options were being added with the wrong syntax. E.g. a file was
specified as C++ by adding -x c++, which causes an error in CL mode.

The args were parsed and then rendered, which means that the aliasing information
was lost. E.g. /W4 was rendered to -Wall, which in CL mode means -Weverything.

CL options were ignored when checking things like -std=, so a lot of logic was
being bypassed.

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

llvm-svn: 341760

6 years agoSpeculative fix for NetBSD bot for r341758
Pavel Labath [Sun, 9 Sep 2018 08:42:00 +0000 (08:42 +0000)]
Speculative fix for NetBSD bot for r341758

llvm-svn: 341759

6 years agoRe-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"
Pavel Labath [Sun, 9 Sep 2018 06:01:12 +0000 (06:01 +0000)]
Re-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"

This recommits r341487, which was reverted due to failing tests with
clang. It turned out I had incorrectly expected that the literal arrays
passed to ArrayRef constructor will have static (permanent) storage.
This was only the case with gcc, while clang was constructing them on
stack, leading to dangling pointers when the function returns.

The fix is to explicitly assign static storage duration to the opcode
arrays.

llvm-svn: 341758

6 years agoRevert r341754.
Akira Hatanaka [Sun, 9 Sep 2018 05:22:49 +0000 (05:22 +0000)]
Revert r341754.

The commit broke a couple of bots:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12347
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/7310

llvm-svn: 341757

6 years ago[Parser] Remove an unnecessary `mutable`
Fangrui Song [Sun, 9 Sep 2018 01:54:18 +0000 (01:54 +0000)]
[Parser] Remove an unnecessary `mutable`

llvm-svn: 341756

6 years agoms: Insert $$Z in mangling between directly consecutive parameter packs.
Nico Weber [Sat, 8 Sep 2018 20:58:39 +0000 (20:58 +0000)]
ms: Insert $$Z in mangling between directly consecutive parameter packs.

Fixes PR38783.
Differential Revision: https://reviews.llvm.org/D51784

llvm-svn: 341755

6 years agoDistinguish `__block` variables that are captured by escaping blocks
Akira Hatanaka [Sat, 8 Sep 2018 20:03:00 +0000 (20:03 +0000)]
Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

rdar://problem/39352313

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

llvm-svn: 341754

6 years ago[X86] Create paddus/psubus from narrower vectors with i8/i16 element types.
Craig Topper [Sat, 8 Sep 2018 19:32:58 +0000 (19:32 +0000)]
[X86] Create paddus/psubus from narrower vectors with i8/i16 element types.

Summary:
This patch allows vectors with a power of 2 number of elements and i8/i16 element type to select paddus/psubus instructions. ReplaceNodeResults has been updated to custom widen these operations up to 128 bits like we already do for PAVG.

Another step towards fixing PR38691

Reviewers: RKSimon, spatel

Reviewed By: RKSimon, spatel

Subscribers: llvm-commits

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

llvm-svn: 341753

6 years ago[X86] Mark the ADCX and ADOX instruction as commutable.
Craig Topper [Sat, 8 Sep 2018 18:47:56 +0000 (18:47 +0000)]
[X86] Mark the ADCX and ADOX instruction as commutable.

llvm-svn: 341752

6 years ago[X86] Add test cases for commuting ADCX/ADOX instruction to avoid copies.
Craig Topper [Sat, 8 Sep 2018 18:47:54 +0000 (18:47 +0000)]
[X86] Add test cases for commuting ADCX/ADOX instruction to avoid copies.

This is a MIR test so we can test ADOX which we have no isel patterns for. I also plan to remove ADCX isel patterns in the near future so this will help maintain coverage.

llvm-svn: 341751

6 years agoRevert "NFC: use bit_cast more in AArch64AddressingModes"
JF Bastien [Sat, 8 Sep 2018 16:50:56 +0000 (16:50 +0000)]
Revert "NFC: use bit_cast more in AArch64AddressingModes"

It seems some bots think std::array is either not trivially-copyable, or isn't
the right size.

llvm-svn: 341750

6 years agoNFC: use bit_cast more in AArch64AddressingModes
JF Bastien [Sat, 8 Sep 2018 16:43:49 +0000 (16:43 +0000)]
NFC: use bit_cast more in AArch64AddressingModes

llvm-svn: 341749

6 years ago[libomptarget-nvptx] Remove last mentions of __kmpc_print_*
Jonas Hahnfeld [Sat, 8 Sep 2018 12:10:19 +0000 (12:10 +0000)]
[libomptarget-nvptx] Remove last mentions of __kmpc_print_*

Their implementation was removed during review, delete their
prototype declarations.

llvm-svn: 341748

6 years agoRevert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"
Pavel Labath [Sat, 8 Sep 2018 10:33:14 +0000 (10:33 +0000)]
Revert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"

This reverts commit r341487. Jan Kratochvil reports it breaks LLDB when
compiling with clang.

llvm-svn: 341747

6 years agoCheck if a terminal supports colors on Windows properly
David Bolvansky [Sat, 8 Sep 2018 07:15:56 +0000 (07:15 +0000)]
Check if a terminal supports colors on Windows properly

Summary:
Previously we SetUseColor(true) wrongly when output was not a terminal so it broken some (not public) bots.

Thanks for issue report, @stella.stamenova

Reviewers: stella.stamenova, zturner

Reviewed By: stella.stamenova

Subscribers: abidh, lldb-commits, stella.stamenova

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

llvm-svn: 341746

6 years ago[X86] Add commuted isel pattern for the load form of ADCX instructions.
Craig Topper [Sat, 8 Sep 2018 06:31:43 +0000 (06:31 +0000)]
[X86] Add commuted isel pattern for the load form of ADCX instructions.

This prevents the legacy ADC instruction from being favored over ADCX when the load is in the operand 0.

llvm-svn: 341745

6 years ago[X86] Add load folding test cases for the addcarryx intrinsic.
Craig Topper [Sat, 8 Sep 2018 06:31:41 +0000 (06:31 +0000)]
[X86] Add load folding test cases for the addcarryx intrinsic.

We are currently only able to fold a load in operand 1 to ADCX. A load in operand 0 will use the legacy ADC instruction.

Ultimately I want to remove isel support for ADCX, but first I'm going to fix the shortcomings I know of so I can write proper MIR tests to maintain coverage later.

llvm-svn: 341744

6 years ago[X86] Add stack folding MIR test for ADCX/ADOX.
Craig Topper [Sat, 8 Sep 2018 05:08:18 +0000 (05:08 +0000)]
[X86] Add stack folding MIR test for ADCX/ADOX.

We currently have no way to isel ADOX and I plan to remove isel patterns for ADCX. This test will ensure we still have stack folding support for these instructions if we need them in the future.

llvm-svn: 341743

6 years agoFix typo in previous commit
JF Bastien [Sat, 8 Sep 2018 04:07:41 +0000 (04:07 +0000)]
Fix typo in previous commit

llvm-svn: 341742

6 years agoADT: add <bit> header, implement C++20 bit_cast, use
JF Bastien [Sat, 8 Sep 2018 03:55:25 +0000 (03:55 +0000)]
ADT: add <bit> header, implement C++20 bit_cast, use

Summary: I saw a few places that were punning through a union of FP and integer, and that made me sad. Luckily, C++20 adds bit_cast for exactly that purpose. Implement our own version in ADT (without constexpr, leaving us a bit sad), and use it in the few places my grep-fu found silly union punning.

This was originally committed as r341728 and reverted in r341730.

Reviewers: javed.absar, steven_wu, srhines

Subscribers: dexonsmith, llvm-commits

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

llvm-svn: 341741

6 years agoFix typos. NFC
Fangrui Song [Sat, 8 Sep 2018 02:04:20 +0000 (02:04 +0000)]
Fix typos. NFC

llvm-svn: 341740

6 years ago[hwasan] rename two .cc tests into .c
Kostya Serebryany [Sat, 8 Sep 2018 01:27:10 +0000 (01:27 +0000)]
[hwasan] rename two .cc tests into .c

llvm-svn: 341739

6 years ago[hwasan] Disable print-memory-usage-android test.
Evgeniy Stepanov [Sat, 8 Sep 2018 01:16:47 +0000 (01:16 +0000)]
[hwasan] Disable print-memory-usage-android test.

Requires a rooted device => fails on sanitizer-x86_64-linux-android bot.

llvm-svn: 341738

6 years agoRemove addBlockByrefAddress(), it is dead code as far as clang is concerned.
Adrian Prantl [Sat, 8 Sep 2018 00:21:55 +0000 (00:21 +0000)]
Remove addBlockByrefAddress(), it is dead code as far as clang is concerned.

This patch removes addBlockByrefAddress(), it is dead code as far as
clang is concerned: Every byref block capture is emitted with a
complex expression that is equivalent to what this function does.

rdar://problem/31629055

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

llvm-svn: 341737

6 years agoSwitch to using a reserved identifier for this internal compiler-rt function.
Richard Smith [Sat, 8 Sep 2018 00:17:37 +0000 (00:17 +0000)]
Switch to using a reserved identifier for this internal compiler-rt function.

llvm-svn: 341736

6 years ago[hwasan] Export memory stats through /proc/$PID/maps.
Evgeniy Stepanov [Sat, 8 Sep 2018 00:11:12 +0000 (00:11 +0000)]
[hwasan] Export memory stats through /proc/$PID/maps.

Adds a line to /proc/$PID/maps with more or less up-to-date memory
stats of the process.

llvm-svn: 341735

6 years agoDo not use optimized atomic libcalls for misaligned atomics.
Richard Smith [Fri, 7 Sep 2018 23:57:54 +0000 (23:57 +0000)]
Do not use optimized atomic libcalls for misaligned atomics.

Summary:
The optimized (__atomic_foo_<n>) libcalls assume that the atomic object
is properly aligned, so should never be called on an underaligned
object.

This addresses one of several problems identified in PR38846.

Reviewers: jyknight, t.p.northover

Subscribers: jfb, cfe-commits

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

llvm-svn: 341734

6 years ago[MemorySSA] Relax verification of clobbering accesses.
Alina Sbirlea [Fri, 7 Sep 2018 23:51:41 +0000 (23:51 +0000)]
[MemorySSA] Relax verification of clobbering accesses.

llvm-svn: 341733

6 years ago[XCodeproj] Remove extra whitespace in SBAPI path.
Davide Italiano [Fri, 7 Sep 2018 23:49:05 +0000 (23:49 +0000)]
[XCodeproj] Remove extra whitespace in SBAPI path.

llvm-svn: 341732

6 years agoFix some of the PDB tests.
Zachary Turner [Fri, 7 Sep 2018 23:36:08 +0000 (23:36 +0000)]
Fix some of the PDB tests.

They were unintentionally calling DIA directly, which requires
Windows.  We need to pass the -native flag, and this then required
fixing up one or two tests.

llvm-svn: 341731

6 years agoRevert "ADT: add <bit> header, implement C++20 bit_cast, use"
JF Bastien [Fri, 7 Sep 2018 23:23:47 +0000 (23:23 +0000)]
Revert "ADT: add <bit> header, implement C++20 bit_cast, use"

Bots sad. Looks like missing std::is_trivially_copyable.

llvm-svn: 341730

6 years ago[PDB] Support pointer types in the native reader.
Zachary Turner [Fri, 7 Sep 2018 23:21:33 +0000 (23:21 +0000)]
[PDB] Support pointer types in the native reader.

In order to start testing this, I've added a new mode to
llvm-pdbutil which is only really useful for writing tests.
It just dumps the value of raw fields in record format.
This isn't really ideal and it won't allow us to test some
important cases, but it's better than nothing for now.

llvm-svn: 341729

6 years agoADT: add <bit> header, implement C++20 bit_cast, use
JF Bastien [Fri, 7 Sep 2018 23:08:26 +0000 (23:08 +0000)]
ADT: add <bit> header, implement C++20 bit_cast, use

Summary: I saw a few places that were punning through a union of FP and integer, and that made me sad. Luckily, C++20 adds bit_cast for exactly that purpose. Implement our own version in ADT (without constexpr, leaving us a bit sad), and use it in the few places my grep-fu found silly union punning.

Reviewers: javed.absar

Subscribers: dexonsmith, llvm-commits

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

llvm-svn: 341728

6 years ago[COFF] Implement llvm.global_ctors priorities for MSVC COFF targets
Reid Kleckner [Fri, 7 Sep 2018 23:07:55 +0000 (23:07 +0000)]
[COFF] Implement llvm.global_ctors priorities for MSVC COFF targets

Summary:
MSVC and LLD sort sections ASCII-betically, so we need to use section
names that sort between .CRT$XCA (the start) and .CRT$XCU (the default
priority).

In the general case, use .CRT$XCT12345 as the section name, and let the
linker sort the zero-padded digits.

Users with low priorities typically want to initialize as early as
possible, so use .CRT$XCA00199 for prioties less than 200. This number
is arbitrary.

Implements PR38552.

Reviewers: majnemer, mstorsjo

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 341727

6 years ago[SimplifyIndVar] Avoid generating truncate instructions with non-hoisted Laod operand.
Abderrazek Zaafrani [Fri, 7 Sep 2018 22:41:57 +0000 (22:41 +0000)]
[SimplifyIndVar] Avoid generating truncate instructions with non-hoisted Laod operand.

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

llvm-svn: 341726

6 years agoSet cost of invariant group intrinsics to 0
Piotr Padlewski [Fri, 7 Sep 2018 22:29:48 +0000 (22:29 +0000)]
Set cost of invariant group intrinsics to 0

Summary:
Like with other similar intrinsics, presense of strip or
launder.invariant.group should not change the result of inlining cost.
This is because they are just markers and do not perform any computation.

Reviewers: amharc, rsmith, reames, kuhar

Subscribers: eraman, llvm-commits

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

llvm-svn: 341725

6 years ago[analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the...
George Karpenkov [Fri, 7 Sep 2018 22:13:35 +0000 (22:13 +0000)]
[analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the class

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

llvm-svn: 341724

6 years ago[analyzer] [NFC] Use StringRef when returning a large string literal in HTMLDiagnostics
George Karpenkov [Fri, 7 Sep 2018 22:13:15 +0000 (22:13 +0000)]
[analyzer] [NFC] Use StringRef when returning a large string literal in HTMLDiagnostics

(NB: could be a clang-tidy / analyzer check)

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

llvm-svn: 341723

6 years ago[analyzer] Remove the "postponed" hack, deal with derived symbols using an extra map
George Karpenkov [Fri, 7 Sep 2018 22:07:57 +0000 (22:07 +0000)]
[analyzer] Remove the "postponed" hack, deal with derived symbols using an extra map

The "derived" symbols indicate children fields of a larger symbol.
As parents do not have pointers to their children, the garbage
collection algorithm the analyzer currently uses adds such symbols into
a "postponed" category, and then keeps running through the worklist
until the fixed point is reached.

The current patch rectifies that by instead using a helper map which
stores pointers from parents to children, so that no fixed point
calculation is necessary.

The current patch yields ~5% improvement in running time on sqlite.

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

llvm-svn: 341722

6 years ago[clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck
Ben Hamilton [Fri, 7 Sep 2018 22:03:48 +0000 (22:03 +0000)]
[clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck

Summary: This adds a few common acronyms we found were missing from PropertyDeclarationCheck.

Reviewers: Wizard, hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

llvm-svn: 341721

6 years ago[clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck
Ben Hamilton [Fri, 7 Sep 2018 22:02:38 +0000 (22:02 +0000)]
[clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck

Summary: This adds a few common acronyms we found were missing from PropertyDeclarationCheck.

Reviewers: Wizard, hokein

Subscribers: cfe-commits

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

llvm-svn: 341720

6 years agoRevert "Revert "Revert "Revert "[analyzer] Add coverage information to plist output...
George Karpenkov [Fri, 7 Sep 2018 21:58:24 +0000 (21:58 +0000)]
Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests""""

This reverts commit 2f5d71d9fa135be86bb299e7d773036e50bf1df6.

Hopefully fixing tests on Windows.

llvm-svn: 341719

6 years ago[WebAssembly] v8x16.shuffle
Thomas Lively [Fri, 7 Sep 2018 21:54:46 +0000 (21:54 +0000)]
[WebAssembly] v8x16.shuffle

Summary:
Since the shuffle mask is not exposed as an operand in the native ISel
DAG, create a new WebAssembly ISD node exposing the mask. The mask is
lowered as sixteen immediate byte indices no matter what type the
original vector shuffle was operating on.

This CL depends on D51656

Reviewers: aheejin, dschuff

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

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

llvm-svn: 341718

6 years ago[benchmark] Fix flags used to compile benchmark library with clang-cl
Reid Kleckner [Fri, 7 Sep 2018 21:47:25 +0000 (21:47 +0000)]
[benchmark] Fix flags used to compile benchmark library with clang-cl

`MSVC` is true for clang-cl, but `"${CMAKE_CXX_COMPILER_ID}" STREQUAL
"MSVC"` is false, so we would enable -Wall, which means -Weverything
with clang-cl, and we get tons of undesired warnings.

Use the simpler condition to fix things.

llvm-svn: 341717

6 years ago[benchmark] Re-enable benchmarks on all platforms including Windows
Reid Kleckner [Fri, 7 Sep 2018 21:47:00 +0000 (21:47 +0000)]
[benchmark] Re-enable benchmarks on all platforms including Windows

The assertion in MCCodeView.cpp was resolved in r340878.

This reverts both r340905 and r340836, making benchmarks build by
default everywhere.

llvm-svn: 341716

6 years ago[InstCombine][x86] add tests for possible blendv transform (PR38814); NFC
Sanjay Patel [Fri, 7 Sep 2018 21:40:41 +0000 (21:40 +0000)]
[InstCombine][x86] add tests for possible blendv transform (PR38814); NFC

llvm-svn: 341715

6 years ago[Disassembler] Run ARM-specific tests only if the ARM backend is built.
Davide Italiano [Fri, 7 Sep 2018 21:36:21 +0000 (21:36 +0000)]
[Disassembler] Run ARM-specific tests only if the ARM backend is built.

<rdar://problem/44239070>

llvm-svn: 341714

6 years ago[AST] Generalize argument specific aliasing
Philip Reames [Fri, 7 Sep 2018 21:36:11 +0000 (21:36 +0000)]
[AST] Generalize argument specific aliasing

AliasSetTracker has special case handling for memset, memcpy and memmove which pre-existed argmemonly on functions and readonly and writeonly on arguments. This patch generalizes it using the AA infrastructure to any call correctly annotated.

The motivation here is to cut down on confusion, not performance per se. For most instructions, there is a direct mapping to alias set. However, this is not guaranteed by the interface and was not in fact true for these three intrinsics *and only these three intrinsics*. I kept getting myself confused about this invariant, so I figured it would be good to clearly distinguish between a instructions and alias sets. Calls happened to be an easy target.

The nice side effect is that custom implementations of memset/memcpy/memmove - including wrappers discovered by IPO - can now be optimized the same as builts by LICM.

Note: The actual removal of the memset/memtransfer specific handling will happen in a follow on NFC patch.  It was originally part of this one, but separate for ease of review and rebase.

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

llvm-svn: 341713

6 years ago[codeview] Add .cv_string directive for testing purposes
Reid Kleckner [Fri, 7 Sep 2018 21:30:52 +0000 (21:30 +0000)]
[codeview] Add .cv_string directive for testing purposes

The main use case for this directive is to allow assembly writers to
write their own FPO data strings without going through the .cv_fpo*
directive family.

I'm experimenting with different RPN programs to fix PR38857, and I
figured I should go ahead and make this directive permanent.

llvm-svn: 341712

6 years ago[X86] Add codegen tests for narrow PADDUS/PSUBUS patterns for PR38691.
Craig Topper [Fri, 7 Sep 2018 21:28:46 +0000 (21:28 +0000)]
[X86] Add codegen tests for narrow PADDUS/PSUBUS patterns for PR38691.

llvm-svn: 341711

6 years agoMake -Watomic-alignment say whether the atomic operation was oversized
Richard Smith [Fri, 7 Sep 2018 21:24:27 +0000 (21:24 +0000)]
Make -Watomic-alignment say whether the atomic operation was oversized
or misaligned.

llvm-svn: 341710

6 years ago[MemorySSA] Update MemoryPhi wiring for block splitting to consider if identical...
Alina Sbirlea [Fri, 7 Sep 2018 21:14:48 +0000 (21:14 +0000)]
[MemorySSA] Update MemoryPhi wiring for block splitting to consider if identical edges were merged.

Summary:
Block splitting is done with either identical edges being merged, or not.
Only critical edges can be split without merging identical edges based on an option.
Teach the memoryssa updater to take this into account: for the same edge between two blocks only move one entry from the Phi in Old to the new Phi in New.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 341709

6 years ago[InstCombine] narrow vector select with padded condition and extracted result (PR38691)
Sanjay Patel [Fri, 7 Sep 2018 21:03:34 +0000 (21:03 +0000)]
[InstCombine] narrow vector select with padded condition and extracted result (PR38691)

shuf (sel (shuf NarrowCond, undef, WideMask), X, Y), undef, NarrowMask) -->
sel NarrowCond, (shuf X, undef, NarrowMask), (shuf Y, undef, NarrowMask)

The motivating case from:
https://bugs.llvm.org/show_bug.cgi?id=38691
...is the last regression test. In that case, we're just left with the narrow select.

Note that if we do create new shuffles, they use the existing extraction identity mask,
so there's no danger that this transform creates arbitrary shuffles.

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

llvm-svn: 341708

6 years ago[WebAssembly] Change SIMD lane indices to vec_i8imm_op
Thomas Lively [Fri, 7 Sep 2018 20:59:50 +0000 (20:59 +0000)]
[WebAssembly] Change SIMD lane indices to vec_i8imm_op

Summary: To explicitly opt out of LEB encoding for these immediates.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 341707

6 years ago[AArch64] Support reserving x1-7 registers.
Nick Desaulniers [Fri, 7 Sep 2018 20:58:57 +0000 (20:58 +0000)]
[AArch64] Support reserving x1-7 registers.

Summary:
Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS in Linux kernel. This change adds support for reserving registers x1 through x7.

Reviewers: javed.absar, phosek, srhines, nickdesaulniers, efriedma

Reviewed By: nickdesaulniers, efriedma

Subscribers: niravd, jfb, manojgupta, nickdesaulniers, jyknight, efriedma, kristof.beyls, llvm-commits

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

llvm-svn: 341706

6 years ago[X86] Don't create ZERO_EXTEND_INREG/SIGN_EXTEND_INREG for v1iX vectors.
Craig Topper [Fri, 7 Sep 2018 20:56:03 +0000 (20:56 +0000)]
[X86] Don't create ZERO_EXTEND_INREG/SIGN_EXTEND_INREG for v1iX vectors.

The generic type legalizer will scalarize vXi1 instructions getting rid of the vector entirely. Creating wider vector instructions is just going to prevent that.

llvm-svn: 341705

6 years ago[X86] Don't create X86ISD::AVG nodes from v1iX vectors.
Craig Topper [Fri, 7 Sep 2018 20:56:01 +0000 (20:56 +0000)]
[X86] Don't create X86ISD::AVG nodes from v1iX vectors.

The type legalizer will try to scalarize this and fail.

It looks like there's some other v1iX oddities out there too since we still generated some vector instructions.

llvm-svn: 341704

6 years ago[OpenMP] Update copyright to 2018
Jonathan Peyton [Fri, 7 Sep 2018 20:33:35 +0000 (20:33 +0000)]
[OpenMP] Update copyright to 2018

Better late than never

llvm-svn: 341703

6 years ago[PGO] Fix some style issue of ControlHeightReduction
Fangrui Song [Fri, 7 Sep 2018 20:23:15 +0000 (20:23 +0000)]
[PGO] Fix some style issue of ControlHeightReduction

Reviewers: yamauchi

Reviewed By: yamauchi

Subscribers: llvm-commits

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

llvm-svn: 341702

6 years ago[CMake] Fix LLVM_ENABLE_LTO option on Windows
Alexandre Ganea [Fri, 7 Sep 2018 20:07:36 +0000 (20:07 +0000)]
[CMake] Fix LLVM_ENABLE_LTO option on Windows

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

llvm-svn: 341701

6 years agoPR38870: Add warning for zero-width unicode characters appearing in
Richard Smith [Fri, 7 Sep 2018 19:25:39 +0000 (19:25 +0000)]
PR38870: Add warning for zero-width unicode characters appearing in
identifiers.

llvm-svn: 341700

6 years ago[X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out parameter
Craig Topper [Fri, 7 Sep 2018 19:14:24 +0000 (19:14 +0000)]
[X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out parameter

This is the clang side of D51803. The llvm intrinsic now returns two results. So we need to emit an explicit store in IR for the out parameter. This is similar to addcarry/subborrow/rdrand/rdseed.

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

llvm-svn: 341699

6 years ago[X86] Modify the the rdtscp intrinsic to return values instead of taking a pointer...
Craig Topper [Fri, 7 Sep 2018 19:14:15 +0000 (19:14 +0000)]
[X86] Modify the the rdtscp intrinsic to return values instead of taking a pointer argument

Similar to what was recently done for addcarry/subborrow and has been done for rdrand/rdseed for a while. It's better to use two results and an explicit store in IR when the store isn't part of the semantics of the instruction. This allows store->load forwarding to happen in the middle end. Or the store to be removed if its never loaded.

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

llvm-svn: 341698

6 years agowarn_stdlibcxx_not_found: suggest '-stdlib=libc++' instead of '-std'
Alex Lorenz [Fri, 7 Sep 2018 18:59:45 +0000 (18:59 +0000)]
warn_stdlibcxx_not_found: suggest '-stdlib=libc++' instead of '-std'

Addresses first post-commit feedback for r335081 from Nico

llvm-svn: 341697

6 years agoAdd the Disassembler unit test dir.
Jason Molenda [Fri, 7 Sep 2018 18:51:10 +0000 (18:51 +0000)]
Add the Disassembler unit test dir.

llvm-svn: 341696

6 years ago[codeview] Improve readobj FPO dumper and pdbutil register names
Reid Kleckner [Fri, 7 Sep 2018 18:48:27 +0000 (18:48 +0000)]
[codeview] Improve readobj FPO dumper and pdbutil register names

The improved dumping helps me investigate PR38857.

llvm-svn: 341695

6 years ago[OpenMP] Change hint parameter type for critical to uint32_t
Jonathan Peyton [Fri, 7 Sep 2018 18:46:40 +0000 (18:46 +0000)]
[OpenMP] Change hint parameter type for critical to uint32_t

Add atomic hint flags to the enum.
The hint parameter type was changed to uint32_t in __kmpc_critical_with_hint()

Patch by Olga Malysheva

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

llvm-svn: 341694

6 years ago[OpenMP] Synchronization hint constants added to headers
Jonathan Peyton [Fri, 7 Sep 2018 18:45:13 +0000 (18:45 +0000)]
[OpenMP] Synchronization hint constants added to headers

ident flags reserved for atomic hints.
This patch adds omp_sync_hint_t to omp.h and omp_sync_hint_kind to omp_lib.h.
For better maintainability the list of macros for ident flags was replaced with
a enum. The new KMP_IDENT_ATOMIC_HINT_MASK was added to the enum to
support possible future atomic hints.

Also fix omp_lib.h.var to be under 72 chars again after 5.0 OpenMP Memory commit

Patch by Olga Malysheva

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

llvm-svn: 341693

6 years ago[PGO][CHR] Build/warning fix
Hiroshi Yamauchi [Fri, 7 Sep 2018 18:44:53 +0000 (18:44 +0000)]
[PGO][CHR] Build/warning fix

llvm-svn: 341692

6 years ago[RISCV] Fix crash in decoding instruction with unknown floating point rounding mode
Ana Pazos [Fri, 7 Sep 2018 18:43:43 +0000 (18:43 +0000)]
[RISCV] Fix crash in decoding instruction with unknown floating point rounding mode

Summary:
Instead of crashing in printFRMArg, decode and warn about invalid instruction.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
for the RISC-V assembly language.

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb

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

llvm-svn: 341691

6 years agoNFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.
Jim Ingham [Fri, 7 Sep 2018 18:43:04 +0000 (18:43 +0000)]
NFC: Move Searcher::Depth into lldb-enumerations as SearchDepth.

In a subsequent commit, I will need to expose the search depth
to the SB API's, so I'm moving this define into lldb-enumerations
where it will get added to the lldb module.

llvm-svn: 341690

6 years ago[Error] Reintroduce type validation in createFileError()
Alexandre Ganea [Fri, 7 Sep 2018 18:32:59 +0000 (18:32 +0000)]
[Error] Reintroduce type validation in createFileError()

This prevents from using ErrorSuccess as an argument to createFileError().

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

llvm-svn: 341689

6 years ago[llvm-dwp] Clean up tests X86/*.test
Fangrui Song [Fri, 7 Sep 2018 18:29:20 +0000 (18:29 +0000)]
[llvm-dwp] Clean up tests X86/*.test

llvm-svn: 341688

6 years ago[OpenMP] Initial implementation of OMP 5.0 Memory Management routines
Jonathan Peyton [Fri, 7 Sep 2018 18:25:49 +0000 (18:25 +0000)]
[OpenMP] Initial implementation of OMP 5.0 Memory Management routines

Implemented omp_alloc, omp_free, omp_{set,get}_default_allocator entries,
and OMP_ALLOCATOR environment variable.

Added support for HBW memory on Linux if libmemkind.so library is accessible
(dynamic library only, no support for static libraries).
Only used stable API (hbwmalloc) of the memkind library
though we may consider using experimental API in future.

The ICV def-allocator-var is implemented per implicit task similar to
place-partition-var.  In the absence of a requested allocator, the uses the
default allocator.

Predefined allocators (the only ones currently available) are made similar
for C and Fortran, - pointers (long integers) with values 1 to 8.

Patch by Andrey Churbanov

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

llvm-svn: 341687

6 years ago[RISCV] Fix AddressSanitizer heap-buffer-overflow in disassembling
Ana Pazos [Fri, 7 Sep 2018 18:23:19 +0000 (18:23 +0000)]
[RISCV] Fix AddressSanitizer heap-buffer-overflow in disassembling

Summary:
RISCVDisassembler should check number of bytes available before reading them.
Crash noticed when enabling -DLLVM_USE_SANITIZER=Address.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer for the RISC-V assembly language.

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb

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

llvm-svn: 341686

6 years ago[Scalar] Commit the correct patch, forgot `git add`.
Davide Italiano [Fri, 7 Sep 2018 18:22:27 +0000 (18:22 +0000)]
[Scalar] Commit the correct patch, forgot `git add`.

<rdar://problem/44229924>

llvm-svn: 341685

6 years agoNFC: remove magic bool in LoopIdiomRecognize
JF Bastien [Fri, 7 Sep 2018 18:17:59 +0000 (18:17 +0000)]
NFC: remove magic bool in LoopIdiomRecognize

Use an enum class instead.

llvm-svn: 341684

6 years agoAdd input files to the "prepare swig bindings" step.
Jim Ingham [Fri, 7 Sep 2018 18:10:26 +0000 (18:10 +0000)]
Add input files to the "prepare swig bindings" step.

This build phase had no inputs, so you always had to manually
delete LLDBWrapPython.cpp to get it to rebuild.  Add the correct
inputs.

llvm-svn: 341683

6 years ago[Scalar] Fix undefined behaviour when converting double to long.
Davide Italiano [Fri, 7 Sep 2018 18:03:43 +0000 (18:03 +0000)]
[Scalar] Fix undefined behaviour when converting double to long.

This showed up in an Ubsan build of lldb (inside the CFAbsoluteTime
data formatter). As we only care about the bit pattern, we just
round to the nearest double, and truncate to a size that fits
in ulonglong_t.

<rdar://problem/44229924>

llvm-svn: 341682

6 years ago[PGO][CHR] Small cleanup.
Hiroshi Yamauchi [Fri, 7 Sep 2018 18:00:58 +0000 (18:00 +0000)]
[PGO][CHR] Small cleanup.

Summary:
Do away with demangling. It wasn't really necessary.
Declared some local functions to be static.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

llvm-svn: 341681

6 years ago[Bindings][Go] Fixed go.test failure due to C-API argument type mismatch.
Kristina Brooks [Fri, 7 Sep 2018 17:33:43 +0000 (17:33 +0000)]
[Bindings][Go] Fixed go.test failure due to C-API argument type mismatch.

go.test was failing previously with error,
Command Output (stderr):
dibuilder.go:301: cannot use C.uint(t.Encoding) (type C.uint) as type
C.LLVMDWARFTypeEncoding in argument to func literal
This patch fixes the argument type.

Patch by Chirag (Chirag Patel)

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

llvm-svn: 341680

6 years agoutils/abtest: Refactor and add bisection method
Matthias Braun [Fri, 7 Sep 2018 17:08:44 +0000 (17:08 +0000)]
utils/abtest: Refactor and add bisection method

- Refactor/rewrite most of the code. Also make sure it passes
  pycodestyle/pyflakes now
- Add a new mode that performs bisection on the search space. This
  should be faster in the common case where there is only a small number
  of files or functions actually leading to failure.
  The previous sequential behavior can still be accessed via `--seq`.

llvm-svn: 341679

6 years ago[X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an...
Craig Topper [Fri, 7 Sep 2018 16:58:57 +0000 (16:58 +0000)]
[X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an store instruction.

This is the clang side of D51769. The llvm intrinsics now return two results instead of using an out parameter.

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

llvm-svn: 341678

6 years ago[X86] Change the addcarry and subborrow intrinsics to return 2 results and remove...
Craig Topper [Fri, 7 Sep 2018 16:58:39 +0000 (16:58 +0000)]
[X86] Change the addcarry and subborrow intrinsics to return 2 results and remove the pointer argument.

We should represent the store directly in IR instead. This gives the middle end a chance to remove it if it can see a load from the same address.

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

llvm-svn: 341677

6 years ago[X86] Use regular expressions to make test immune to register allocation changes.
Craig Topper [Fri, 7 Sep 2018 16:58:36 +0000 (16:58 +0000)]
[X86] Use regular expressions to make test immune to register allocation changes.

llvm-svn: 341676

6 years ago[X86] Teach X86DAGToDAGISel::foldLoadStoreIntoMemOperand to handle loads in operand...
Craig Topper [Fri, 7 Sep 2018 16:27:55 +0000 (16:27 +0000)]
[X86] Teach X86DAGToDAGISel::foldLoadStoreIntoMemOperand to handle loads in operand 1 of commutable operations.

Previously we only handled loads in operand 0, but nothing guarantees the load will be operand 0 for commutable operations.

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

llvm-svn: 341675

6 years ago[InstCombine] Fold (min/max ~X, Y) -> ~(max/min X, ~Y) when Y is freely invertible
Craig Topper [Fri, 7 Sep 2018 16:19:50 +0000 (16:19 +0000)]
[InstCombine] Fold (min/max ~X, Y) -> ~(max/min X, ~Y) when Y is freely invertible

If the ~X wasn't able to simplify above the max/min, we might be able to simplify it by moving it below the max/min.

I had to modify the ~(min/max ~X, Y) transform to prevent getting stuck in a loop when we saw the new ~(max/min X, ~Y) before the ~Y had been folded away to remove the new not.

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

llvm-svn: 341674

6 years ago[LV] Fix code gen for conditionally executed loads and stores
Anna Thomas [Fri, 7 Sep 2018 15:53:48 +0000 (15:53 +0000)]
[LV] Fix code gen for conditionally executed loads and stores

Fix a latent bug in loop vectorizer which generates incorrect code for
memory accesses that are executed conditionally. As pointed in review,
this bug definitely affects uniform loads and may affect conditional
stores that should have turned into scatters as well).

The code gen for conditionally executed uniform loads on architectures
that support masked gather instructions is broken.

Without this patch, we were unconditionally executing the *conditional*
load in the vectorized version.

This patch does the following:
1. Uniform conditional loads on architectures with gather support will
   have correct code generated. In particular, the cost model
   (setCostBasedWideningDecision) is fixed.
2. For the recipes which are handled after the widening decision is set,
   we use the isScalarWithPredication(I, VF) form which is added in the
   patch.

3. Fix the vectorization cost model for scalarization
   (getMemInstScalarizationCost): implement and use isPredicatedInst to
   identify *all* predicated instructions, not just scalar+predicated. So,
   now the cost for scalarization will be increased for maskedloads/stores
   and gather/scatter operations. In short, we should be choosing the
   gather/scatter in place of scalarization on archs where it is
   profitable.
4. We needed to weaken the assert in useEmulatedMaskMemRefHack.

Reviewers: Ayal, hsaito, mkuper

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

llvm-svn: 341673

6 years agoMachO: Change getString16() back to inline function
Tom Stellard [Fri, 7 Sep 2018 15:51:52 +0000 (15:51 +0000)]
MachO: Change getString16() back to inline function

This was accidentally changed in r341670.

llvm-svn: 341672

6 years ago[asan] Update a vector's storage annotation during destruction. Reviewed as https...
Marshall Clow [Fri, 7 Sep 2018 15:47:59 +0000 (15:47 +0000)]
[asan] Update a vector's storage annotation during destruction. Reviewed as https://reviews.llvm.org/D50101. Thanks to bobsayshilol (Ben) for the patch.

llvm-svn: 341671

6 years agoMachO: Fix out-of-bounds memory access in getString16
Tom Stellard [Fri, 7 Sep 2018 15:42:01 +0000 (15:42 +0000)]
MachO: Fix out-of-bounds memory access in getString16

Summary:
This fixes the following tests when gcc is compiled with gcc8:

lld :: mach-o/do-not-emit-unwind-fde-arm64.yaml
lld :: mach-o/eh-frame-relocs-arm64.yaml

llvm.org/PR38096

Reviewers: lhames, kledzik, javed.absar

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 341670

6 years agoHot cold splitting pass
Aditya Kumar [Fri, 7 Sep 2018 15:03:49 +0000 (15:03 +0000)]
Hot cold splitting pass

Find cold blocks based on profile information (or optionally with static analysis).
Forward propagate profile information to all cold-blocks.
Outline a cold region.
Set calling conv and prof hint for the callsite of the outlined function.

Worked in collaboration with: Sebastian Pop <s.pop@samsung.com>
Differential Revision: https://reviews.llvm.org/D50658

llvm-svn: 341669

6 years agoRevert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."
Alexey Bataev [Fri, 7 Sep 2018 14:50:25 +0000 (14:50 +0000)]
Revert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."

Still need the RTTI for NVPTX target to pass sema checks.

llvm-svn: 341668

6 years ago[ARC] Make char unsigned by default
Alexander Polyakov [Fri, 7 Sep 2018 14:45:32 +0000 (14:45 +0000)]
[ARC] Make char unsigned by default

Summary: This patch specifies 'char' default sign on ARC.

Reviewers: tatyana-krasnukha, clayborg

Reviewed By: tatyana-krasnukha, clayborg

Subscribers: clayborg, lldb-commits

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

llvm-svn: 341667

6 years ago[InstCombine] Do not fold scalar ops over select with vector condition.
Florian Hahn [Fri, 7 Sep 2018 14:40:06 +0000 (14:40 +0000)]
[InstCombine] Do not fold scalar ops over select with vector condition.

If OtherOpT or OtherOpF have scalar types and the condition is a vector,
we would create an invalid select.

Reviewers: spatel, john.brawn, mssimpso, craig.topper

Reviewed By: spatel

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

llvm-svn: 341666

6 years ago[CodeComplete] Clearly distinguish signature help and code completion.
Ilya Biryukov [Fri, 7 Sep 2018 14:04:39 +0000 (14:04 +0000)]
[CodeComplete] Clearly distinguish signature help and code completion.

Summary:
Code completion in clang is actually a mix of two features:
- Code completion is a familiar feature. Results are exposed via the
  CodeCompleteConsumer::ProcessCodeCompleteResults callback.
- Signature help figures out if the current expression is an argument of
  some function call and shows corresponding signatures if so.
  Results are exposed via CodeCompleteConsumer::ProcessOverloadCandidates.

This patch refactors the implementation to untangle those two from each
other and makes some naming tweaks to avoid confusion when reading the
code.

The refactoring is required for signature help fixes, see D51038.

The only intended behavior change is the order of callbacks.
ProcessOverloadCandidates is now called before ProcessCodeCompleteResults.

Reviewers: sammccall, kadircet

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 341660

6 years ago[DebugInfo] Handle stack slot offsets for spilled sub-registers in LDV
David Stenberg [Fri, 7 Sep 2018 13:54:07 +0000 (13:54 +0000)]
[DebugInfo] Handle stack slot offsets for spilled sub-registers in LDV

Summary:
Extend LDV so that stack slot offsets for spilled sub-registers
are added to the emitted debug locations. This is accomplished
by querying InstrInfo::getStackSlotRange().

With this change, LDV will add a DW_OP_plus_uconst operation to
the expression if a sub-register is spilled. Later on, PEI will
add an offset operation for the stack slot, meaning that we will
get expressions of the forms:

 * {DW_OP_constu #fp-offset, DW_OP_minus,
    DW_OP_plus_uconst #subreg-offset}

 * {DW_OP_plus_const #fp-offset,
    DW_OP_minus, DW_OP_plus_uconst #subreg-offset}

The two offset operations should ideally be merged.

Reviewers: rnk, aprantl, stoklund

Reviewed By: aprantl

Subscribers: dblaikie, bjope, nemanjai, JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 341659

6 years agoAdd support for getRegisterByName.
Sid Manning [Fri, 7 Sep 2018 13:36:21 +0000 (13:36 +0000)]
Add support for getRegisterByName.

Support required to build the Hexagon Linux kernel.

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

llvm-svn: 341658