platform/upstream/llvm.git
5 years agoAdd the abseil-duration-factory-scale check.
Aaron Ballman [Sun, 18 Nov 2018 16:41:06 +0000 (16:41 +0000)]
Add the abseil-duration-factory-scale check.

This check removes unneeded scaling of arguments when calling Abseil Time factory functions.

Patch by Hyrum Wright.

llvm-svn: 347163

5 years ago[X86][SSE] Relax IsSplatValue - remove the 'variable shift' limit on subtracts.
Simon Pilgrim [Sun, 18 Nov 2018 15:52:08 +0000 (15:52 +0000)]
[X86][SSE] Relax IsSplatValue - remove the 'variable shift' limit on subtracts.

Means we don't use the per-lane-shifts as much when we can cheaply use the older splat-variable-shifts.

llvm-svn: 347162

5 years ago[x86] make tests immune to improvements in undef handling
Sanjay Patel [Sun, 18 Nov 2018 15:27:19 +0000 (15:27 +0000)]
[x86] make tests immune to improvements in undef handling

llvm-svn: 347161

5 years ago[SelectionDAG] simplify code; NFC
Sanjay Patel [Sun, 18 Nov 2018 14:39:03 +0000 (14:39 +0000)]
[SelectionDAG] simplify code; NFC

llvm-svn: 347160

5 years ago[X86][SSE] Add some generic masked gather codegen tests
Simon Pilgrim [Sun, 18 Nov 2018 14:35:57 +0000 (14:35 +0000)]
[X86][SSE] Add some generic masked gather codegen tests

llvm-svn: 347159

5 years ago[X86][SSE] Use raw shuffle mask decode in SimplifyDemandedVectorEltsForTargetNode...
Simon Pilgrim [Sun, 18 Nov 2018 13:34:53 +0000 (13:34 +0000)]
[X86][SSE] Use raw shuffle mask decode in SimplifyDemandedVectorEltsForTargetNode (PR39549)

We were using the 'normalized' shuffle mask from resolveTargetShuffleInputs, which replaces zero/undef inputs with sentinel values. For SimplifyDemandedVectorElts we need the raw mask so we can correctly demand those 'zero' inputs that got normalized away, this requires an extra bit of logic to locally normalize undef inputs.

llvm-svn: 347158

5 years ago[analyzer][NFC] Move CheckerOptInfo to CheckerRegistry.cpp, and make it local
Kristof Umann [Sun, 18 Nov 2018 12:47:03 +0000 (12:47 +0000)]
[analyzer][NFC] Move CheckerOptInfo to CheckerRegistry.cpp, and make it local

CheckerOptInfo feels very much out of place in CheckerRegistration.cpp, so I
moved it to CheckerRegistry.h.

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

llvm-svn: 347157

5 years agoSwap order of discovering of -ltinfo and -lterminfo
Kamil Rytarowski [Sun, 18 Nov 2018 12:13:51 +0000 (12:13 +0000)]
Swap order of discovering of -ltinfo and -lterminfo

Summary:
NetBSD ships with native curses(3) and -ltinfo is a part of ncurses.
Set -lterminfo before -ltinfo, as it allows to prioritize native curses
libraries. Mixing curses and ncurses does not work well, especially
in software built on top of llvm.

Original patch by Ryo Onodera (NetBSD) in pkgsrc.

Reviewers: labath, dim, mgorny

Reviewed By: dim, mgorny

Subscribers: llvm-commits

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

llvm-svn: 347156

5 years ago[WebAssembly] Add null streamer support
Heejin Ahn [Sun, 18 Nov 2018 11:58:47 +0000 (11:58 +0000)]
[WebAssembly] Add null streamer support

Summary: Now `llc -filetype=null` works.

Reviewers: eush

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

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

llvm-svn: 347155

5 years ago[WebAssembly] Add equality comparison operators for WasmEventType
Heejin Ahn [Sun, 18 Nov 2018 11:53:35 +0000 (11:53 +0000)]
[WebAssembly] Add equality comparison operators for WasmEventType

Summary:
This was missing in D54096. Independent tests for this is not available
here, because these are used in lld.

Reviewers: sbc100

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

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

llvm-svn: 347154

5 years ago[analyzer][UninitializedObjectChecker] Uninit regions are only reported once
Kristof Umann [Sun, 18 Nov 2018 11:34:10 +0000 (11:34 +0000)]
[analyzer][UninitializedObjectChecker] Uninit regions are only reported once

Especially with pointees, a lot of meaningless reports came from uninitialized
regions that were already reported. This is fixed by storing all reported fields
to the GDM.

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

llvm-svn: 347153

5 years agocmake: z3: Remove EXACT from 4.7.1 after being compatible with 4.8.1
Jan Kratochvil [Sun, 18 Nov 2018 09:36:36 +0000 (09:36 +0000)]
cmake: z3: Remove EXACT from 4.7.1 after being compatible with 4.8.1

After check-in of D54391 a comment there by @mikhail.ramalho says:
Since we're supporting version 4.8.1 now, the cmake file should be changed to
"minimum" instead of "exact".

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

llvm-svn: 347152

