platform/upstream/llvm.git
5 years ago[SimplifyLibCalls] Simplify optimizePuts
Fangrui Song [Tue, 12 Mar 2019 14:20:22 +0000 (14:20 +0000)]
[SimplifyLibCalls] Simplify optimizePuts

The code might intend to replace puts("") with putchar('\n') even if the
return value is used. It failed because use_empty() was used to guard
the whole block. While returning '\n' (putchar('\n')) is technically
correct (puts is only required to return a nonnegative number on
success), doing this looks weird and there is really little benefit to
optimize puts whose return value is used. So don't do that.

llvm-svn: 355921

5 years ago[NFC][PowerPC]Assert when trying to generate directmove below P8.
Jinsong Ji [Tue, 12 Mar 2019 14:01:29 +0000 (14:01 +0000)]
[NFC][PowerPC]Assert when trying to generate directmove below P8.

This was found when we generated COPY from G8RC to F8RC in
EmitInstrWithCustomInserter without checking proper architecture,
we silently generated mtvsrd, which require P8 and up.

This is a NFC patch to add assert when we call copyPhysReg, in case
someone accidentally generate COPY between G8RC to F8RC for P7 and
below.

llvm-svn: 355920

5 years ago[pstl] Deprecate non-CMake based build
Louis Dionne [Tue, 12 Mar 2019 13:54:37 +0000 (13:54 +0000)]
[pstl] Deprecate non-CMake based build

All of LLVM builds with CMake, so it doesn't make sense to maintain a
separate set of build files just for pstl.

Thanks to Thomas Rodgers for the patch.
Differential Revision: https://reviews.llvm.org/D59111

llvm-svn: 355919

5 years ago[pstl] Properly extract the version number from pstl_config.h
Louis Dionne [Tue, 12 Mar 2019 13:48:25 +0000 (13:48 +0000)]
[pstl] Properly extract the version number from pstl_config.h

Previously, we'd be performing math on `#define PSTL_VERSION NNN` instead
of just `NNN`. It seems like older CMakes didn't complain, but newer
CMakes do complain because it doesn't make sense.

llvm-svn: 355918

5 years ago[XRay][docs] Fix option name
Fangrui Song [Tue, 12 Mar 2019 13:44:42 +0000 (13:44 +0000)]
[XRay][docs] Fix option name

llvm-svn: 355917

5 years ago[PR41007][OpenCL] Allow printf in C++ mode.
Anastasia Stulova [Tue, 12 Mar 2019 12:46:56 +0000 (12:46 +0000)]
[PR41007][OpenCL] Allow printf in C++ mode.

As for OpenCL C, we need to allow using printf and toolchain variadic
functions (prefixed by "__") in C++ mode.

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

llvm-svn: 355915

5 years ago[llvm-objcopy] Remove unneeded checks. NFC
Eugene Leviant [Tue, 12 Mar 2019 12:41:06 +0000 (12:41 +0000)]
[llvm-objcopy] Remove unneeded checks. NFC

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

llvm-svn: 355914

5 years agoRevert rL355906: [SLP] Remove redundancy of performing operand reordering twice:...
Simon Pilgrim [Tue, 12 Mar 2019 11:51:59 +0000 (11:51 +0000)]
Revert rL355906: [SLP] Remove redundancy of performing operand reordering twice: once in buildTree() and later in vectorizeTree().

This is a refactoring patch that removes the redundancy of performing operand reordering twice, once in buildTree() and later in vectorizeTree().
To achieve this we need to keep track of the operands within the TreeEntry struct while building the tree, and later in vectorizeTree() we are just accessing them from the TreeEntry in the right order.

This patch is the first in a series of patches that will allow for better operand reordering across chains of instructions (e.g., a chain of ADDs), as presented here: https://www.youtube.com/watch?v=gIEn34LvyNo

Patch by: @vporpo (Vasileios Porpodas)

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

Reverted due to buildbot failures that I don't have time to track down.

llvm-svn: 355913

5 years agoTry to fix SLPVectorizer BoUpSLP::BoEdgeInfo::dump visibility on non-debug builds
Simon Pilgrim [Tue, 12 Mar 2019 11:31:06 +0000 (11:31 +0000)]
Try to fix SLPVectorizer BoUpSLP::BoEdgeInfo::dump visibility on non-debug builds

llvm-svn: 355912

5 years agoRevert "[analyzer] Fix function macro crash"
Kristof Umann [Tue, 12 Mar 2019 11:22:30 +0000 (11:22 +0000)]
Revert "[analyzer] Fix function macro crash"

Buildbot breaks when LLVm is compiled with memory sanitizer.

WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0xa3d16d8 in getMacroNameAndPrintExpansion(blahblah)
                             lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:903:11
llvm-svn: 355911

5 years ago[LLD][ELF] - Show symbols visibility in "undefined symbol..." error messages.
George Rimar [Tue, 12 Mar 2019 11:10:29 +0000 (11:10 +0000)]
[LLD][ELF] - Show symbols visibility in "undefined symbol..." error messages.

This teaches LLD to report visibility when showing undefined symbol errors
and fixes https://bugs.llvm.org/show_bug.cgi?id=40770.

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

llvm-svn: 355909

5 years ago[ARM][NFC] Delete original smlad tests
Sam Parker [Tue, 12 Mar 2019 11:06:15 +0000 (11:06 +0000)]
[ARM][NFC] Delete original smlad tests

Because I don't understand svn.

llvm-svn: 355908

5 years ago[ARM][NFC] Move smlad tests
Sam Parker [Tue, 12 Mar 2019 11:01:11 +0000 (11:01 +0000)]
[ARM][NFC] Move smlad tests

Created a test/CodeGen/ARM/ParallelDSP folder.

llvm-svn: 355907

5 years ago[SLP] Remove redundancy of performing operand reordering twice: once in buildTree...
Simon Pilgrim [Tue, 12 Mar 2019 10:51:51 +0000 (10:51 +0000)]
[SLP] Remove redundancy of performing operand reordering twice: once in buildTree() and later in vectorizeTree().

