platform/upstream/llvm.git
6 years agoAMDGPU: Correct errors in device table
Matt Arsenault [Thu, 16 Aug 2018 20:19:47 +0000 (20:19 +0000)]
AMDGPU: Correct errors in device table

llvm-svn: 339934

6 years agoUpdate README and Dockerfile to include llvm-proto-fuzzer
Emmett Neyman [Thu, 16 Aug 2018 20:13:40 +0000 (20:13 +0000)]
Update README and Dockerfile to include llvm-proto-fuzzer

Summary: Added commands to Dockerfile to build llvm-proto-fuzzer and the other related tools. Also added a section to the bottom of the README describing what llvm-proto-fuzzer does and how to run it.

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 339933

6 years ago[hwasan] Add malloc_fill_byte and free_fill_byte flags.
Evgeniy Stepanov [Thu, 16 Aug 2018 20:13:09 +0000 (20:13 +0000)]
[hwasan] Add malloc_fill_byte and free_fill_byte flags.

Reviewers: vitalybuka, kcc

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 339932

6 years ago[SystemZ] Require asserts in subregliveness-06.mir
Krzysztof Parzyszek [Thu, 16 Aug 2018 20:12:15 +0000 (20:12 +0000)]
[SystemZ] Require asserts in subregliveness-06.mir

The option -misched=shuffle is only available with !NDEBUG builds.

llvm-svn: 339931

6 years ago[LICM][NFC] Restructure pointer invalidation API in terms of MemoryLocation
Philip Reames [Thu, 16 Aug 2018 20:11:15 +0000 (20:11 +0000)]
[LICM][NFC] Restructure pointer invalidation API in terms of MemoryLocation

Main value is just simplifying code.  I'll further simply the argument handling case in a bit, but that involved a slightly orthogonal change so I went with the mildy ugly intermediate for this patch.

Note that the isSized check in the old LICM code was not carried across.  It turns out that check was dead.  a) no test exercised it, and b) langref and verifier had been updated to disallow unsized types used in loads.

llvm-svn: 339930

6 years ago[dotest] Make --test-subdir work with --no-multiprocess
Vedant Kumar [Thu, 16 Aug 2018 19:56:38 +0000 (19:56 +0000)]
[dotest] Make --test-subdir work with --no-multiprocess

The single-process test runner is invoked in a number of different
scenarios, including when multiple test dirs are specified or (afaict)
when lit is used to drive the test suite.

Unfortunately the --test-subdir option did not work with the single
process test runner, breaking an important use case (using lit to run
swift-lldb Linux tests):

  Failure URL: https://ci.swift.org/job/swift-PR-Linux/6841

We won't be able to run lldb tests within swift PR testing without
filtering down the set of tests.

This change makes --test-subdir work with the single-process runner.

llvm-svn: 339929

6 years ago[llvm-mca] Fix -Wpessimizing-move warnings introduced by r339923.
Andrea Di Biagio [Thu, 16 Aug 2018 19:45:13 +0000 (19:45 +0000)]
[llvm-mca] Fix -Wpessimizing-move warnings introduced by r339923.