5 years ago[X86] Add -x86-experimental-vector-widening-legalization check to combineSelect and...
Craig Topper [Sun, 18 Nov 2018 08:30:09 +0000 (08:30 +0000)]
[X86] Add -x86-experimental-vector-widening-legalization check to combineSelect and combineSetCC to cover vXi16/vXi8 promotion without BWI.

I don't yet have any test cases for this, but its the right thing to do based on log file inspection.

llvm-svn: 347151

5 years ago[X86] Rename WidenMaskArithmetic->PromoteMaskArithmetic since we usually use widen...
Craig Topper [Sun, 18 Nov 2018 07:35:08 +0000 (07:35 +0000)]
[X86] Rename WidenMaskArithmetic->PromoteMaskArithmetic since we usually use widen to refer to adding elements not making elements larger. NFC

llvm-svn: 347150

5 years ago[X86] Don't use a pmaddwd for vXi32 multiply if the inputs are zero extends from...
Craig Topper [Sun, 18 Nov 2018 05:53:21 +0000 (05:53 +0000)]
[X86] Don't use a pmaddwd for vXi32 multiply if the inputs are zero extends from i8 or smaller without SSE4.1. Prefer to shrink the mul instead.

The zero extend will require two stages of unpacks to implement. So its better to shrink the multiply using pmullw and then extend that result back to v4i32 using a single unpack.

llvm-svn: 347149

5 years agotighten up a couple of assertions. hitting the BitPosition == BitWidth case that...
John Regehr [Sun, 18 Nov 2018 01:51:43 +0000 (01:51 +0000)]
tighten up a couple of assertions. hitting the BitPosition == BitWidth case that was previously not caught resulted in nasty corruption of APInts that (on my system at least) could not be detected using UBSan, ASan, or Valgrind. this patch does not cause any extra failures in a check-all nor does it interfere with bootstrapping. David Blaikie informally approved this change.

llvm-svn: 347148

5 years ago[CorrelatedValuePropagation] Preserve debug locations (PR38178)
Vedant Kumar [Sun, 18 Nov 2018 00:29:58 +0000 (00:29 +0000)]
[CorrelatedValuePropagation] Preserve debug locations (PR38178)

Fix all of the missing debug location errors in CVP found by debugify.

This includes the missing-location-after-udiv-truncation case described
in llvm.org/PR38178.

llvm-svn: 347147

5 years agoFix bot failure from r347145
Teresa Johnson [Sat, 17 Nov 2018 20:41:45 +0000 (20:41 +0000)]
Fix bot failure from r347145

The #if check around the statistics computation gave an error about
the statistic being an unused variable. Instead, guard with
AreStatisticsEnabled().

llvm-svn: 347146

5 years ago[ThinLTO] Add some stats for read only variable internalization
Teresa Johnson [Sat, 17 Nov 2018 20:03:22 +0000 (20:03 +0000)]
[ThinLTO] Add some stats for read only variable internalization

Summary:
Follow up to D49362 ([ThinLTO] Internalize read only globals). Add a
statistic on the number of read only variables (only counting live
variables since dead variables will be dropped anyway).

Reviewers: evgeny777

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits

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

llvm-svn: 347145