This is a refactoring patch that removes the redundancy of performing operand reordering twice, once in buildTree() and later in vectorizeTree().
To achieve this we need to keep track of the operands within the TreeEntry struct while building the tree, and later in vectorizeTree() we are just accessing them from the TreeEntry in the right order.

This patch is the first in a series of patches that will allow for better operand reordering across chains of instructions (e.g., a chain of ADDs), as presented here: https://www.youtube.com/watch?v=gIEn34LvyNo

Patch by: @vporpo (Vasileios Porpodas)

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

llvm-svn: 355906

5 years ago[SimplifyLibCalls] Fix comments about fputs, memchr, and s[n]printf. NFC
Fangrui Song [Tue, 12 Mar 2019 10:31:52 +0000 (10:31 +0000)]
[SimplifyLibCalls] Fix comments about fputs, memchr, and s[n]printf. NFC

llvm-svn: 355905

5 years ago[CGP] Fix UB when GEP is bound to trivial PHINode
Eugene Leviant [Tue, 12 Mar 2019 10:10:29 +0000 (10:10 +0000)]
[CGP] Fix UB when GEP is bound to trivial PHINode

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

llvm-svn: 355904

5 years ago[analyzer] Fix function macro crash
Kristof Umann [Tue, 12 Mar 2019 10:03:32 +0000 (10:03 +0000)]
[analyzer] Fix function macro crash

When there is a functor-like macro which is passed as parameter to another
"function" macro then its parameters are not listed at the place of expansion:

#define foo(x) int bar() { return x; }
#define hello(fvar) fvar(0)
hello(foo)
int main() { 1 / bar(); }

Expansion of hello(foo) asserted Clang, because it expected an l_paren token in
the 3rd line after "foo", since it is a function-like token.

Patch by Tibor Brunner!

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

llvm-svn: 355903

5 years ago[AMDGPU] Add support for immediate operand for S_ENDPGM
David Stuttard [Tue, 12 Mar 2019 09:52:58 +0000 (09:52 +0000)]
[AMDGPU] Add support for immediate operand for S_ENDPGM

Summary:
Add support for immediate operand in S_ENDPGM

Change-Id: I0c56a076a10980f719fb2a8f16407e9c301013f6

Reviewers: alexshap

Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, eraman, arphaman, Petar.Avramovic, llvm-commits

Tags: #llvm

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

llvm-svn: 355902

5 years ago[TTI] Enable analysis of clib functions in getIntrinsicCosts. NFCI.
Sjoerd Meijer [Tue, 12 Mar 2019 09:48:02 +0000 (09:48 +0000)]
[TTI] Enable analysis of clib functions in getIntrinsicCosts. NFCI.

This is addressing the issue that we're not modeling the cost of clib functions
in TTI::getIntrinsicCosts and thus we're basically addressing this fixme:

// FIXME: This is wrong for libc intrinsics.

To enable analysis of clib functions, we not only need an intrinsic ID and
formal arguments, but also the actual user of that function so that we can e.g.
look at alignment and values of arguments. So, this is the initial plumbing to
pass the user of an intrinsinsic on to getCallCosts, which queries
getIntrinsicCosts.

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

llvm-svn: 355901

5 years ago[TableGen] Allow 2^63-1 and 2^63-2 as int literals.
Simon Tatham [Tue, 12 Mar 2019 09:28:19 +0000 (09:28 +0000)]
[TableGen] Allow 2^63-1 and 2^63-2 as int literals.

These two values correspond to the 'Empty' and 'Tombstone' special
keys defined by DenseMapInfo<int64_t>, which means that neither one
can be used as a key in DenseMap<int64_t, anything>. Hence, if you try
to use either of those values as an int literal, IntInit::get() fails
an assertion when it tries to insert them into its static cache of
int-literal objects.

Fixed by replacing the DenseMap with a std::map, which doesn't intrude
on the space of legal values of the key type.

Reviewers: nhaehnle, hfinkel, javedabsar, efriedma

Reviewed By: efriedma

Subscribers: fhahn, efriedma, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 355900

5 years ago[RISCV] Add test cases for the lp64 ABI
Alex Bradbury [Tue, 12 Mar 2019 09:26:53 +0000 (09:26 +0000)]
[RISCV] Add test cases for the lp64 ABI

These are closely modeled on similar tests for the ilp32 ABI. Like those
tests, we group together tests that should be common cross lp64, lp64+lp64f,
and lp64+lp64f+lp64d ABIs.

llvm-svn: 355899

5 years agoCorrectly look up declarations in inline namespaces
Raphael Isemann [Tue, 12 Mar 2019 07:45:04 +0000 (07:45 +0000)]
Correctly look up declarations in inline namespaces

Summary:
This patch marks the inline namespaces from DWARF as inline and also ensures that looking
up declarations now follows the lookup rules for inline namespaces.

Reviewers: aprantl, shafik, serge-sans-paille

Reviewed By: aprantl

Subscribers: eraman, jdoerfert, lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

llvm-svn: 355897

5 years agoFix git-llvm crashing when trying to remove directory while cleaning
Raphael Isemann [Tue, 12 Mar 2019 07:40:54 +0000 (07:40 +0000)]
Fix git-llvm crashing when trying to remove directory while cleaning

Summary:
I'm trying to push D59198 but it seems that `git-llvm push` can't handle the fact
that I add a new directory in the patch:

```
> git llvm push -n
Pushing 1 commit:
  e7c0a9bd136 Correctly look up declarations in inline namespaces
Traceback (most recent call last):
  File "llvm/utils/git-svn//git-llvm", line 431, in <module>
    args.func(args)
  File "llvm/utils/git-svn//git-llvm", line 385, in cmd_push
    clean_svn(svn_root)
  File "llvm/utils/git-svn//git-llvm", line 201, in clean_svn
    os.remove(os.path.join(svn_repo, filename))
IsADirectoryError: [Errno 21] Is a directory: '.git/llvm-upstream-svn/lldb/trunk/packages/Python/lldbsuite/test/expression_command/inline-namespace'
```

This patch just uses shutil to delete the directory instead of trying to use `os.remove`
which only works for files.

Reviewers: mehdi_amini, jlebar

Reviewed By: jlebar

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355896