Reported by buildbot `clang-with-lto-ubuntu` ( build #9858 ).

llvm-svn: 339928

6 years agoAdd missing test file from r339799.
Peter Collingbourne [Thu, 16 Aug 2018 19:29:01 +0000 (19:29 +0000)]
Add missing test file from r339799.

llvm-svn: 339927

6 years ago[X86] Pre-commit test case for D50827.
Craig Topper [Thu, 16 Aug 2018 19:27:43 +0000 (19:27 +0000)]
[X86] Pre-commit test case for D50827.

llvm-svn: 339926

6 years ago[WebAssembly] Remove temporary workaround for function bitcasts
Jacob Gravelle [Thu, 16 Aug 2018 19:24:31 +0000 (19:24 +0000)]
[WebAssembly] Remove temporary workaround for function bitcasts

Summary:
EM_ASM no longer is lowered as varargs in C, so this workaround is
obsolete.

Reviewers: dschuff, sunfish

Subscribers: sbc100, aheejin, llvm-commits

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

llvm-svn: 339925

6 years ago[MachineVerifier] Check if predecessor is jointly dominated by undefs
Krzysztof Parzyszek [Thu, 16 Aug 2018 19:13:28 +0000 (19:13 +0000)]
[MachineVerifier] Check if predecessor is jointly dominated by undefs

Each use of a value should be jointly dominated by the union of defs and
undefs. It can happen that it will only be jointly dominated by undefs,
and that is still legal. Make sure that the verifier is aware of that.

llvm-svn: 339924

6 years ago[llvm-mca] Refactor how execution is orchestrated by the Pipeline.
Andrea Di Biagio [Thu, 16 Aug 2018 19:00:48 +0000 (19:00 +0000)]
[llvm-mca] Refactor how execution is orchestrated by the Pipeline.

This patch changes how instruction execution is orchestrated by the Pipeline.
In particular, this patch makes it more explicit how instructions transition
through the various pipeline stages during execution.

The main goal is to simplify both the stage API and the Pipeline execution.  At
the same time, this patch fixes some design issues which are currently latent,
but that are likely to cause problems in future if people start defining custom
pipelines.

The new design assumes that each pipeline stage knows the "next-in-sequence".
The Stage API has gained three new methods:
 -   isAvailable(IR)
 -   checkNextStage(IR)
 -   moveToTheNextStage(IR).

An instruction IR can be executed by a Stage if method `Stage::isAvailable(IR)`
returns true.
Instructions can move to next stages using method moveToTheNextStage(IR).
An instruction cannot be moved to the next stage if method checkNextStage(IR)
(called on the current stage) returns false.
Stages are now responsible for moving instructions to the next stage in sequence
if necessary.

Instructions are allowed to transition through multiple stages during a single
cycle (as long as stages are available, and as long as all the calls to
`checkNextStage(IR)` returns true).

Methods `Stage::preExecute()` and `Stage::postExecute()` have now become
redundant, and those are removed by this patch.

Method Pipeline::runCycle() is now simpler, and it correctly visits stages
on every begin/end of cycle.

Other changes:
 - DispatchStage no longer requires a reference to the Scheduler.
 - ExecuteStage no longer needs to directly interact with the
   RetireControlUnit. Instead, executed instructions are now directly moved to the
   next stage (i.e. the retire stage).
 - RetireStage gained an execute method. This allowed us to remove the
   dependency with the RCU in ExecuteStage.
 - FecthStage now updates the "program counter" during cycleBegin() (i.e.
   before we start executing new instructions).
 - We no longer need Stage::Status to be returned by method execute(). It has
   been dropped in favor of a more lightweight llvm::Error.

Overally, I measured a ~11% performance gain w.r.t. the previous design.  I also
think that the Stage interface is probably easier to read now.  That being said,
code comments have to be improved, and I plan to do it in a follow-up patch.

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

llvm-svn: 339923

6 years ago[SelectionDAG] Improve the legalisation lowering of UMULO.
Eli Friedman [Thu, 16 Aug 2018 18:39:39 +0000 (18:39 +0000)]
[SelectionDAG] Improve the legalisation lowering of UMULO.

There is no way in the universe, that doing a full-width division in
software will be faster than doing overflowing multiplication in
software in the first place, especially given that this same full-width
multiplication needs to be done anyway.

This patch replaces the previous implementation with a direct lowering
into an overflowing multiplication algorithm based on half-width
operations.

Correctness of the algorithm was verified by exhaustively checking the
output of this algorithm for overflowing multiplication of 16 bit
integers against an obviously correct widening multiplication. Baring
any oversights introduced by porting the algorithm to DAG, confidence in
correctness of this algorithm is extremely high.

Following table shows the change in both t = runtime and s = space. The
change is expressed as a multiplier of original, so anything under 1 is
“better” and anything above 1 is worse.

+-------+-----------+-----------+-------------+-------------+
| Arch  | u64*u64 t | u64*u64 s | u128*u128 t | u128*u128 s |
+-------+-----------+-----------+-------------+-------------+
|   X64 |     -     |     -     |    ~0.5     |    ~0.64    |
|  i686 |   ~0.5    |   ~0.6666 |    ~0.05    |    ~0.9     |
| armv7 |     -     |   ~0.75   |      -      |    ~1.4     |
+-------+-----------+-----------+-------------+-------------+

Performance numbers have been collected by running overflowing
multiplication in a loop under `perf` on two x86_64 (one Intel Haswell,
other AMD Ryzen) based machines. Size numbers have been collected by
looking at the size of function containing an overflowing multiply in
a loop.

All in all, it can be seen that both performance and size has improved
except in the case of armv7 where code size has regressed for 128-bit
multiply. u128*u128 overflowing multiply on 32-bit platforms seem to
benefit from this change a lot, taking only 5% of the time compared to
original algorithm to calculate the same thing.

The final benefit of this change is that LLVM is now capable of lowering
the overflowing unsigned multiply for integers of any bit-width as long
as the target is capable of lowering regular multiplication for the same
bit-width. Previously, 128-bit overflowing multiply was the widest
possible.

Patch by Simonas Kazlauskas!

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

llvm-svn: 339922

6 years ago[llvm-strip] Add support for -p/--preserve-dates
Jordan Rupprecht [Thu, 16 Aug 2018 18:29:40 +0000 (18:29 +0000)]
[llvm-strip] Add support for -p/--preserve-dates

Summary: [llvm-strip] Preserve access/modification timestamps when -p is used.

Reviewers: jakehehrlich, jhenderson, alexshap

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 339921

6 years agoFix lldb-vscode build on Windows
Reid Kleckner [Thu, 16 Aug 2018 18:24:59 +0000 (18:24 +0000)]
Fix lldb-vscode build on Windows

Include PosixAPI.h to get a PATH_MAX definition and replace CreateEvent
with CreateEventObject to avoid conflicts with the windows.h definition
of CreateEvent to CreateEventW.

llvm-svn: 339920

6 years ago[ASTImporter] Add test for member pointer types.
Raphael Isemann [Thu, 16 Aug 2018 18:22:21 +0000 (18:22 +0000)]
[ASTImporter] Add test for member pointer types.

Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, martong, cfe-commits

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

llvm-svn: 339919

6 years ago[ASTImporter] Add test for importing CompoundAssignOperators
Raphael Isemann [Thu, 16 Aug 2018 18:21:33 +0000 (18:21 +0000)]
[ASTImporter] Add test for importing CompoundAssignOperators

Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, cfe-commits, martong

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

llvm-svn: 339918

6 years ago[ASTImporter] Add test for DoStmt
Raphael Isemann [Thu, 16 Aug 2018 18:20:52 +0000 (18:20 +0000)]
[ASTImporter] Add test for DoStmt

Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, martong, cfe-commits

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

llvm-svn: 339917

6 years ago[ASTImporter] Add test for WhileStmt
Raphael Isemann [Thu, 16 Aug 2018 18:20:05 +0000 (18:20 +0000)]
[ASTImporter] Add test for WhileStmt

Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, martong, cfe-commits

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

llvm-svn: 339916

6 years ago[ASTImporter] Add test for IndirectGotoStmt
Raphael Isemann [Thu, 16 Aug 2018 18:19:21 +0000 (18:19 +0000)]
[ASTImporter] Add test for IndirectGotoStmt

Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, martong, cfe-commits

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

llvm-svn: 339915

6 years agoDisable two flaky pexpect-backed tests on Darwin
Vedant Kumar [Thu, 16 Aug 2018 18:18:16 +0000 (18:18 +0000)]
Disable two flaky pexpect-backed tests on Darwin

These tests are sporadically timing out on our bots, e.g here:

  https://ci.swift.org/job/swift-PR-Linux/6841

llvm-svn: 339914

6 years agoUpdate LLD tests for CodeView dumper change in r339907
Reid Kleckner [Thu, 16 Aug 2018 18:03:06 +0000 (18:03 +0000)]
Update LLD tests for CodeView dumper change in r339907

llvm-svn: 339913

6 years ago[RegisterCoalescer] Shrink to uses if needed after removeCopyByCommutingDef
Krzysztof Parzyszek [Thu, 16 Aug 2018 18:02:59 +0000 (18:02 +0000)]
[RegisterCoalescer] Shrink to uses if needed after removeCopyByCommutingDef

llvm-svn: 339912

6 years agoAdd a new tool named "lldb-vscode" that implements the Visual Studio Code Debug Adapt...
Greg Clayton [Thu, 16 Aug 2018 17:59:38 +0000 (17:59 +0000)]
Add a new tool named "lldb-vscode" that implements the Visual Studio Code Debug Adaptor Protocol

This patch adds a new lldb-vscode tool that speaks the Microsoft Visual Studio Code debug adaptor protocol. It has full unit tests that test all packets.

This tool can be easily packaged up into a native extension and used with Visual Studio Code, and it can also be used by Nuclide

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

llvm-svn: 339911

6 years agoUpdate LLDB for LLVM CodeView API change in r339907
Reid Kleckner [Thu, 16 Aug 2018 17:51:58 +0000 (17:51 +0000)]
Update LLDB for LLVM CodeView API change in r339907

llvm-svn: 339910

6 years agoFix memory leak in demangling of string literals.
Zachary Turner [Thu, 16 Aug 2018 17:48:32 +0000 (17:48 +0000)]
Fix memory leak in demangling of string literals.

llvm-svn: 339909

6 years ago[TargetLowering] Add support for non-uniform vectors to BuildSDIV
Simon Pilgrim [Thu, 16 Aug 2018 17:44:33 +0000 (17:44 +0000)]
[TargetLowering] Add support for non-uniform vectors to BuildSDIV

This patch refactors the existing TargetLowering::BuildSDIV base implementation to support non-uniform constant vector denominators.

This is the last patch necessary to close PR36545

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

llvm-svn: 339908

6 years ago[codeview] Use push_macro to avoid conflicts instead of a prefix
Reid Kleckner [Thu, 16 Aug 2018 17:34:31 +0000 (17:34 +0000)]
[codeview] Use push_macro to avoid conflicts instead of a prefix

Summary:
This prefix was added in r333421, and it changed our dumper output to
say things like "CVRegEAX" instead of just "EAX". That's a functional
change that I'd rather avoid.

I tested GCC, Clang, and MSVC, and all of them support #pragma
push_macro. They don't issue warnings whem the macro is not defined
either.

I don't have a Mac so I can't test the real termios.h header, but I
looked at the termios.h sources online and looked for other conflicts.
I saw only the CR* macros, so those are the ones we work around.

Reviewers: zturner, JDevlieghere

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 339907

6 years ago[MC] Cleanup noop default case spelling. NFC.
Nirav Dave [Thu, 16 Aug 2018 17:22:31 +0000 (17:22 +0000)]
[MC] Cleanup noop default case spelling. NFC.

llvm-svn: 339906

6 years ago[ELF] mergeSections: remove non-alive MergeInputSection
Fangrui Song [Thu, 16 Aug 2018 17:22:02 +0000 (17:22 +0000)]
[ELF] mergeSections: remove non-alive MergeInputSection

Summary: This makes it conform to what the comment says. Otherwise when getErrPlace() is called afterwards, cast<InputSection>(D) will cause incompatible cast as MergeInputSection is not a subclass of InputSection.

Reviewers: ruiu, grimar, espindola, pcc

Reviewed By: grimar

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 339904

6 years agoRevert "unittests: Don't install TestPlugin.so"
Tom Stellard [Thu, 16 Aug 2018 17:15:03 +0000 (17:15 +0000)]
Revert "unittests: Don't install TestPlugin.so"

This reverts commit r339897.

This breaks the build on Windows and platforms where loadable modules
aren't supported.

llvm-svn: 339903

6 years agoAMDGPU: Custom lower fexp
Matt Arsenault [Thu, 16 Aug 2018 17:07:52 +0000 (17:07 +0000)]
AMDGPU: Custom lower fexp

This will allow the library to just use __builtin_expf directly
without expanding this itself. Note f64 still won't work because
there is no exp instruction for it.

llvm-svn: 339902

6 years ago[X86][SSE] Add sdiv by nonuniform constant vector test containing -1/+1 and all-bits...
Simon Pilgrim [Thu, 16 Aug 2018 17:07:41 +0000 (17:07 +0000)]
[X86][SSE] Add sdiv by nonuniform constant vector test containing -1/+1 and all-bits style constants

llvm-svn: 339901

6 years ago[NFC] Fix typo in test cases
Evandro Menezes [Thu, 16 Aug 2018 17:03:22 +0000 (17:03 +0000)]
[NFC] Fix typo in test cases

llvm-svn: 339900

6 years agoNFC: Test commit access
Jordan Rupprecht [Thu, 16 Aug 2018 16:55:07 +0000 (16:55 +0000)]
NFC: Test commit access

Testing commit access from a new machine, so using this as an opportunity to revert my old test access commit (r336006) that I never cleaned up.

llvm-svn: 339899

6 years ago[TargetLowering] Refactor BuildSDIV in preparation for D50765. NFCI.
Simon Pilgrim [Thu, 16 Aug 2018 16:54:06 +0000 (16:54 +0000)]
[TargetLowering] Refactor BuildSDIV in preparation for D50765. NFCI.

Pull out magic factor calculators into a helper function, use 0/+1/-1 multiplication factor to (optionally) add/sub the numerator.

llvm-svn: 339898

6 years agounittests: Don't install TestPlugin.so
Tom Stellard [Thu, 16 Aug 2018 16:53:06 +0000 (16:53 +0000)]
unittests: Don't install TestPlugin.so

Summary:
add_llvm_loadable_module adds an install target by default, but this
module is only used for a unit test, so we don't need to install it.

Reviewers: philip.pfaffe, thakis

Subscribers: mgorny, llvm-commits

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

llvm-svn: 339897

6 years ago[MC] Remove unused variable
Benjamin Kramer [Thu, 16 Aug 2018 16:50:23 +0000 (16:50 +0000)]
[MC] Remove unused variable

llvm-svn: 339896

6 years ago[MC][X86] Enhance X86 Register expression handling to more closely match GCC.
Nirav Dave [Thu, 16 Aug 2018 16:31:14 +0000 (16:31 +0000)]
[MC][X86] Enhance X86 Register expression handling to more closely match GCC.

Allow the comparison of x86 registers in the evaluation of assembler
directives. This generalizes and simplifies the extension from r334022
to catch another case found in the Linux kernel.

Reviewers: rnk, void

Reviewed By: rnk

Subscribers: hiraditya, nickdesaulniers, llvm-commits

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

llvm-svn: 339895

6 years agoFix -Wmicrosoft-goto warnings.
Zachary Turner [Thu, 16 Aug 2018 16:30:27 +0000 (16:30 +0000)]
Fix -Wmicrosoft-goto warnings.

llvm-svn: 339894

6 years agoAdd support for AVX-512 CodeView registers.
Zachary Turner [Thu, 16 Aug 2018 16:17:55 +0000 (16:17 +0000)]
Add support for AVX-512 CodeView registers.

When compiling with /arch:AVX512 and optimizations turned on,
we could crash while emitting debug info because we did not
have CodeView register constants for the AVX 512 register
set defined.  This patch defines them.

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

llvm-svn: 339893

6 years ago[MS Demangler] Demangle string literals.
Zachary Turner [Thu, 16 Aug 2018 16:17:36 +0000 (16:17 +0000)]
[MS Demangler] Demangle string literals.

When demangling string literals, Microsoft's undname
simply prints 'string'.  This patch implements string
literal demangling while doing a bit better than this
by decoding as much of the string as possible and
trying to faithfully reproduce the original string
literal definition.

This is a bit tricky because the different character
types char, char16_t, and char32_t are not uniquely
identified by the mangling, so we have to use a
heuristic to try to guess the character type.  But
it works pretty well, and many tests are added to
illustrate the behavior.

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

llvm-svn: 339892

6 years ago[MS Demangler] Don't fail on MD5-mangled names.
Zachary Turner [Thu, 16 Aug 2018 16:17:17 +0000 (16:17 +0000)]
[MS Demangler] Don't fail on MD5-mangled names.

When we have an MD5 mangled name, we shouldn't choke and say
that it's an invalid name.  Even though it's impossible to demangle,
we should just output the original name.

llvm-svn: 339891

6 years ago[TableGen] TypeSetByHwMode::operator== optimization
Simon Pilgrim [Thu, 16 Aug 2018 16:16:28 +0000 (16:16 +0000)]
[TableGen] TypeSetByHwMode::operator== optimization

This operator is called a great deal, by checking for the cheap isSimple equality cases first (a common occurrence) we can improve performance as we avoid a lot of std::map find/iteration in hasDefault.

isSimple also means that a default value is present, so we can avoid some hasDefault calls.

This also avoids a rather dodgy piece of logic that was checking for isSimple() && !VTS.isSimple() but not the inverse - it now uses the general hasDefault mode comparison test instead.

Saves around 15secs in debug builds of x86 -gen-dag-isel.

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

llvm-svn: 339890

6 years ago[ConstantFolding] add tests for funnel shift intrinsics; NFC
Sanjay Patel [Thu, 16 Aug 2018 16:10:42 +0000 (16:10 +0000)]
[ConstantFolding] add tests for funnel shift intrinsics; NFC

No functionality for this yet.

llvm-svn: 339889

6 years ago[TableGen] Avoid self getPredicates() != comparison. NFCI.
Simon Pilgrim [Thu, 16 Aug 2018 16:04:05 +0000 (16:04 +0000)]
[TableGen] Avoid self getPredicates() != comparison. NFCI.

We were performing a completely unnecessary full comparison of the same std::vector<Predicate>.

llvm-svn: 339888

6 years ago[InstCombine] Expand the simplification of pow(x, 0.5) to sqrt(x)
Evandro Menezes [Thu, 16 Aug 2018 15:58:08 +0000 (15:58 +0000)]
[InstCombine] Expand the simplification of pow(x, 0.5) to sqrt(x)

Expand the number of cases when `pow(x, 0.5)` is simplified into `sqrt(x)`
by considering the math semantics with more granularity.

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

llvm-svn: 339887

6 years ago[Sanitizer] Fix build openbsd
David Carlier [Thu, 16 Aug 2018 15:54:38 +0000 (15:54 +0000)]
[Sanitizer] Fix build openbsd

- The alternative syscall exists only on FreeBSD.
- Adding OpenBSD's equivalent and while at it other
remaining oses ones.

Reviewers: vitalybuka, krytarowsky, hiraditya

Reviewed By: hiraditya

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

llvm-svn: 339886

6 years ago[llvm-mca] Small refactoring in preparation for another patch that will improve the...
Andrea Di Biagio [Thu, 16 Aug 2018 15:43:09 +0000 (15:43 +0000)]
[llvm-mca] Small refactoring in preparation for another patch that will improve the modularity of the Pipeline. NFCI

The main difference is that now `cycleStart()` and `cycleEnd()` return an
llvm::Error.

This patch implements a few minor style changes, and adds missing 'const' to
some methods.

llvm-svn: 339885

6 years ago[TableGen] Return ValueTypeByHwMode by const reference from CodeGenRegisterClass...
Simon Pilgrim [Thu, 16 Aug 2018 15:29:24 +0000 (15:29 +0000)]
[TableGen] Return ValueTypeByHwMode by const reference from CodeGenRegisterClass::getValueTypeNum

Avoids costly std::map copies inside ValueTypeByHwMode constructor

llvm-svn: 339884

6 years ago[cmake] Prevent LLVMgold.so from being unloaded on Linux
Hans Wennborg [Thu, 16 Aug 2018 15:12:12 +0000 (15:12 +0000)]
[cmake] Prevent LLVMgold.so from being unloaded on Linux

Extend the fix from D40459 to also apply to modules such as the LLVM
gold plugin. This is needed because current binutils master (and future
binutils 2.32) calls dlclose() on bfd plugins as part of a recent fix
for https://sourceware.org/bugzilla/show_bug.cgi?id=23460.

Patch by Evangelos Foutras!

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

llvm-svn: 339883

6 years ago[LLD][ELF] - Add a test case for DT_SONAME entry reading.
George Rimar [Thu, 16 Aug 2018 14:07:29 +0000 (14:07 +0000)]
[LLD][ELF] - Add a test case for DT_SONAME entry reading.

This covers a following line with a test:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L899

llvm-svn: 339880

6 years agoFixed unused variable warning. NFCI.
Simon Pilgrim [Thu, 16 Aug 2018 13:55:10 +0000 (13:55 +0000)]
Fixed unused variable warning. NFCI.

llvm-svn: 339879

6 years ago[libunwind][mips] Include gcc_s for linkage
Stefan Maksimovic [Thu, 16 Aug 2018 13:40:16 +0000 (13:40 +0000)]
[libunwind][mips] Include gcc_s for linkage

When compiling with optimizations, mips requires various helper routines(__ashldi3 and the like) contained in libgcc_s.
Conditionally include libgcc_s in the set of libraries to be linked to.

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

llvm-svn: 339878

6 years ago[clangd] NFC: Improve Dex Iterators debugging traits
Kirill Bobyrev [Thu, 16 Aug 2018 13:19:43 +0000 (13:19 +0000)]
[clangd] NFC: Improve Dex Iterators debugging traits

This patch improves `dex::Iterator` string representation by
incorporating the information about the element which is currently being
pointed to by the `DocumentIterator`.

Reviewed by: ioeric

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

llvm-svn: 339877

6 years ago[LLD][ELF] - Add a test case.
George Rimar [Thu, 16 Aug 2018 13:02:50 +0000 (13:02 +0000)]
[LLD][ELF] - Add a test case.

This covers the following line with a test:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L487

llvm-svn: 339876

6 years ago[InstCombine] move vector compare before same-shuffled ops
Sanjay Patel [Thu, 16 Aug 2018 12:52:17 +0000 (12:52 +0000)]
[InstCombine] move vector compare before same-shuffled ops

This is a step towards fixing PR37463:
https://bugs.llvm.org/show_bug.cgi?id=37463

llvm-svn: 339875

6 years ago[libcxx] By default, do not use internal_linkage to hide symbols from the ABI
Louis Dionne [Thu, 16 Aug 2018 12:44:28 +0000 (12:44 +0000)]
[libcxx] By default, do not use internal_linkage to hide symbols from the ABI

Summary:
https://reviews.llvm.org/D49240 led to symbol size problems in Chromium, and
we expect this may be the case in other projects built in debug mode too.
Instead, unless users explicitly ask for internal_linkage, we use always_inline
like we used to.

In the future, when we have a solution that allows us to drop always_inline
without falling back on internal_linkage, we can replace always_inline by
that.

Note that this commit introduces a change in contract for existing libc++
users: by default, libc++ used to guarantee that TUs built with different
versions of libc++ could be linked together. With the introduction of the
_LIBCPP_HIDE_FROM_ABI_PER_TU macro, the default behavior is that TUs built
with different libc++ versions are not guaranteed to link. This is a change
in contract but not a change in behavior, since the current implementation
still allows linking TUs built with different libc++ versions together.

Reviewers: EricWF, mclow.lists, dexonsmith, hans, rnk

Subscribers: christof, cfe-commits

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

llvm-svn: 339874

6 years ago[yaml2obj] - Allow to use numeric sh_link (Link) value for sections.
George Rimar [Thu, 16 Aug 2018 12:44:17 +0000 (12:44 +0000)]
[yaml2obj] - Allow to use numeric sh_link (Link) value for sections.

That change allows using numeric values for Link field.
It is consistent with the code for another fields in this method.

llvm-svn: 339873

6 years ago[yaml2elf] - Use check-next in test.
George Rimar [Thu, 16 Aug 2018 12:40:27 +0000 (12:40 +0000)]
[yaml2elf] - Use check-next in test.

Its a follow up for rL339870.

llvm-svn: 339872

6 years ago[ARM] Ignore GEPs in ARMCodeGenPrepare
Sam Parker [Thu, 16 Aug 2018 12:24:40 +0000 (12:24 +0000)]
[ARM] Ignore GEPs in ARMCodeGenPrepare

While searching through the use-def tree, ignore GetElementPtrInst
instructions because they don't need promoting and neither do their
indices. Otherwise, the wide indices prevent the transformation from
happening.

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

llvm-svn: 339871

6 years ago[yaml2elf] - Simplify code, add a test. NFC.
George Rimar [Thu, 16 Aug 2018 12:23:22 +0000 (12:23 +0000)]
[yaml2elf] - Simplify code, add a test. NFC.

This simplifies the code allowing to set the sh_info
for relocations sections. And adds a missing test.

llvm-svn: 339870

6 years ago[XRay][compiler-rt] Remove MAP_NORESERVE from XRay allocations
Dean Michael Berris [Thu, 16 Aug 2018 12:19:03 +0000 (12:19 +0000)]
[XRay][compiler-rt] Remove MAP_NORESERVE from XRay allocations

Summary:
This reverses an earlier decision to allow seg-faulting from the
XRay-allocated memory if it turns out that the system cannot provide
physical memory backing that cannot be swapped in/out on Linux.

This addresses http://llvm.org/PR38588.

Reviewers: eizan

Reviewed By: eizan

Subscribers: llvm-commits

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

llvm-svn: 339869

6 years ago[ARM] Allow zext in ARMCodeGenPrepare
Sam Parker [Thu, 16 Aug 2018 11:54:09 +0000 (11:54 +0000)]
[ARM] Allow zext in ARMCodeGenPrepare

Treat zext instructions as roots, like we do for truncs.

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

llvm-svn: 339868

6 years ago[LLD][ELF] - Add test case.
George Rimar [Thu, 16 Aug 2018 11:48:18 +0000 (11:48 +0000)]
[LLD][ELF] - Add test case.

To cover the following error message:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L463

llvm-svn: 339867

6 years agoAttempt to fix clangd tests on older compilers
Simon Pilgrim [Thu, 16 Aug 2018 11:41:19 +0000 (11:41 +0000)]
Attempt to fix clangd tests on older compilers

Old gcc versions of gcc struggle with raw string literals inside macros.

Inspired by rL339759

llvm-svn: 339866

6 years ago[libcxxabi] Fix test_exception_address_alignment test for ARM
Yvan Roux [Thu, 16 Aug 2018 11:38:09 +0000 (11:38 +0000)]
[libcxxabi] Fix test_exception_address_alignment test for ARM

Check _LIBCXXABI_ARM_EHABI macro instead of libunwind version.

Fixes PR34182

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

llvm-svn: 339865

6 years ago[RISCV][MC] Don't fold symbol differences if requiresDiffExpressionRelocations is...
Alex Bradbury [Thu, 16 Aug 2018 11:26:37 +0000 (11:26 +0000)]
[RISCV][MC] Don't fold symbol differences if requiresDiffExpressionRelocations is true

When emitting the difference between two symbols, the standard behavior is
that the difference will be resolved to an absolute value if both of the
symbols are offsets from the same data fragment. This is undesirable on
architectures such as RISC-V where relaxation in the linker may cause the
computed difference to become invalid. This caused an issue when compiling to
object code, where the size of a function in the debug information was already
calculated even though it could change as a consequence of relaxation in the
subsequent linking stage.

This patch inhibits the resolution of symbol differences to absolute values
where the target's AsmBackend has declared that it does not want these to be
folded.

Differential Revision: https://reviews.llvm.org/D45773
Patch by Edward Jones.

llvm-svn: 339864

6 years ago[ADT] Replace APInt::WORD_MAX with APInt::WORDTYPE_MAX
Simon Pilgrim [Thu, 16 Aug 2018 11:08:23 +0000 (11:08 +0000)]
[ADT] Replace APInt::WORD_MAX with APInt::WORDTYPE_MAX

The windows SDK defines WORD_MAX, so any poor soul that wants to use LLVM in a project that depends on the windows SDK gets a build error.

Given that it actually describes the maximal value of WordType, it actually fits even better than WORD_MAX

Patch by: @miscco

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

llvm-svn: 339863

6 years ago[AST] Store the OwnedTagDecl as a trailing object in ElaboratedType.
Bruno Ricci [Thu, 16 Aug 2018 10:48:16 +0000 (10:48 +0000)]
[AST] Store the OwnedTagDecl as a trailing object in ElaboratedType.

The TagDecl *OwnedTagDecl in ElaboratedType is quite commonly
null (at least when parsing all of Boost, it is non-null for only about 600
of the 66k ElaboratedType). Therefore we can save a pointer in the
common case by storing it as a trailing object, and storing a bit in the
bit-fields of Type indicating when the pointer is null.

Reviewed By: rjmccall

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

llvm-svn: 339862

6 years ago[AST] Pack the unsigned of SubstTemplateTypeParmPackType into Type
Bruno Ricci [Thu, 16 Aug 2018 10:33:36 +0000 (10:33 +0000)]
[AST] Pack the unsigned of SubstTemplateTypeParmPackType into Type

The bit-fields of Type have enough space for the member
unsigned NumArgs of SubstTemplateTypeParmPackType.

Reviewed By: erichkeane

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

llvm-svn: 339861

6 years ago[AST] Pack the unsigned of DependentTemplateSpecializationType into Type
Bruno Ricci [Thu, 16 Aug 2018 10:28:18 +0000 (10:28 +0000)]
[AST] Pack the unsigned of DependentTemplateSpecializationType into Type

The bit-fields of `Type` have enough space for the member
`unsigned NumArgs` of `DependentTemplateSpecializationType`.

Reviewed By: erichkeane

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

llvm-svn: 339860

6 years ago[ARM] Allow signed icmps in ARMCodeGenPrepare
Sam Parker [Thu, 16 Aug 2018 10:05:39 +0000 (10:05 +0000)]
[ARM] Allow signed icmps in ARMCodeGenPrepare

Originally committed in r339755 which was reverted in r339806 due to
an asan issue. The issue was caused by my assumption that operands to
a CallInst mapped to the FunctionType Params. CallInsts are now
handled by iterating over their ArgOperands instead of Operands.

Original Message:
  Treat signed icmps as 'sinks', allowing them to be in the use-def
  tree, enabling more promotions to be performed. As a sink, any
  promoted incoming values need to be truncated before being used by
  the signed icmp.

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

llvm-svn: 339858

6 years ago[libunwind][mips] Guard accumulator registers
Stefan Maksimovic [Thu, 16 Aug 2018 08:49:50 +0000 (08:49 +0000)]
[libunwind][mips] Guard accumulator registers

Mipsr6 does not possess HI and LO accumulator registers, adjust validRegister functions to respect that.

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

llvm-svn: 339849

6 years ago[libunwind][mips] Modify the __mips_fpr macro check
Stefan Maksimovic [Thu, 16 Aug 2018 08:47:43 +0000 (08:47 +0000)]
[libunwind][mips] Modify the __mips_fpr macro check

The __mips_fpr macro can take the value of 0 as well, change to account for that case.

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

llvm-svn: 339848

6 years ago[mips] Remove dead code from MipsPassConfig
Simon Atanasyan [Thu, 16 Aug 2018 08:43:17 +0000 (08:43 +0000)]
[mips] Remove dead code from MipsPassConfig

Found by GCC's -Wunused-function.

Patch by Kim Gräsman.

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

llvm-svn: 339847

6 years ago[NFC] Remove const modifier to allow further development in LICM
Max Kazantsev [Thu, 16 Aug 2018 08:30:15 +0000 (08:30 +0000)]
[NFC] Remove const modifier to allow further development in LICM

llvm-svn: 339846

6 years ago[X86] Remove masking from the 512-bit paddus/psubus builtins. Use a select builtin...
Craig Topper [Thu, 16 Aug 2018 07:28:06 +0000 (07:28 +0000)]
[X86] Remove masking from the 512-bit paddus/psubus builtins. Use a select builtin instead.

llvm-svn: 339845

6 years ago[NFC] Add missing const modifier
Max Kazantsev [Thu, 16 Aug 2018 06:28:04 +0000 (06:28 +0000)]
[NFC] Add missing const modifier

llvm-svn: 339844

6 years ago[X86] Remove masking from the 512-bit padds and psubs builtins. Use select builtin...
Craig Topper [Thu, 16 Aug 2018 06:20:29 +0000 (06:20 +0000)]
[X86] Remove masking from the 512-bit padds and psubs builtins. Use select builtin instead.

llvm-svn: 339843

6 years ago[X86] Remove masking from the 512-bit padds and psubs intrinsics. Use select in IR...
Craig Topper [Thu, 16 Aug 2018 06:20:24 +0000 (06:20 +0000)]
[X86] Remove masking from the 512-bit padds and psubs intrinsics. Use select in IR instead.

llvm-svn: 339842

6 years ago[X86] Remove the unused masked 128 and 256-bit masked padds/psubs intrinsics.
Craig Topper [Thu, 16 Aug 2018 06:20:22 +0000 (06:20 +0000)]
[X86] Remove the unused masked 128 and 256-bit masked padds/psubs intrinsics.

Still need to remove masking from the 512-bit versions.

llvm-svn: 339841

6 years ago[X86] Correct some bad FileCheck prefixes in tests. Add test cases for v64i8 padd...
Craig Topper [Thu, 16 Aug 2018 06:20:19 +0000 (06:20 +0000)]
[X86] Correct some bad FileCheck prefixes in tests. Add test cases for v64i8 padd/psub saturation intrinsics.

For some reason we had the 128/256-bit tests, but no the 512-bit tests.

llvm-svn: 339840

6 years ago[ASTImporter] Add test for CXXDefaultInitExpr
Raphael Isemann [Thu, 16 Aug 2018 01:37:43 +0000 (01:37 +0000)]
[ASTImporter] Add test for CXXDefaultInitExpr

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 339839

6 years ago[ASTImporter] Add test for CXXScalarValueInit
Raphael Isemann [Thu, 16 Aug 2018 01:36:37 +0000 (01:36 +0000)]
[ASTImporter] Add test for CXXScalarValueInit

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 339838

6 years ago[ASTImporter] Add test for ForStmt and ContinueStmt
Raphael Isemann [Thu, 16 Aug 2018 01:35:47 +0000 (01:35 +0000)]
[ASTImporter] Add test for ForStmt and ContinueStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 339837

6 years ago[x86] Actually initialize the SLH pass with the x86 backend and use
Chandler Carruth [Thu, 16 Aug 2018 01:22:19 +0000 (01:22 +0000)]
[x86] Actually initialize the SLH pass with the x86 backend and use
a shorter name ('x86-slh') for the internal flags and pass name.

Without this, you can't use the -stop-after or -stop-before
infrastructure. I seem to have just missed this when originally adding
the pass.

The shorter name solves two problems. First, the flag names were ...
really long and hard to type/manage. Second, the pass name can't be the
exact same as the flag name used to enable this, and there are already
some users of that flag name so I'm avoiding changing it unnecessarily.

llvm-svn: 339836

6 years ago[BFI] Use rounding while computing profile counts.
Easwaran Raman [Thu, 16 Aug 2018 00:26:59 +0000 (00:26 +0000)]
[BFI] Use rounding while computing profile counts.

Summary:
Profile count of a block is computed by multiplying its block frequency
by entry count and dividing the result by entry block frequency. Do
rounded division in the last step and update test cases appropriately.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 339835

6 years ago[Driver] -print-target-triple and -print-effective-triple options
Petr Hosek [Thu, 16 Aug 2018 00:22:03 +0000 (00:22 +0000)]
[Driver] -print-target-triple and -print-effective-triple options

These can be used to print Clang target and effective triple.

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

llvm-svn: 339834

6 years agoFix a little thinko in generating ___lldb_unnamed_symbol symbols
Jim Ingham [Wed, 15 Aug 2018 23:10:32 +0000 (23:10 +0000)]
Fix a little thinko in generating ___lldb_unnamed_symbol symbols
when we have only an in-memory copy of the binary.

Also added a test for the generation of these symbols in the
in-memory and regular cases.

<rdar://problem/43160401>

llvm-svn: 339833

6 years agoImplementation of nested loops in cxx_loop_proto
Emmett Neyman [Wed, 15 Aug 2018 23:05:48 +0000 (23:05 +0000)]
Implementation of nested loops in cxx_loop_proto

Summary: Extended `cxx_loop_proto` to have neste for loops. Modified `loop_proto_to_llvm` and `loop_proto_to_cxx` to handle the new protos. All protos have a set of statements designated as "inner loop" statements and a set of statements designated as "outer loop" statements.

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 339832

6 years ago[ASTImporter] Add test for ArrayInitLoopExpr
Raphael Isemann [Wed, 15 Aug 2018 22:52:21 +0000 (22:52 +0000)]
[ASTImporter] Add test for ArrayInitLoopExpr

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 339831

6 years ago[ASTImporter] Add test for ExprWithCleanups
Raphael Isemann [Wed, 15 Aug 2018 22:51:37 +0000 (22:51 +0000)]
[ASTImporter] Add test for ExprWithCleanups

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 339830

6 years ago[Darwin Driver] Fix Simulator builtins and test cases
Chris Bieneman [Wed, 15 Aug 2018 22:50:06 +0000 (22:50 +0000)]
[Darwin Driver] Fix Simulator builtins and test cases

In r339807, I broke linking the builtins libraries for simulator targets, which itself was bad, but turns out it was all completely untested and marked with FIXME in the test suite.

This fixes all the test cases so they actually work, and fixes the bug I introduced in r339807.

llvm-svn: 339829

6 years agoAdd libc++ data formatters for std::optional.
Adrian Prantl [Wed, 15 Aug 2018 22:48:48 +0000 (22:48 +0000)]
Add libc++ data formatters for std::optional.

Patch by Shafik Yaghmour!

This reapplies an earlier version after addressing some post-commit feedback.

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

llvm-svn: 339828

6 years ago[ASTImporter] Add test for IfStmt
Raphael Isemann [Wed, 15 Aug 2018 22:36:58 +0000 (22:36 +0000)]
[ASTImporter] Add test for IfStmt

Reviewers: a.sidorin, hiraditya

Reviewed By: hiraditya

Subscribers: hiraditya, martong, cfe-commits

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

llvm-svn: 339827

6 years agoRevert "[ASTImporter] Add test for IfStmt"
Raphael Isemann [Wed, 15 Aug 2018 22:32:35 +0000 (22:32 +0000)]
Revert "[ASTImporter] Add test for IfStmt"

That's actually a clang patch, sorry.

llvm-svn: 339826

6 years ago[ASTImporter] Add test for IfStmt
Raphael Isemann [Wed, 15 Aug 2018 22:31:44 +0000 (22:31 +0000)]
[ASTImporter] Add test for IfStmt

Reviewers: a.sidorin, hiraditya

Reviewed By: hiraditya

Subscribers: hiraditya, martong, cfe-commits

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

llvm-svn: 339825

6 years ago[Metadata] Replace a SmallVector with an array; NFC
George Burgess IV [Wed, 15 Aug 2018 22:15:35 +0000 (22:15 +0000)]
[Metadata] Replace a SmallVector with an array; NFC

MDNode::get takes an ArrayRef, so these should be equivalent.

llvm-svn: 339824

6 years ago[llvm-mca] Minor style changes. NFC
Andrea Di Biagio [Wed, 15 Aug 2018 22:11:05 +0000 (22:11 +0000)]
[llvm-mca] Minor style changes. NFC

llvm-svn: 339823