5 years ago[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter...
Calixte Denizet [Sat, 17 Nov 2018 19:41:39 +0000 (19:41 +0000)]
[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter the files to instrument with gcov (after revert https://reviews.llvm.org/rL346659)

Summary:
the previous patch (https://reviews.llvm.org/rC346642) has been reverted because of test failure under windows.
So this patch fix the test cfe/trunk/test/CodeGen/code-coverage-filter.c.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: cfe-commits, sylvestre.ledru

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

llvm-svn: 347144

5 years ago[X86] Add support for matching PACKUSWB from a v64i8 shuffle.
Craig Topper [Sat, 17 Nov 2018 18:54:43 +0000 (18:54 +0000)]
[X86] Add support for matching PACKUSWB from a v64i8 shuffle.

llvm-svn: 347143

5 years ago[X86] Add test case to show missed opportunity to use PACKUSWB in v64i8 shuffle lowering.
Craig Topper [Sat, 17 Nov 2018 18:54:41 +0000 (18:54 +0000)]
[X86] Add test case to show missed opportunity to use PACKUSWB in v64i8 shuffle lowering.

llvm-svn: 347142

5 years agoSink BuryPointer from Clang into LLVM for reuse there
David Blaikie [Sat, 17 Nov 2018 18:04:13 +0000 (18:04 +0000)]
Sink BuryPointer from Clang into LLVM for reuse there

llvm-svn: 347141

5 years agoMove BuryPointer from Clang to LLVM for use in other LLVM tools
David Blaikie [Sat, 17 Nov 2018 18:03:47 +0000 (18:03 +0000)]
Move BuryPointer from Clang to LLVM for use in other LLVM tools

Specifically planning to use this in llvm-symbolizer to remove the cost
of cleanup there.

llvm-svn: 347140

5 years ago[X86][SSE] Add shuffle demanded elts test case for PR39549
Simon Pilgrim [Sat, 17 Nov 2018 14:06:03 +0000 (14:06 +0000)]
[X86][SSE] Add shuffle demanded elts test case for PR39549

llvm-svn: 347139

5 years ago[AST][NFC] Pack CXXDefaultInitExpr
Bruno Ricci [Sat, 17 Nov 2018 13:02:47 +0000 (13:02 +0000)]
[AST][NFC] Pack CXXDefaultInitExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXDefaultInitExpr.

llvm-svn: 347138

5 years ago[AST][NFC] Pack CXXDefaultArgExpr
Bruno Ricci [Sat, 17 Nov 2018 12:56:30 +0000 (12:56 +0000)]
[AST][NFC] Pack CXXDefaultArgExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXDefaultArgExpr.

llvm-svn: 347137

5 years ago[AST][NFC] Pack CXXThrowExpr
Bruno Ricci [Sat, 17 Nov 2018 12:53:56 +0000 (12:53 +0000)]
[AST][NFC] Pack CXXThrowExpr

Use the newly available space in the bit-fields of Stmt.
This saves 8 bytes per CXXThrowExpr.

llvm-svn: 347136

5 years ago[llvm-objdump] Print a blank row at the end of sections
Xing GUO [Sat, 17 Nov 2018 08:12:48 +0000 (08:12 +0000)]
[llvm-objdump] Print a blank row at the end of sections

Summary:
When using option `-x` (--all-headers), it will print `Sections`, `Symbol Table`, `Program Header` ...
`Sections` and `Symbol Table` will be connected together.

Before:
```
Sections:
Idx Name          Size      Address          Type
  0               00000000 0000000000000000
  ...
  29 .shstrtab     0000011a 0000000000000000
SYMBOL TABLE:
  ...
```

After:
```
Sections:
Idx Name          Size      Address          Type
  0               00000000 0000000000000000
  ...
  29 .shstrtab     0000011a 0000000000000000

SYMBOL TABLE:
  ...
```

Reviewers: Higuoxing

Reviewed By: Higuoxing

Subscribers: llvm-commits, jhenderson

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

llvm-svn: 347135

5 years agollvm-symbolizer: Avoid calling getFromOffset when the index entry is already available
David Blaikie [Sat, 17 Nov 2018 05:57:58 +0000 (05:57 +0000)]
llvm-symbolizer: Avoid calling getFromOffset when the index entry is already available

Especially for symbolizer it can be efficient to have to search through
the entire index when it isn't needed - llvm-symbolizer looks up only a
few CUs & already has an index available in getUnitForEntry, once it's
passed down to DWARFUnitHeader::extract then there's no need for it to
call getFromOffset.

llvm-svn: 347134

5 years agoFix unused variable warning.
David L. Jones [Sat, 17 Nov 2018 04:48:54 +0000 (04:48 +0000)]
Fix unused variable warning.

llvm-svn: 347133

5 years ago[clang-tidy/checks] Implement a clang-tidy check to verify Google Objective-C functio...
Stephane Moore [Sat, 17 Nov 2018 02:37:21 +0000 (02:37 +0000)]
[clang-tidy/checks] Implement a clang-tidy check to verify Google Objective-C function naming conventions ðŸ“œ

Summary:
§1 Description

This check finds function names in function declarations in Objective-C files that do not follow the naming pattern described in the Google Objective-C Style Guide. Function names should be in UpperCamelCase and functions that are not of static storage class should have an appropriate prefix as described in the Google Objective-C Style Guide. The function `main` is a notable exception. Function declarations in expansions in system headers are ignored.

Example conforming function definitions:
```
static bool IsPositive(int i) { return i > 0; }
static bool ABIsPositive(int i) { return i > 0; }
bool ABIsNegative(int i) { return i < 0; }
```

A fixit hint is generated for functions of static storage class but otherwise the check does not generate a fixit hint because an appropriate prefix for the function cannot be determined.

§2 Test Notes
* Verified clang-tidy tests pass successfully.
* Used check_clang_tidy.py to verify expected output of processing google-objc-function-naming.m

Reviewers: benhamilton, hokein, Wizard, aaron.ballman

Reviewed By: benhamilton

Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 347132

5 years ago[X86] Don't extend v32i8 multiplies to v32i16 with avx512bw and prefer-vector-width...
Craig Topper [Sat, 17 Nov 2018 02:36:07 +0000 (02:36 +0000)]
[X86] Don't extend v32i8 multiplies to v32i16 with avx512bw and prefer-vector-width=256.

llvm-svn: 347131

5 years ago[X86] Add test cases to show incorrect use of a 512 bit vector in v32i8 multiply...
Craig Topper [Sat, 17 Nov 2018 02:36:02 +0000 (02:36 +0000)]
[X86] Add test cases to show incorrect use of a 512 bit vector in v32i8 multiply lowering with prefer-vector-width=256.

On the min-legal-vector-width test this actually causes some of the v32i16 operations we emitted to be scalarized.

llvm-svn: 347130

5 years agoReverted r347092 due to the following build fails:
Vyacheslav Zakharin [Sat, 17 Nov 2018 02:26:34 +0000 (02:26 +0000)]
Reverted r347092 due to the following build fails:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/8662
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26263

llvm-svn: 347129

5 years agoAdd initial scaffolding for the GN build.
Nico Weber [Sat, 17 Nov 2018 02:21:53 +0000 (02:21 +0000)]
Add initial scaffolding for the GN build.

See "GN build roundtable summary; adding GN build files to the repo" on
llvm-dev and cfe-dev for discussion.

In particular, this build is completely unsupported. People adding new files to
LLVM are not expected to update the GN build files, and reviewers are not
supposed to request the gn build files to be updated.

This adds just enough to be able to build llvm/lib/Demangle. It requires using
a monorepo.

This adds a few build config options you can set in args.gn
(`gn args out/foo --list` for all):
- is_debug = true to enable debug builds (defaults to release)
- llvm_enable_assertions to toggle assertions (defaults to true)
- clang_base_path, if set an absolute path to a locally-built clang to be used
  as host compiler

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

llvm-svn: 347128

5 years ago[X86] Use getUnpackl/getUnpackh instead of hardcoding a shuffle mask.
Craig Topper [Sat, 17 Nov 2018 02:18:12 +0000 (02:18 +0000)]
[X86] Use getUnpackl/getUnpackh instead of hardcoding a shuffle mask.

llvm-svn: 347127

5 years agoUse llvm::copy. NFC
Fangrui Song [Sat, 17 Nov 2018 01:44:25 +0000 (01:44 +0000)]
Use llvm::copy. NFC

llvm-svn: 347126

5 years agoJust don't even attempt to invoke sed on Windows.
Adrian Prantl [Sat, 17 Nov 2018 01:27:47 +0000 (01:27 +0000)]
Just don't even attempt to invoke sed on Windows.

llvm-svn: 347125

5 years agoRevert "Makefile.rules: Fix the windows-sed-quoting issue harder."
Adrian Prantl [Sat, 17 Nov 2018 01:27:46 +0000 (01:27 +0000)]
Revert "Makefile.rules: Fix the windows-sed-quoting issue harder."

llvm-svn: 347124

5 years ago[llvm-objcopy] Use llvm::all_of and rename the variables "Segment" to avoid confusion...
Fangrui Song [Sat, 17 Nov 2018 01:15:55 +0000 (01:15 +0000)]
[llvm-objcopy] Use llvm::all_of and rename the variables "Segment" to avoid confusion with the type of the same name

llvm-svn: 347123

5 years agoadd PdbSymUid.cpp
Jason Molenda [Sat, 17 Nov 2018 01:08:01 +0000 (01:08 +0000)]
add PdbSymUid.cpp

llvm-svn: 347122

5 years ago[hwasan] don't check tail magic when in right_align mode (should fix the bot)
Kostya Serebryany [Sat, 17 Nov 2018 01:02:09 +0000 (01:02 +0000)]
[hwasan] don't check tail magic when in right_align mode (should fix the bot)

llvm-svn: 347121

5 years agoMakefile.rules: Fix the windows-sed-quoting issue harder.
Adrian Prantl [Sat, 17 Nov 2018 00:45:58 +0000 (00:45 +0000)]
Makefile.rules: Fix the windows-sed-quoting issue harder.

llvm-svn: 347120

5 years ago[clangd] Fix crash hovering on non-decltype trailing return
Marc-Andre Laperle [Sat, 17 Nov 2018 00:41:14 +0000 (00:41 +0000)]
[clangd] Fix crash hovering on non-decltype trailing return

Summary:
More specifically, hovering on "auto" in
auto main() -> int {
    return 0;
}

Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

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

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

llvm-svn: 347119

5 years ago[hwasan] make the heap-buffer-overflow.c test more robust and re-enable it. With...
Kostya Serebryany [Sat, 17 Nov 2018 00:40:34 +0000 (00:40 +0000)]
[hwasan] make the heap-buffer-overflow.c test more robust and re-enable it. With malloc_align_right the relative offsets of heap chunks are less predictable to simply don't test for them.

llvm-svn: 347118

5 years agoMake TestAppleSimulatorOSType.py more flexible
Frederic Riss [Sat, 17 Nov 2018 00:40:31 +0000 (00:40 +0000)]
Make TestAppleSimulatorOSType.py more flexible

Different versions of Xcode have different outputs for the simctl command

llvm-svn: 347117

5 years ago[hwasan] implement free_checks_tail_magic=1
Kostya Serebryany [Sat, 17 Nov 2018 00:25:17 +0000 (00:25 +0000)]
[hwasan] implement free_checks_tail_magic=1

Summary:
With free_checks_tail_magic=1 (default) HWASAN
writes magic bytes to the tail of every heap allocation
(last bytes of the last granule, if the last granule is not fully used)
and checks these bytes on free().

This feature will detect buffer overwires within the last granule
at the time of free().

This is an alternative to malloc_align_right=[1289] that should have
fewer compatibility issues. It is also weaker since it doesn't
detect read overflows and reports bugs at free() instead of at access.

Reviewers: eugenis

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

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

llvm-svn: 347116

5 years agoMoved dag-combine-select-undef.ll into amdgpu. NFC.
Stanislav Mekhanoshin [Sat, 17 Nov 2018 00:17:15 +0000 (00:17 +0000)]
Moved dag-combine-select-undef.ll into amdgpu. NFC.

Tests really needs target arch to be specified.

llvm-svn: 347115

5 years agoAdd missing triple from llvm-mc command line.
Zachary Turner [Sat, 17 Nov 2018 00:05:06 +0000 (00:05 +0000)]
Add missing triple from llvm-mc command line.

llvm-svn: 347114

5 years agoMake git-llvm python3 compatible again. Hopefully. :)
James Y Knight [Fri, 16 Nov 2018 23:59:23 +0000 (23:59 +0000)]
Make git-llvm python3 compatible again. Hopefully. :)

llvm-svn: 347113

5 years agoFixed test after r347110
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:40:04 +0000 (23:40 +0000)]
Fixed test after r347110

Comments in llc outputs are printed differently on different
platforms, some with '#', some with '##'. Removed non-essential
part of the checks.

llvm-svn: 347112

5 years agoAdd missing test for r347072 -gcodeview-ghash
Reid Kleckner [Fri, 16 Nov 2018 23:17:11 +0000 (23:17 +0000)]
Add missing test for r347072 -gcodeview-ghash

llvm-svn: 347111

5 years agoDAG combiner: fold (select, C, X, undef) -> X
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:13:38 +0000 (23:13 +0000)]
DAG combiner: fold (select, C, X, undef) -> X

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