5 years agoVery minor typo. NFC
Kristina Brooks [Tue, 12 Mar 2019 07:08:19 +0000 (07:08 +0000)]
Very minor typo. NFC

Typo `we we're` => `we were` in the pass EarlyCSE

Patch by liangdzou (Liang ZOU)

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

llvm-svn: 355895

5 years agoFix test to unconditionally create a GNU-format archive.
Eli Friedman [Tue, 12 Mar 2019 02:20:01 +0000 (02:20 +0000)]
Fix test to unconditionally create a GNU-format archive.

On Darwin targets, llvm-ar creates a Darwin format archive by default,
which ld.lld can't read, so it was printing an unexpected error.

llvm-svn: 355894

5 years agoELF: Remove dead code. NFCI.
Peter Collingbourne [Tue, 12 Mar 2019 02:18:03 +0000 (02:18 +0000)]
ELF: Remove dead code. NFCI.

The Live bit is already set to false by SectionBase.

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

llvm-svn: 355893

5 years agollvm-objcopy: Remove unused field. NFCI.
Peter Collingbourne [Tue, 12 Mar 2019 02:17:01 +0000 (02:17 +0000)]
llvm-objcopy: Remove unused field. NFCI.

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

llvm-svn: 355892

5 years ago[Driver] Support object files in addition to static and shared libraries in compiler-rt
Petr Hosek [Tue, 12 Mar 2019 02:12:48 +0000 (02:12 +0000)]
[Driver] Support object files in addition to static and shared libraries in compiler-rt

This change introduces support for object files in addition to static
and shared libraries which were already supported which requires
changing the type of the argument from boolean to an enum.

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

llvm-svn: 355891

5 years ago[DebugInfo] Add test cases for FlagNonTrivial
Aaron Smith [Tue, 12 Mar 2019 02:00:39 +0000 (02:00 +0000)]
[DebugInfo] Add test cases for FlagNonTrivial

Summary:
This is a test case to go with D44406 which added FlagNonTrivial to mark that a C++ record is non-trivial to support CodeView debug emission.

While it looks like FlagTypePassByValue can imply triviality and FlagTypePassByReference can imply non-triviality that is not true. Some non-trivial cases use a combination of FlagNonTrivial and FlagTypePassByValue instead of FlagTypePassByReference. See the test cases and D44406 for discussion.

Reviewers: dblaikie, rnk, zturner

Reviewed By: dblaikie

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355890

5 years agoReland "Relax constraints for reduction vectorization"
Sanjoy Das [Tue, 12 Mar 2019 01:31:44 +0000 (01:31 +0000)]
Reland "Relax constraints for reduction vectorization"

Change from original commit: move test (that uses an X86 triple) into the X86
subdirectory.

Original description:
Gating vectorizing reductions on *all* fastmath flags seems unnecessary;
`reassoc` should be sufficient.

Reviewers: tvvikram, mkuper, kristof.beyls, sdesmalen, Ayal

Reviewed By: sdesmalen

Subscribers: dcaballe, huntergr, jmolloy, mcrosier, jlebar, bixia, llvm-commits

Tags: #llvm

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

llvm-svn: 355889

5 years ago[ELF] Print a better error for an archive containing a non-ELF file.
Eli Friedman [Tue, 12 Mar 2019 01:24:39 +0000 (01:24 +0000)]
[ELF] Print a better error for an archive containing a non-ELF file.

Hopefully gives a more readable error message for the most obvious
mistake.

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

llvm-svn: 355888

5 years ago[CMake] Avoid clang-tablegen-targets dependency when building sphinx docs (experimental)
Jonas Devlieghere [Tue, 12 Mar 2019 00:49:10 +0000 (00:49 +0000)]
[CMake] Avoid clang-tablegen-targets dependency when building sphinx docs (experimental)

Proposal to fix bot
http://lab.llvm.org:8011/builders/lldb-sphinx-docs/builds/1564/steps/cmake-configure/logs/stdio

Patch by: Stefan Gränitz

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

llvm-svn: 355887

5 years agoInclude an archive file name in an error message for a corrupted file.
Rui Ueyama [Tue, 12 Mar 2019 00:24:34 +0000 (00:24 +0000)]
Include an archive file name in an error message for a corrupted file.

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

llvm-svn: 355886

5 years ago[msan] Fix BMI2 detection in msan tests.
Evgeniy Stepanov [Tue, 12 Mar 2019 00:19:09 +0000 (00:19 +0000)]
[msan] Fix BMI2 detection in msan tests.

llvm-svn: 355885

5 years agoAdd a case in SymbolFile{Native,}PDB::TranslateLanguage for Swift
Nathan Lanza [Mon, 11 Mar 2019 23:30:58 +0000 (23:30 +0000)]
Add a case in SymbolFile{Native,}PDB::TranslateLanguage for Swift

Summary: see above

Reviewers: compnerd

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

llvm-svn: 355883

5 years agoAdd Swift enumerator value for CodeView::SourceLanguage
Nathan Lanza [Mon, 11 Mar 2019 23:27:59 +0000 (23:27 +0000)]
Add Swift enumerator value for CodeView::SourceLanguage

Summary:
Swift now generates PDBs for debugging on Windows. llvm and lldb
need a language enumerator value too properly handle the output
emitted by swiftc.

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355882

5 years agoHexagon RDF: Replace function template (plus explicit specializations) with non-templ...
David Blaikie [Mon, 11 Mar 2019 23:10:33 +0000 (23:10 +0000)]
Hexagon RDF: Replace function template (plus explicit specializations) with non-template overloads

For the design in question, overloads seem to be a much simpler and less subtle solution.

This removes ODR issues, and errors of the kind where code that uses the
specialization in question will accidentally and erroneously specialize
the primary template. This only "works" by accident; the program is
ill-formed NDR.

(Found with -Wundefined-func-template.)

Patch by Thomas Köppe!

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

llvm-svn: 355880

5 years ago[Reproducers] Make ReproducerInstrumentation a textual header
Jonas Devlieghere [Mon, 11 Mar 2019 23:09:09 +0000 (23:09 +0000)]
[Reproducers] Make ReproducerInstrumentation a textual header