llvm-svn: 347110

5 years agoRewrite stop-hook tests as a couple of FileCheck tests
Frederic Riss [Fri, 16 Nov 2018 23:07:28 +0000 (23:07 +0000)]
Rewrite stop-hook tests as a couple of FileCheck tests

Those tests were using pexpect and being flaky on some of ours bots.
This patch reimplmeents the tests usinf FileCheck, and it also
extends the test coverage to a few more stop-hook options.

llvm-svn: 347109

5 years ago[CMake] Use lld and llvm-objcopy for first stage compiler in Fuchsia
Petr Hosek [Fri, 16 Nov 2018 23:07:03 +0000 (23:07 +0000)]
[CMake] Use lld and llvm-objcopy for first stage compiler in Fuchsia

When cross-compiling the second stage to a different target, we need to
make sure that the first-stage compiler can produce binaries for that
target. Using lld and llvm-objcopy as the default linker and objcopy
tool eliminates some of the dependencies on the host toolchain.

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

llvm-svn: 347108

5 years ago[hwasan] use reads instead of writes in a test
Kostya Serebryany [Fri, 16 Nov 2018 23:01:42 +0000 (23:01 +0000)]
[hwasan] use reads instead of writes in a test

llvm-svn: 347107

5 years agoRevert "Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr"
Kamil Rytarowski [Fri, 16 Nov 2018 23:00:28 +0000 (23:00 +0000)]
Revert "Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr"