The RECORD macro is context sensitive because it depends on the
LLDB_GET_INSTRUMENTATION_DATA. This updates the modulemap to mark that
header as textual.

llvm-svn: 355879

5 years agolld-link: Only print demangled symbol names by default
Nico Weber [Mon, 11 Mar 2019 23:02:18 +0000 (23:02 +0000)]
lld-link: Only print demangled symbol names by default

This makes lld-link's output a bit more concise. Since most developers can't
read mangled names, this should make the output a bit easier to understand as
well. It also makes lld-link's output consistent with ld.lld's output.

(link.exe prints both demangled and mangled names; lld-link used to match
link.exe output but now no longer does.)

For people working on toolchains, add a `/demangle:no` flag that makes lld-link
print the mangled name instead of the demangled name. (If desired, people could
pipe that through `demumble -b` to get the old behavior of both demangled and
mangled output.)

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

llvm-svn: 355878

5 years agoAllow optional to tolerate being used with a nested class.
Eric Fiselier [Mon, 11 Mar 2019 22:55:21 +0000 (22:55 +0000)]
Allow optional to tolerate being used with a nested class.

When Clang tries to complete a type containing `std::optional` it
considers the `in_place_t` constructor with no arguments which checks
if the value type is default constructible. If the value type is a
nested class type, then this check occurs too early and poisons the
is_default_constructible trait.

This patch makes optional deduce `in_place_t` so we can prevent
this early SFINAE evaluation. Technically this could break people
doing weird things with the in_place_t tag, but that seems less
important than making the nested class case work.

llvm-svn: 355877

5 years ago[PGO] Add options for context-sensitive PGO
Rong Xu [Mon, 11 Mar 2019 22:51:38 +0000 (22:51 +0000)]
[PGO] Add options for context-sensitive PGO

Add lld options for CSPGO (context-sensitive PGO).

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

llvm-svn: 355876

5 years agoRewrite comment to be clearer
Alex Langford [Mon, 11 Mar 2019 22:49:36 +0000 (22:49 +0000)]
Rewrite comment to be clearer

llvm-svn: 355875

5 years agoRevert "Relax constraints for reduction vectorization"
Sanjoy Das [Mon, 11 Mar 2019 22:37:31 +0000 (22:37 +0000)]
Revert "Relax constraints for reduction vectorization"

This reverts commit r355868.  Breaks hexagon.

llvm-svn: 355873

5 years ago[X86] Remove ProcModel and ProcFeatures tablegen classes. Move all feature lists...
Craig Topper [Mon, 11 Mar 2019 22:29:00 +0000 (22:29 +0000)]
[X86] Remove ProcModel and ProcFeatures tablegen classes. Move all feature lists into a ProcessorFeatures class.

ProcFeatures was a class that just concatenated two feature lists together and gave it a name. We used it to inherit features between CPUs.

ProcModel took a two CPU feature lists and concatenated them before deferring to ProcessorModel. This was to allow inherited features and specific features to be passed to each CPU.

Both of these allowed for only very rigid CPU inheritance rules.

With this patch we now store all of the lists we were using for inheritance in one object and do any list oncatenation we want there. Then we just pass whatever list we want from this class into the ProcessorModel class for each CPU.

Hopefully this gives us more flexibility to build up feature lists in whatever ways we think make sense. Perhaps untangling ISA flags and tuning flags.

I've only touched the CPUs that were directly affected by the removal of the ProcModel and ProcFeatures classes. We should move more of the feature lists into ProcessorFeatures.

llvm-svn: 355872

5 years agoRecommit "[GlobalISel][AArch64] Add selection support for G_EXTRACT_VECTOR_ELT"
Jessica Paquette [Mon, 11 Mar 2019 22:18:01 +0000 (22:18 +0000)]
Recommit "[GlobalISel][AArch64] Add selection support for G_EXTRACT_VECTOR_ELT"

After r355865, we should be able to safely select G_EXTRACT_VECTOR_ELT without
running into any problematic intrinsics.

Also add a fix for lane copies, which don't support index 0.

llvm-svn: 355871

5 years agoRemove ASan asm instrumentation.
Evgeniy Stepanov [Mon, 11 Mar 2019 21:50:10 +0000 (21:50 +0000)]
Remove ASan asm instrumentation.

Summary: It is incomplete and has no users AFAIK.

Reviewers: pcc, vitalybuka

Subscribers: srhines, kubamracek, mgorny, krytarowski, eraman, hiraditya, jdoerfert, #sanitizers, llvm-commits, thakis

Tags: #sanitizers, #llvm

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

llvm-svn: 355870

5 years ago[RISCV] Do a sign-extension in a compare-and-swap of 32 bit in RV64A
Alex Bradbury [Mon, 11 Mar 2019 21:41:22 +0000 (21:41 +0000)]
[RISCV] Do a sign-extension in a compare-and-swap of 32 bit in RV64A

AtomicCmpSwapWithSuccess is legalised into an AtomicCmpSwap plus a comparison.
This requires an extension of the value which, by default, is a
zero-extension. When we later lower AtomicCmpSwap into a PseudoCmpXchg32 and then expanded in
RISCVExpandPseudoInsts.cpp, the lr.w instruction does a sign-extension.

This mismatch of extensions causes the comparison to fail when the compared
value is negative. This change overrides TargetLowering::getExtendForAtomicOps
for RISC-V so it does a sign-extension instead.

Differential Revision: https://reviews.llvm.org/D58829
Patch by Ferran Pallarès Roca.

llvm-svn: 355869

5 years agoRelax constraints for reduction vectorization
Sanjoy Das [Mon, 11 Mar 2019 21:36:41 +0000 (21:36 +0000)]
Relax constraints for reduction vectorization

Summary:
Gating vectorizing reductions on *all* fastmath flags seems unnecessary;
`reassoc` should be sufficient.

Reviewers: tvvikram, mkuper, kristof.beyls, sdesmalen, Ayal

Reviewed By: sdesmalen

Subscribers: dcaballe, huntergr, jmolloy, mcrosier, jlebar, bixia, llvm-commits