_Unwind_Ptr is unknown on some targets.

Detected on green-dragon-21 (MacPro Late 2013 | OS X 10.14(18A391) | Xcode 10.1(10B61)).

llvm-svn: 347106

5 years ago[X86] Add custom promotion of narrow fp_to_uint/fp_to_sint operations under -x86...
Craig Topper [Fri, 16 Nov 2018 22:53:00 +0000 (22:53 +0000)]
[X86] Add custom promotion of narrow fp_to_uint/fp_to_sint operations under -x86-experimental-vector-widening-legalization.

This tries to force the result type to vXi32 followed by a truncate. This can help avoid scalarization that would otherwise occur.

There's some annoying examples of an avx512 truncate instruction followed by a packus where we should really be able to just use one truncate. But overall this is still a net improvement.

llvm-svn: 347105

5 years agoMakefile.rules: Degrade gracefully on Windows machines without sed.
Adrian Prantl [Fri, 16 Nov 2018 22:44:57 +0000 (22:44 +0000)]
Makefile.rules: Degrade gracefully on Windows machines without sed.

llvm-svn: 347104

5 years agoSpeed up git-llvm script by only svn up'ing affected directories.
James Y Knight [Fri, 16 Nov 2018 22:36:17 +0000 (22:36 +0000)]
Speed up git-llvm script by only svn up'ing affected directories.

Also, support modifications to toplevel files in git (which need to be
committed to "monorepo-root" in svn).

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

llvm-svn: 347103

5 years agoCast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr
Kamil Rytarowski [Fri, 16 Nov 2018 22:17:36 +0000 (22:17 +0000)]
Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr

This modification is require for NetBSD with GCC, as there is a
custom unwind.h header implementation with different types.

No functional change intended for others.

Cherry-picked chunk from D33878.

llvm-svn: 347102

5 years agoCast _Unwind_GetIP() and _Unwind_GetRegionStart() to uintptr_t
Kamil Rytarowski [Fri, 16 Nov 2018 22:15:09 +0000 (22:15 +0000)]
Cast _Unwind_GetIP() and _Unwind_GetRegionStart() to uintptr_t

This modification is require for NetBSD with GCC, as there is a
custom unwind.h header implementation with different types.

No functional change intended for others.