Tags: #llvm

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

llvm-svn: 355868

5 years ago[RISCV] Allow fp as an alias of s0
Alex Bradbury [Mon, 11 Mar 2019 21:35:26 +0000 (21:35 +0000)]
[RISCV] Allow fp as an alias of s0

The RISC-V Assembly Programmer's Manual defines fp as another alias of x8.
However, our tablegen rules only recognise s0. This patch adds fp as another
alias of x8. GCC also accepts fp.

Differential Revision: https://reviews.llvm.org/D59209
Patch by Ferran Pallarès Roca.

llvm-svn: 355867

5 years ago[Reproducers] Reinterpret cast to void*
Jonas Devlieghere [Mon, 11 Mar 2019 21:32:20 +0000 (21:32 +0000)]
[Reproducers] Reinterpret cast to void*

Apparently the log_append variant added in r355863 is considered
ambiguous. At this point I'm out of ideas so a good old reinterpret cast
will have to do. If anybody has a better idea I'd be happy to hear it.

llvm-svn: 355866

5 years ago[GlobalISel][AArch64] Always fall back on aarch64.neon.addp.*
Jessica Paquette [Mon, 11 Mar 2019 20:51:17 +0000 (20:51 +0000)]
[GlobalISel][AArch64] Always fall back on aarch64.neon.addp.*

Overloaded intrinsics aren't necessarily safe for instruction selection. One
such intrinsic is aarch64.neon.addp.*.

This is a temporary workaround to ensure that we always fall back on that
intrinsic. Eventually this will be replaced with a proper solution.

https://bugs.llvm.org/show_bug.cgi?id=40968

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

llvm-svn: 355865

5 years ago[RISCV][NFC] Convert some MachineBaiscBlock::iterator(MI) to MI.getIterator()
Alex Bradbury [Mon, 11 Mar 2019 20:43:29 +0000 (20:43 +0000)]
[RISCV][NFC] Convert some MachineBaiscBlock::iterator(MI) to MI.getIterator()

llvm-svn: 355864

5 years ago[Reproducers] Implement log_append for function pointers.
Jonas Devlieghere [Mon, 11 Mar 2019 20:31:21 +0000 (20:31 +0000)]
[Reproducers] Implement log_append for function pointers.

Changing the type in the DUMMY macro to void* doesn't actually fix the
build error, because the argument type is deducted from the template (as
opposed to when serializing through the instrumentation framework, where
this would matter). Instead I've added a proper instance of log_append
that takes function pointers and logs their address.

llvm-svn: 355863

5 years agoRemove esan.
Nico Weber [Mon, 11 Mar 2019 20:23:40 +0000 (20:23 +0000)]
Remove esan.

It hasn't seen active development in years, and it hasn't reached a
state where it was useful.

Remove the code until someone is interested in working on it again.

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

llvm-svn: 355862

5 years agoFix some comment typos.
Med Ismail Bennani [Mon, 11 Mar 2019 20:23:34 +0000 (20:23 +0000)]
Fix some comment typos.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
llvm-svn: 355861

5 years ago[SDAG][AArch64] Legalize VECREDUCE
Nikita Popov [Mon, 11 Mar 2019 20:22:13 +0000 (20:22 +0000)]
[SDAG][AArch64] Legalize VECREDUCE

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

Implement basic legalizations (PromoteIntRes, PromoteIntOp,
ExpandIntRes, ScalarizeVecOp, WidenVecOp) for VECREDUCE opcodes.
There are more legalizations missing (esp float legalizations),
but there's no way to test them right now, so I'm not adding them.

This also includes a few more changes to make this work somewhat
reasonably:

 * Add support for expanding VECREDUCE in SDAG. Usually
   experimental.vector.reduce is expanded prior to codegen, but if the
   target does have native vector reduce, it may of course still be
   necessary to expand due to legalization issues. This uses a shuffle
   reduction if possible, followed by a naive scalar reduction.
 * Allow the result type of integer VECREDUCE to be larger than the
   vector element type. For example we need to be able to reduce a v8i8
   into an (nominally) i32 result type on AArch64.
 * Use the vector operand type rather than the scalar result type to
   determine the action, so we can control exactly which vector types are
   supported. Also change the legalize vector op code to handle
   operations that only have vector operands, but no vector results, as
   is the case for VECREDUCE.
 * Default VECREDUCE to Expand. On AArch64 (only target using VECREDUCE),
   explicitly specify for which vector types the reductions are supported.

This does not handle anything related to VECREDUCE_STRICT_*.

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

llvm-svn: 355860

5 years ago[OPENMP]Fix codegen for declare target link in target regions.
Alexey Bataev [Mon, 11 Mar 2019 19:51:42 +0000 (19:51 +0000)]
[OPENMP]Fix codegen for declare target link in target regions.

If the declare target link global is used in the target region
indirectly (used in the inner parallel, teams, etc. regions), we may
miss this variable and it leads to incorrect codegen.

llvm-svn: 355858

5 years agogn build: Merge r355777
Nico Weber [Mon, 11 Mar 2019 19:30:13 +0000 (19:30 +0000)]
gn build: Merge r355777

llvm-svn: 355857

5 years agogn build: Merge r355835
Nico Weber [Mon, 11 Mar 2019 19:14:22 +0000 (19:14 +0000)]
gn build: Merge r355835

llvm-svn: 355856

5 years agogn build: Merge r355834
Nico Weber [Mon, 11 Mar 2019 19:11:15 +0000 (19:11 +0000)]
gn build: Merge r355834

llvm-svn: 355855

5 years ago[RegAlloc] Avoid compile time regression with multiple copy hints.
Jonas Paulsson [Mon, 11 Mar 2019 19:00:37 +0000 (19:00 +0000)]
[RegAlloc]  Avoid compile time regression with multiple copy hints.

As a fix for https://bugs.llvm.org/show_bug.cgi?id=40986 ("excessive compile
time building opencollada"), this patch makes sure that no phys reg is hinted
more than once from getRegAllocationHints().

This handles the case were many virtual registers are assigned to the same
physreg. The previous compile time fix (r343686) in weightCalcHelper() only
made sure that physical/virtual registers are passed no more than once to
addRegAllocationHint().

Review: Dimitry Andric, Quentin Colombet
https://reviews.llvm.org/D59201

llvm-svn: 355854

5 years ago[clang] Add install targets for API headers
Shoaib Meenai [Mon, 11 Mar 2019 18:53:57 +0000 (18:53 +0000)]
[clang] Add install targets for API headers

Add an install target for clang's API headers, which allows them to be
included in distributions. The install rules already existed, but they
lacked a component and a target, making them only accessible via a full
install. These headers are useful for writing clang-based tooling, for
example. They're the clang equivalent to the llvm-headers target and
complement the clang-libraries target.

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

llvm-svn: 355853

5 years ago[coroutines][PR40979] Ignore unreachable uses across suspend points
Brian Gesiak [Mon, 11 Mar 2019 18:31:28 +0000 (18:31 +0000)]
[coroutines][PR40979] Ignore unreachable uses across suspend points

Summary:
Depends on https://reviews.llvm.org/D59069.

https://bugs.llvm.org/show_bug.cgi?id=40979 describes a bug in which the
-coro-split pass would assert that a use was across a suspend point from
a definition. Normally this would mean that a value would "spill" across
a suspend point and thus need to be stored in the coroutine frame. However,
in this case the use was unreachable, and so it would not be necessary
to store the definition on the frame.

To prevent the assert, simply remove unreachable basic blocks from a
coroutine function before computing spills. This avoids the assert
reported in PR40979.

Reviewers: GorNishanov, tks2103

Reviewed By: GorNishanov

Subscribers: EricWF, jdoerfert, llvm-commits, lewissbaker

Tags: #llvm

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

llvm-svn: 355852

5 years agoDetect malformed LC_LINKER_COMMANDs in Mach-O binaries
Michael Trent [Mon, 11 Mar 2019 18:29:25 +0000 (18:29 +0000)]
Detect malformed LC_LINKER_COMMANDs in Mach-O binaries

Summary:
llvm-objdump can be tricked into reading beyond valid memory and
segfaulting if LC_LINKER_COMMAND strings are not null terminated. libObject
does have code to validate the integrity of the LC_LINKER_COMMAND struct,
but this validator improperly assumes linker command strings are null
terminated.

The solution is to report an error if a string extends beyond the end of
the LC_LINKER_COMMAND struct.

Reviewers: lhames, pete

Reviewed By: pete

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 355851

5 years agoFix a crasher in StackFrame::GetValueForVariableExpressionPath()
Greg Clayton [Mon, 11 Mar 2019 18:16:20 +0000 (18:16 +0000)]
Fix a crasher in StackFrame::GetValueForVariableExpressionPath()

There was a crash that would happen if an IDE would ask for a child of a shared pointer via any SB API call that ends up calling StackFrame::GetValueForVariableExpressionPath(). The previous code expects an error to be set describing why the synthetic child of a type was not able to be found, but we have some synthetic child providers that weren't setting the error and returning an empty value object shared pointer. This fixes that to ensure we don't lose our debug session by crashing, fully tests GetValueForVariableExpressionPath functionality, and ensures we don't crash on GetValueForVariableExpressionPath() in the future.

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

llvm-svn: 355850

5 years ago[X86] Extend widening comparison test.
Simon Pilgrim [Mon, 11 Mar 2019 18:08:20 +0000 (18:08 +0000)]
[X86] Extend widening comparison test.

Ensure we test both v2i16 unary and binary comparisons.

llvm-svn: 355849

5 years ago[NFC][PowerPC] Add comment for PPCAsmPrinter::printOperand
Jinsong Ji [Mon, 11 Mar 2019 17:57:49 +0000 (17:57 +0000)]
[NFC][PowerPC] Add comment for PPCAsmPrinter::printOperand

Patch by Yi-Hong Lyu

llvm-svn: 355848

5 years ago[DAG] FoldSetCC - reuse valuetype + ensure its simple.
Simon Pilgrim [Mon, 11 Mar 2019 17:56:18 +0000 (17:56 +0000)]
[DAG] FoldSetCC - reuse valuetype + ensure its simple.

llvm-svn: 355847

5 years ago[Utils] Extract EliminateUnreachableBlocks (NFC)
Brian Gesiak [Mon, 11 Mar 2019 17:51:57 +0000 (17:51 +0000)]
[Utils] Extract EliminateUnreachableBlocks (NFC)

Summary:
Extract the functionality of eliminating unreachable basic blocks
within a function, previously encapsulated within the
-unreachableblockelim pass, and make it available as a function within
BlockUtils.h. No functional change intended other than making the logic
reusable.

Exposing this logic makes it easier to implement
https://reviews.llvm.org/D59068, which fixes coroutines bug
https://bugs.llvm.org/show_bug.cgi?id=40979.

Reviewers: mkazantsev, wmi, davidxl, silvas, davide

Reviewed By: davide

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355846

5 years ago[DAG] Move SetCC NaN handling into FoldSetCC
Simon Pilgrim [Mon, 11 Mar 2019 17:43:10 +0000 (17:43 +0000)]
[DAG] Move SetCC NaN handling into FoldSetCC

llvm-svn: 355845

5 years ago[HWASan] Remove address significance from tag_mismatch.
Mitch Phillips [Mon, 11 Mar 2019 17:34:17 +0000 (17:34 +0000)]
[HWASan] Remove address significance from tag_mismatch.

Actually fix the issue referenced in rL355840.

llvm-svn: 355844

5 years agoMakefile.rules: Upstream SDKROOT handling code for Darwin.
Adrian Prantl [Mon, 11 Mar 2019 17:24:10 +0000 (17:24 +0000)]
Makefile.rules: Upstream SDKROOT handling code for Darwin.

llvm-svn: 355843

5 years ago[Reproducers] Replace callbacks with void*
Jonas Devlieghere [Mon, 11 Mar 2019 17:17:51 +0000 (17:17 +0000)]
[Reproducers] Replace callbacks with void*

Callbacks in the LLDB_RECORD_DUMMY macros were causing build failures
with the Xcode project. This patch replaces the function pointers with
void pointers so they can be logged.