Cherry-picked chunk from D33878.

llvm-svn: 347101

5 years ago[X86] Qualify part of the masked gather handling in ReplaceNodeResults with a getType...
Craig Topper [Fri, 16 Nov 2018 22:04:29 +0000 (22:04 +0000)]
[X86] Qualify part of the masked gather handling in ReplaceNodeResults with a getTypeAction call to know if we can use default legalization.

If we managed to switch to -x86-experimental-vector-widening-legalization this block can be removed.

llvm-svn: 347100

5 years ago[sanitizer] Update global_symbols.txt
Vitaly Buka [Fri, 16 Nov 2018 21:42:22 +0000 (21:42 +0000)]
[sanitizer] Update global_symbols.txt

llvm-svn: 347099

5 years ago[WebAssembly] Cleanup unused declares in test code. NFC.
Sam Clegg [Fri, 16 Nov 2018 21:20:00 +0000 (21:20 +0000)]
[WebAssembly] Cleanup unused declares in test code. NFC.

In one case probably you have be using it, in the other it
looks like it was redundant.

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

llvm-svn: 347098

5 years ago[SimpleLoopUnswitch] adding cost multiplier to cap exponential unswitch with
Fedor Sergeev [Fri, 16 Nov 2018 21:16:43 +0000 (21:16 +0000)]
[SimpleLoopUnswitch] adding cost multiplier to cap exponential unswitch with

We need to control exponential behavior of loop-unswitch so we do not get
run-away compilation.

Suggested solution is to introduce a multiplier for an unswitch cost that
makes cost prohibitive as soon as there are too many candidates and too
many sibling loops (meaning we have already started duplicating loops
by unswitching).

It does solve the currently known problem with compile-time degradation
(PR 39544).

Tests are built on top of a recently implemented CHECK-COUNT-<num>
FileCheck directives.

Reviewed By: chandlerc, mkazantsev
Differential Revision: https://reviews.llvm.org/D54223

llvm-svn: 347097

5 years ago[OPENMP]Fix PR39694: do not capture `this` in non-`this` region.
Alexey Bataev [Fri, 16 Nov 2018 21:13:33 +0000 (21:13 +0000)]
[OPENMP]Fix PR39694: do not capture `this` in non-`this` region.

If lambda is used inside of the OpenMP region and captures `this`, we
should recapture it in the OpenMP region also. But we should do this
only if the OpenMP region is used in the context of the same class, just
like the lambda.

llvm-svn: 347096

5 years ago[X86] Remove a branch on SSE4.1 from LowerLoad
Craig Topper [Fri, 16 Nov 2018 21:05:00 +0000 (21:05 +0000)]
[X86] Remove a branch on SSE4.1 from LowerLoad

We should be able to use getExtendInVec with or without sse4.1 to produce a SIGN_EXTEND_VECTOR_INREG.

llvm-svn: 347095

5 years ago[LegalizeVectorOps] After custom legalizing an extending load or a truncating store...
Craig Topper [Fri, 16 Nov 2018 21:04:58 +0000 (21:04 +0000)]
[LegalizeVectorOps] After custom legalizing an extending load or a truncating store, make sure the custom code is also legal.

For example, on X86 we emit a sign_extend_vector_inreg from LowerLoad and without sse4.1 this node will need further legalization. Previously this sign_extend_vector_inreg was being custom lowered during DAG legalization instead of vector op legalization.

Unfortunately, this doesn't seem to matter for the output of any existing lit tests.

llvm-svn: 347094

5 years ago[X86] In LowerLoad, fix assert messages and rename a variable that use Zize instead...
Craig Topper [Fri, 16 Nov 2018 21:04:56 +0000 (21:04 +0000)]
[X86] In LowerLoad, fix assert messages and rename a variable that use Zize instead of Size. NFC

llvm-svn: 347093

5 years agoPreprocessing support in tablegen.
Vyacheslav Zakharin [Fri, 16 Nov 2018 20:57:29 +0000 (20:57 +0000)]
Preprocessing support in tablegen.

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

llvm-svn: 347092

5 years ago[hwasan] disable one test line while investigating a bot failure
Kostya Serebryany [Fri, 16 Nov 2018 20:35:07 +0000 (20:35 +0000)]
[hwasan] disable one test line while investigating a bot failure

llvm-svn: 347091

5 years ago[PowerPC][NFC] Add tests for vector fp <-> int conversions
Nemanja Ivanovic [Fri, 16 Nov 2018 20:24:10 +0000 (20:24 +0000)]
[PowerPC][NFC] Add tests for vector fp <-> int conversions

This NFC patch just adds test cases for conversions that currently
require scalarization of vectors. An updcoming patch will change
the legalization for these and it is more suitable on the review
to show the diferences in code gen rather than just the new code gen.

llvm-svn: 347090

5 years agoAArch64: Emit a call frame instruction for the shadow call stack register.
Peter Collingbourne [Fri, 16 Nov 2018 20:08:54 +0000 (20:08 +0000)]
AArch64: Emit a call frame instruction for the shadow call stack register.

When unwinding past a function that uses shadow call stack, we must
subtract 8 from the value of the x18 register. This patch causes us
to emit a call frame instruction that causes that to happen.

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