llvm-svn: 355842

5 years agoBring Doxygen comment syntax in sync with LLVM coding style.
Adrian Prantl [Mon, 11 Mar 2019 17:09:29 +0000 (17:09 +0000)]
Bring Doxygen comment syntax in sync with LLVM coding style.
This changes '@' prefix to '\'.

llvm-svn: 355841

5 years ago[HWASan] Fixed minor AArch64/GCC build error.
Mitch Phillips [Mon, 11 Mar 2019 17:06:39 +0000 (17:06 +0000)]
[HWASan] Fixed minor AArch64/GCC build error.

Fixed buildbot clang-cmake-aarch64-lld by ensuring clang-only features
are guarded by clang-only #defines.

llvm-svn: 355840

5 years agoUse bitset for assembler predicates
Stanislav Mekhanoshin [Mon, 11 Mar 2019 17:04:35 +0000 (17:04 +0000)]
Use bitset for assembler predicates

AMDGPU target run out of Subtarget feature flags hitting the limit of 64.
AssemblerPredicates uses at most uint64_t for their representation.
At the same time CodeGen has exhausted this a long time ago and switched
to a FeatureBitset with the current limit of 192 bits.

This patch completes transition to the bitset for feature bits extending
it to asm matcher and MC code emitter.

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

llvm-svn: 355839

5 years ago[lldb] [test] Mark more tests flakey on NetBSD
Michal Gorny [Mon, 11 Mar 2019 17:01:31 +0000 (17:01 +0000)]
[lldb] [test] Mark more tests flakey on NetBSD

llvm-svn: 355838

5 years ago[TableGen] Replace a dyn_cast with isa to avoid an unused variable warning introduced...
Craig Topper [Mon, 11 Mar 2019 16:51:37 +0000 (16:51 +0000)]
[TableGen] Replace a dyn_cast with isa to avoid an unused variable warning introduced in r355785. NFC

llvm-svn: 355837

5 years ago[AMDGPU] Mark enum types in SIDefines.h as unsigned
Stanislav Mekhanoshin [Mon, 11 Mar 2019 16:49:32 +0000 (16:49 +0000)]
[AMDGPU] Mark enum types in SIDefines.h as unsigned

MSVC issues some warnings about signed/unsigned comparison.

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

llvm-svn: 355836

5 years ago[clang-tidy] Add the abseil-time-compare check
Hyrum Wright [Mon, 11 Mar 2019 16:47:45 +0000 (16:47 +0000)]
[clang-tidy] Add the abseil-time-compare check

This is an analog of the abseil-duration-comparison check, but for the
absl::Time domain. It has a similar implementation and tests.

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

llvm-svn: 355835

5 years agoFail early if an output file is not writable
Rui Ueyama [Mon, 11 Mar 2019 16:30:55 +0000 (16:30 +0000)]
Fail early if an output file is not writable

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

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

llvm-svn: 355834

5 years ago[SimplifyCFG] Retain debug info when threading jumps with critical edges
Jeremy Morse [Mon, 11 Mar 2019 16:23:59 +0000 (16:23 +0000)]
[SimplifyCFG] Retain debug info when threading jumps with critical edges

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

The SimplifyCFG pass will perform jump threading in some cases where
doing so is trivial and would simplify the CFG. When folding a series
of blocks with redundant conditional branches into an unconditional "critical
edge" block, it does not keep the debug location associated with the previous
conditional branch.

This patch fixes the bug described by copying the debug info from the
old conditional branch to the new unconditional branch instruction, and
adds a regression test for the SimplifyCFG pass that covers this case.

Patch by Stephen Tozer!

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

llvm-svn: 355833

5 years ago[yaml2obj] - Simplify. NFC.
George Rimar [Mon, 11 Mar 2019 16:10:02 +0000 (16:10 +0000)]
[yaml2obj] - Simplify. NFC.

llvm-svn: 355832

5 years agoclang-format: distinguish ObjC call subexpressions after r355434
Krasimir Georgiev [Mon, 11 Mar 2019 16:02:52 +0000 (16:02 +0000)]
clang-format: distinguish ObjC call subexpressions after r355434

Summary:
The revision r355434 had the unfortunate side-effect that it started to
recognize certain ObjC expressions with a call subexpression followed by a
`a->b` subexpression as C++ lambda expressions.

This patch adds a bit of logic to handle these cases and documents them in
tests.

The commented-out test cases in the new test suite are ones that were
problematic before r355434.

Reviewers: MyDeveloperDay, gribozavr

Reviewed By: MyDeveloperDay, gribozavr

Subscribers: MyDeveloperDay, cfe-commits

Tags: #clang

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

llvm-svn: 355831

5 years ago[lldb] [test] Mark a few tests flakey on NetBSD
Michal Gorny [Mon, 11 Mar 2019 15:46:07 +0000 (15:46 +0000)]
[lldb] [test] Mark a few tests flakey on NetBSD

llvm-svn: 355830

5 years ago[libc++] Remove empty header xlocale/xlocale.h
Louis Dionne [Mon, 11 Mar 2019 15:41:51 +0000 (15:41 +0000)]
[libc++] Remove empty header xlocale/xlocale.h

Summary:
I can't think of a reason for shipping this empty header. If there is
a reason to do so, then hopefully this review can uncover it.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 355829

5 years ago[DAG] TargetLowering::SimplifySetCC - call FoldSetCC early to handle constant/commute...
Simon Pilgrim [Mon, 11 Mar 2019 15:01:31 +0000 (15:01 +0000)]
[DAG] TargetLowering::SimplifySetCC - call FoldSetCC early to handle constant/commute folds.

Noticed while looking at PR40800 (and also D57921)

llvm-svn: 355828

5 years agoAttempt to fix MSVC build error after r355824
Pavel Labath [Mon, 11 Mar 2019 15:00:11 +0000 (15:00 +0000)]
Attempt to fix MSVC build error after r355824

Adding parens should be enough to fix the "'operator bool': is
ambiguous or is not a member of 'lldb::SBFoo'" errors.

llvm-svn: 355827

5 years ago[MIPS][microMIPS] Add a pattern to match TruncIntFP
Petar Jovanovic [Mon, 11 Mar 2019 14:13:31 +0000 (14:13 +0000)]
[MIPS][microMIPS] Add a pattern to match TruncIntFP

A pattern needed to match TruncIntFP was missing. This was causing multiple
tests from llvm test suite to fail during compilation for micromips.

Patch by Mirko Brkusanin.

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

llvm-svn: 355825

5 years agoAdd "operator bool" to SB APIs
Pavel Labath [Mon, 11 Mar 2019 13:58:46 +0000 (13:58 +0000)]
Add "operator bool" to SB APIs

Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.

This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.

In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.

Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 355824

5 years ago[CGP] Limit distance between overflow math and cmp
Sam Parker [Mon, 11 Mar 2019 13:19:46 +0000 (13:19 +0000)]
[CGP] Limit distance between overflow math and cmp

Inserting an overflowing arithmetic intrinsic can increase register
pressure by producing two values at a point where only one is needed,
while the second use maybe several blocks away. This increase in
pressure is likely to be more detrimental on performance than
rematerialising one of the original instructions.

So, check that the arithmetic and compare instructions are no further
apart than their immediate successor/predecessor.

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

llvm-svn: 355823

5 years ago[JumpThreading] Retain debug info when replacing branch instructions
Jeremy Morse [Mon, 11 Mar 2019 11:48:57 +0000 (11:48 +0000)]
[JumpThreading] Retain debug info when replacing branch instructions

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

The Jump Threading pass will replace certain conditional branch
instructions with unconditional branches when it can prove that only one
branch can occur. Prior to this patch, it would not carry the debug
info from the old instruction to the new one.

This patch fixes the bug described by copying the debug info from the
conditional branch instruction to the new unconditional branch
instruction, and adds a regression test for the Jump Threading pass that
covers this case.

Patch by Stephen Tozer!

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

llvm-svn: 355822

5 years ago[llvm-objcopy] - Fix --compress-debug-sections when there are relocations.
George Rimar [Mon, 11 Mar 2019 11:01:24 +0000 (11:01 +0000)]
[llvm-objcopy] - Fix --compress-debug-sections when there are relocations.

When --compress-debug-sections is given,
llvm-objcopy removes the uncompressed sections and adds compressed to the section list.
This makes all the pointers to old sections to be outdated.

Currently, code already has logic for replacing the target sections of the relocation
sections. But we also have to update the relocations by themselves.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40885.

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

llvm-svn: 355821

5 years ago[clangd] Respect Origin option in createStaticIndexingAction
Kadir Cetinkaya [Mon, 11 Mar 2019 11:01:14 +0000 (11:01 +0000)]
[clangd] Respect Origin option in createStaticIndexingAction

Summary:
Currently createStaticIndexingAction always set Origin to Static, which
makes it hard to change it later on by different indexers(One needs to go over
each symbol making a new copy).

This patch changes that behavior to rather respect it if set by user.

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 355820

5 years agoRemove an unnecessary -f when cp'ing to a file that was just deleted. NFC.
Benjamin Kramer [Mon, 11 Mar 2019 10:44:10 +0000 (10:44 +0000)]
Remove an unnecessary -f when cp'ing to a file that was just deleted. NFC.

llvm-svn: 355819

5 years ago[MIPS GlobalISel] Silence uninitialized variable warning
Benjamin Kramer [Mon, 11 Mar 2019 10:39:15 +0000 (10:39 +0000)]
[MIPS GlobalISel] Silence uninitialized variable warning

The control flow here cannot ever use the uninitialized value, but it's
too hard for the compiler to figure that out. Clang warns:

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2600:28: error: variable 'CarrySum' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized]
      for (unsigned i = 2; i < Factors.size(); ++i)
                           ^~~~~~~~~~~~~~~~~~
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2604:26: note: uninitialized use occurs here
    CarrySumPrevDstIdx = CarrySum;
                         ^~~~~~~~
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2600:28: note: remove the condition if it is always true
      for (unsigned i = 2; i < Factors.size(); ++i)
                           ^~~~~~~~~~~~~~~~~~
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2583:22: note: initialize the variable 'CarrySum' to silence this warning
    unsigned CarrySum;
                     ^
                      = 0

llvm-svn: 355818

5 years agoFix invalid use of StringRef::data in Socket::DecodeHostAndPort
Pavel Labath [Mon, 11 Mar 2019 10:34:57 +0000 (10:34 +0000)]
Fix invalid use of StringRef::data in Socket::DecodeHostAndPort

the input StringRef is not guaranteed to be null-terminated, so using
data to get the c string is wrong. Luckily, in two of the usages the
target function already accepts a StringRef so we can just drop the
data() call, and the third one is easily replaced by a stringref-aware
function.

Issue found by msan.

llvm-svn: 355817

5 years ago[Serialization] Add missing include
Benjamin Kramer [Mon, 11 Mar 2019 10:30:51 +0000 (10:30 +0000)]
[Serialization] Add missing include

forward decl is not sufficient for destroying a unique_ptr<MemoryBuffer>.

llvm-svn: 355816

5 years ago[MIPS GlobalISel] NarrowScalar G_UMULH
Petar Avramovic [Mon, 11 Mar 2019 10:08:44 +0000 (10:08 +0000)]
[MIPS GlobalISel] NarrowScalar G_UMULH

NarrowScalar G_UMULH in LegalizerHelper
using multiplyRegisters helper function.
NarrowScalar G_UMULH for MIPS32.

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

llvm-svn: 355815

5 years ago[MIPS GlobalISel] NarrowScalar G_MUL
Petar Avramovic [Mon, 11 Mar 2019 10:00:17 +0000 (10:00 +0000)]
[MIPS GlobalISel] NarrowScalar G_MUL

Narrow Scalar G_MUL for MIPS32.
Revisit NarrowScalar implementation in LegalizerHelper.
Introduce new helper function multiplyRegisters.
It performs generic multiplication of values held in multiple registers.
Generated instructions use only types NarrowTy and i1.
Destination can be same or two times size of the source.

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

llvm-svn: 355814