llvm-svn: 347089

5 years agoAdd new interceptor for mi_vector_hash(3)
Kamil Rytarowski [Fri, 16 Nov 2018 19:54:13 +0000 (19:54 +0000)]
Add new interceptor for mi_vector_hash(3)

Summary:
mi_vector_hash(3) provides fast 32bit hash functions.

Add a test for this interface.

Enable the API for NetBSD.

Based on original work by Yang Zheng.

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 347088

5 years ago[Cocoa] Prefer llvm::SignExtend64. Pointed out by zturner.
Davide Italiano [Fri, 16 Nov 2018 19:53:00 +0000 (19:53 +0000)]
[Cocoa] Prefer llvm::SignExtend64. Pointed out by zturner.

llvm-svn: 347087

5 years ago[FNeg] Add FNeg Instruction to LangRef document
Cameron McInally [Fri, 16 Nov 2018 19:52:59 +0000 (19:52 +0000)]
[FNeg] Add FNeg Instruction to LangRef document

The FNeg IR Instruction code was added with D53877.

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

llvm-svn: 347086

5 years ago[libcxx] Add missing includes in tests
Louis Dionne [Fri, 16 Nov 2018 19:52:47 +0000 (19:52 +0000)]
[libcxx] Add missing includes in tests

A bunch of unordered containers tests call library functions but don't directly
include the corresponding header files:

- fabs() (defined in <cmath> which is not included);
- is_permutation() (defined in <algorithm> which is not included);
- next() (defined in <iterator> which is not included).
- As a result, these tests won't compile against some conformant libraries.

Reviewed as https://reviews.llvm.org/D54643.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347085

5 years ago[SymbolFile] Remove unused function. NFCI.
Davide Italiano [Fri, 16 Nov 2018 19:48:23 +0000 (19:48 +0000)]
[SymbolFile] Remove unused function. NFCI.

llvm-svn: 347084

5 years agoAdd new interceptor for getmntinfo(3) from NetBSD
Kamil Rytarowski [Fri, 16 Nov 2018 19:47:42 +0000 (19:47 +0000)]
Add new interceptor for getmntinfo(3) from NetBSD

Summary:
getmntinfo gets information about mounted file systems.

Add a dedicated test for new interceptor.

Based on original work by Yang Zheng.

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 347083

5 years ago[hwasan] optionally right-align heap allocations
Kostya Serebryany [Fri, 16 Nov 2018 19:38:48 +0000 (19:38 +0000)]
[hwasan] optionally right-align heap allocations

Summary:
... so that we can find intra-granule buffer overflows.
The default is still to always align left.
It remains to be seen wether we can enable this mode at scale.

Reviewers: eugenis

Reviewed By: eugenis

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

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

llvm-svn: 347082

5 years ago[OPENMP][NVPTX]Emit correct reduction code for teams/parallel
Alexey Bataev [Fri, 16 Nov 2018 19:38:21 +0000 (19:38 +0000)]
[OPENMP][NVPTX]Emit correct reduction code for teams/parallel
reductions.

Fixed previously committed code for the reduction support in
teams/parallel constructs taking into account new design of the NVPTX
support in the compiler. Teams reduction are not fully functional yet,
it is going to be fixed in the following patches.

llvm-svn: 347081

5 years ago[MSP430] Add RTLIB::[SRL/SRA/SHL]_I32 lowering to EABI lib calls
Anton Korobeynikov [Fri, 16 Nov 2018 19:36:15 +0000 (19:36 +0000)]
[MSP430] Add RTLIB::[SRL/SRA/SHL]_I32 lowering to EABI lib calls

Patch by Kristina Bessonova!

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

llvm-svn: 347080

5 years ago[X86] Disable Condbr_merge pass
Rong Xu [Fri, 16 Nov 2018 19:35:00 +0000 (19:35 +0000)]
[X86] Disable Condbr_merge pass

Disable Condbr_merge pass for now due to PR39658.
Will reenable the pass once the bug is fixed.

llvm-svn: 347079

5 years agoSupport ARM_V4BX relocation
Fangrui Song [Fri, 16 Nov 2018 19:24:45 +0000 (19:24 +0000)]
Support ARM_V4BX relocation

Summary: This patch implementation the handler for ARM_V4BX. This relocation is used by GNU runtime files and other armv4 applications.

Patch by Yin Ma

Reviewers: espindola, MaskRay, ruiu, peter.smith, pcc

Reviewed By: ruiu

Subscribers: yinma, pcc, peter.smith, MaskRay, rovka, efriedma, emaste, javed.absar, arichardson, kristof.beyls, chrib, llvm-commits

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

llvm-svn: 347077

5 years agoRevert "[PowerPC] Make no-PIC default to match GCC - LLVM"
Stefan Pintilie [Fri, 16 Nov 2018 19:24:23 +0000 (19:24 +0000)]
Revert "[PowerPC] Make no-PIC default to match GCC - LLVM"

This reverts commit r347069

llvm-svn: 347076

5 years agoRevert "[PowerPC] Make no-PIC default to match GCC - CLANG"
Stefan Pintilie [Fri, 16 Nov 2018 19:21:33 +0000 (19:21 +0000)]
Revert "[PowerPC] Make no-PIC default to match GCC - CLANG"

This reverts commit r347070

llvm-svn: 347075

5 years ago[MSP430] Use R_MSP430_16_BYTE type for FK_Data_2 fixup
Anton Korobeynikov [Fri, 16 Nov 2018 19:20:51 +0000 (19:20 +0000)]
[MSP430] Use R_MSP430_16_BYTE type for FK_Data_2 fixup

Linker fails to link example like this (simplified case from newlib
sources):

$ cat test.c

extern const char _ctype_b[];
struct _t { char *ptr; };
struct _t T = { ((char *) _ctype_b + 3) };
$ cat ctype.c

char _ctype_b[4] = { 0, 0, 0, 0 };
LD: test.o:(.data+0x0): warning: internal error: unsupported relocation error

We also follow gnu toolchain here, where 2-byte relocation mapped to
R_MSP430_16_BYTE, instead of R_MSP430_16.

Patch by Kristina Bessonova!

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

llvm-svn: 347074

5 years ago[WebAssembly] Default to static reloc model
Sam Clegg [Fri, 16 Nov 2018 18:59:51 +0000 (18:59 +0000)]
[WebAssembly] Default to static reloc model

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

llvm-svn: 347073

5 years ago[codeview] Expose -gcodeview-ghash for global type hashing
Reid Kleckner [Fri, 16 Nov 2018 18:47:41 +0000 (18:47 +0000)]
[codeview] Expose -gcodeview-ghash for global type hashing

Summary:
Experience has shown that the functionality is useful. It makes linking
optimized clang with debug info for me a lot faster, 20s to 13s. The
type merging phase of PDB writing goes from 10s to 3s.

This removes the LLVM cl::opt and replaces it with a metadata flag.

After this change, users can do the following to use ghash:
- add -gcodeview-ghash to compiler flags
- replace /DEBUG with /DEBUG:GHASH in linker flags

Reviewers: zturner, hans, thakis, takuto.ikuta

Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits

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

llvm-svn: 347072

5 years agoMake path more robust so it also works with out-of-tree builds.
Adrian Prantl [Fri, 16 Nov 2018 18:43:16 +0000 (18:43 +0000)]
Make path more robust so it also works with out-of-tree builds.

llvm-svn: 347071

5 years ago[PowerPC] Make no-PIC default to match GCC - CLANG
Stefan Pintilie [Fri, 16 Nov 2018 18:37:01 +0000 (18:37 +0000)]
[PowerPC] Make no-PIC default to match GCC - CLANG

Make the default -fno-PIC on Power PC.

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

llvm-svn: 347070

5 years ago[PowerPC] Make no-PIC default to match GCC - LLVM
Stefan Pintilie [Fri, 16 Nov 2018 18:36:21 +0000 (18:36 +0000)]
[PowerPC] Make no-PIC default to match GCC - LLVM

Set -fno-PIC as the default option.

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

llvm-svn: 347069

5 years ago[CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign
Stefan Granitz [Fri, 16 Nov 2018 18:10:36 +0000 (18:10 +0000)]
[CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign

Summary: Allow code-signing with entitlements. FORCE may be used to avoid an error when replacing existing signatures.

Reviewers: beanz, bogner

Reviewed By: beanz

Subscribers: mgorny, llvm-commits, lldb-commits

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

llvm-svn: 347068

5 years ago[SelectionDAG] Move (repeated) SDTIntShiftDOp double shift node def to common code...
Simon Pilgrim [Fri, 16 Nov 2018 17:50:59 +0000 (17:50 +0000)]
[SelectionDAG] Move (repeated) SDTIntShiftDOp double shift node def to common code. NFCI.

Prep work for PR39467.

llvm-svn: 347067

5 years ago[X86] Add codegen tests for scalar funnel shifts
Simon Pilgrim [Fri, 16 Nov 2018 17:48:52 +0000 (17:48 +0000)]
[X86] Add codegen tests for scalar funnel shifts

llvm-svn: 347066

5 years agoGlobalDCE: Teach isEmptyFunction() to ignore debug intrinsics.
Adrian Prantl [Fri, 16 Nov 2018 17:47:21 +0000 (17:47 +0000)]
GlobalDCE: Teach isEmptyFunction() to ignore debug intrinsics.

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

llvm-svn: 347065

5 years ago[AST][NFC] Pack CXXThisExpr
Bruno Ricci [Fri, 16 Nov 2018 17:38:35 +0000 (17:38 +0000)]
[AST][NFC] Pack CXXThisExpr

Use the newly available space in the bit-fields of Stmt.
This saves 8 bytes per CXXThisExpr.

llvm-svn: 347064

5 years ago[AST][NFC] Pack CXXNullPtrLiteralExpr
Bruno Ricci [Fri, 16 Nov 2018 16:56:49 +0000 (16:56 +0000)]
[AST][NFC] Pack CXXNullPtrLiteralExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXNullPtrLiteralExpr.

llvm-svn: 347063