platform/upstream/llvm.git
4 years agogsl::Owner/gsl::Pointer: Add implicit annotations for some std types
Matthias Gehre [Wed, 7 Aug 2019 10:45:36 +0000 (10:45 +0000)]
gsl::Owner/gsl::Pointer: Add implicit annotations for some std types

Summary:
Hard code gsl::Owner/gsl::Pointer for std types. The paper mentions
some types explicitly. Generally, all containers and their iterators are
covered. For iterators, we cover both the case that they are defined
as an nested class or as an typedef/using. I have started to test this
implementation against some real standard library implementations, namely
libc++ 7.1.0, libc++ 8.0.1rc2, libstdc++ 4.6.4, libstdc++ 4.8.5,
libstdc++ 4.9.4, libstdc++ 5.4.0, libstdc++ 6.5.0, libstdc++ 7.3.0,
libstdc++ 8.3.0 and libstdc++ 9.1.0.

The tests are currently here
  https://github.com/mgehre/llvm-project/blob/lifetime-ci/lifetime-attr-test.sh
  https://github.com/mgehre/llvm-project/blob/lifetime-ci/lifetime-attr-test.cpp
I think due to their dependency on a standard library, they are not a good fit
for clang/test/. Where else could I put them?

Reviewers: gribozavr, xazax.hun

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

llvm-svn: 368147

4 years ago[ARM] Generate MVE VHADDs/VHSUBs
Oliver Cruickshank [Wed, 7 Aug 2019 10:26:57 +0000 (10:26 +0000)]
[ARM] Generate MVE VHADDs/VHSUBs

llvm-svn: 368146

4 years agoHandle /align option.
Rui Ueyama [Wed, 7 Aug 2019 10:16:21 +0000 (10:16 +0000)]
Handle /align option.

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

llvm-svn: 368145

4 years agoSimplify error message output. NFC.
Rui Ueyama [Wed, 7 Aug 2019 10:11:24 +0000 (10:11 +0000)]
Simplify error message output. NFC.

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

llvm-svn: 368144

4 years ago[lldb][NFC] Fix typo in 368066
Stefan Granitz [Wed, 7 Aug 2019 10:03:11 +0000 (10:03 +0000)]
[lldb][NFC] Fix typo in 368066

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

llvm-svn: 368143

4 years ago[ELF][X86] Add --no-show-raw-insn and -soname to some i386 tests
Fangrui Song [Wed, 7 Aug 2019 09:43:54 +0000 (09:43 +0000)]
[ELF][X86] Add --no-show-raw-insn and -soname to some i386 tests

llvm-svn: 368142

4 years ago[InstCombine] Recommit: Shift amount reassociation: shl-trunc-shl pattern
Roman Lebedev [Wed, 7 Aug 2019 09:41:50 +0000 (09:41 +0000)]
[InstCombine] Recommit: Shift amount reassociation: shl-trunc-shl pattern

This was initially committed in r368059 but got reverted in r368084
because there was a faulty logic in how the shift amounts type mismatch
was being handled (it simply wasn't).

I've added an explicit bailout before we SimplifyAddInst() - i don't think
it's designed in general to handle differently-typed values, even though
the actual problem only comes from ConstantExpr's.

I have also changed the common type deduction, to not just blindly
look past zext, but try to do that so that in the end types match.

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

llvm-svn: 368141

4 years ago[obj2yaml] - MIPS: move and improve testing of the e_flags
George Rimar [Wed, 7 Aug 2019 09:35:04 +0000 (09:35 +0000)]
[obj2yaml] - MIPS: move and improve testing of the e_flags

Mips/elf-flags.yaml and Mips/elf-abi.yaml are tests that intention was to
show that yaml2obj/obj2yaml are able to read/dump MIPS specific e_flags.

They were not complete, contained an excessive YAML parts and were placed
at a wrong location.

I removed them and created the obj2yaml/elf-mips-eflags.yaml instead.

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

llvm-svn: 368140

4 years ago[ELF.h] - Check the case when e_shstrndx=SHN_XINDEX, but the corresponding sh_link...
George Rimar [Wed, 7 Aug 2019 09:29:42 +0000 (09:29 +0000)]
[ELF.h] - Check the case when e_shstrndx=SHN_XINDEX, but the corresponding sh_link is broken.

When e_shstrndx is equal to SHN_XINDEX,
the index of the section string table section should
be taken from the sh_link field of the section
header at index 0.

If sh_link is broken, e.g. contains an index that is
larger than number of sections, then error is reported.

This error message was untested before.

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

llvm-svn: 368139

4 years ago[llvm-readelf] --notes: move 'Data size' column left by 1
Fangrui Song [Wed, 7 Aug 2019 09:13:11 +0000 (09:13 +0000)]
[llvm-readelf] --notes: move 'Data size' column left by 1

readelf -n:

```
// "Data size" is not left justified
  Owner                 Data size       Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
```

llvm-readelf -n (before):
```
// "Data size" column shifted by 1
  Owner                 Data size        Description
  GNU                   0x00000010       NT_GNU_ABI_TAG (ABI version tag)
```

llvm-readelf -n (after):
```
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
```

This change is made to reduce the diff with readelf -n, so that it is
slightly easier to check what features readelf implements but we don't.

Reviewed By: grimar, jhenderson

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

llvm-svn: 368138

4 years ago[clangd] Added a TextMate theme parser to the vscode extension.
Johan Vikstrom [Wed, 7 Aug 2019 08:48:52 +0000 (08:48 +0000)]
[clangd] Added a TextMate theme parser to the vscode extension.

Summary:
Adds a TextMate parser module to the vscode extension. It parses a theme into an array of a pair of TextMate scopes and text colors.

Reviewers: hokein, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 368136

4 years ago[unittests] Mark private gmock headers with IWYU pragmas. NFC
Ilya Biryukov [Wed, 7 Aug 2019 08:45:38 +0000 (08:45 +0000)]
[unittests] Mark private gmock headers with IWYU pragmas. NFC

Summary: To prevent clangd from adding #include of those headers.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: kadircet, llvm-commits, cfe-commits

Tags: #llvm

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

llvm-svn: 368135

4 years agoRemove inclusion of a private gmock header from a test
Dmitri Gribenko [Wed, 7 Aug 2019 08:16:29 +0000 (08:16 +0000)]
Remove inclusion of a private gmock header from a test

llvm-svn: 368132

4 years agoRe-submit r367649: Improve raw_ostream so that you can "write" colors using operator<<
Rui Ueyama [Wed, 7 Aug 2019 08:08:17 +0000 (08:08 +0000)]
Re-submit r367649: Improve raw_ostream so that you can "write" colors using operator<<

The original patch broke buildbots, perhaps because it changed the
default setting whether colors are enabled or not.

llvm-svn: 368131

4 years ago[ARM][LowOverheadLoops] Revert after read/write
Sam Parker [Wed, 7 Aug 2019 07:39:19 +0000 (07:39 +0000)]
[ARM][LowOverheadLoops] Revert after read/write

Currently we check whether LR is stored/loaded to/from inbetween the
loop decrement and loop end pseudo instructions. There's two problems
here:
- It relies on all load/store instructions being labelled as such in
  tablegen.
- Actually any use of loop decrement is troublesome because the value
  doesn't exist!

So we need to check for any read/write of LR that occurs between the
two instructions and revert if we find anything.

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

llvm-svn: 368130

4 years agoForce check prof branch_weights consistency in SwitchInstProfUpdateWrapper
Yevgeny Rouban [Wed, 7 Aug 2019 07:17:45 +0000 (07:17 +0000)]
Force check prof branch_weights consistency in SwitchInstProfUpdateWrapper

This patch turns on the prof branch_weights metadata consistency
check in SwitchInstProfUpdateWrapper.

If this patch causes a failure then please before reverting do report
the IR that hits the assertion and try identifying the pass that
introduces the inconsistency. We have to fix all such passes.

See also the upcoming change https://reviews.llvm.org/D61179
in the Verifier.

Reviewers: davidx, nikic, eraman, reames, chandlerc
Reviewed By: davidx
Differential Revision: https://reviews.llvm.org/D64061

llvm-svn: 368129

4 years ago[RISCV] Remove duplicated logic when determining the target ABI
Roger Ferrer Ibanez [Wed, 7 Aug 2019 07:08:00 +0000 (07:08 +0000)]
[RISCV] Remove duplicated logic when determining the target ABI

We were calculating twice ilp32/lp64. Do this in one place instead.

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

llvm-svn: 368128

4 years ago[X86] Allow any 8-bit immediate to be used with bt/btc/btr/bts memory aliases.
Craig Topper [Wed, 7 Aug 2019 06:17:58 +0000 (06:17 +0000)]
[X86] Allow any 8-bit immediate to be used with bt/btc/btr/bts memory aliases.

We have aliases that disambiguate memory forms of bt/btc/btr/bts
without suffixes to the 32-bit form. These aliases should have
been updated when the instructions were updated in r356413.

llvm-svn: 368127

4 years ago[X86] Use isInt<8> to simplify some code. NFC
Craig Topper [Wed, 7 Aug 2019 06:17:55 +0000 (06:17 +0000)]
[X86] Use isInt<8> to simplify some code. NFC

llvm-svn: 368126

4 years agoDetect HAVE_SYS_TYPES_H in lldb
Haibo Huang [Wed, 7 Aug 2019 06:15:01 +0000 (06:15 +0000)]
Detect HAVE_SYS_TYPES_H in lldb

Summary:
After rL368069 I noticed that HAVE_SYS_TYPES_H is not defined in
Platform.h, or anywhere else in lldb. This change fixes that.

Reviewers: labath

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 368125

4 years ago[MachineCSE][NFC] Use 'profitable' rather than 'beneficial' to name method.
Kai Luo [Wed, 7 Aug 2019 05:40:21 +0000 (05:40 +0000)]
[MachineCSE][NFC] Use 'profitable' rather than 'beneficial' to name method.

llvm-svn: 368124

4 years ago[X86] Limit vpermil2pd/vpermil2ps immediates to 4 bits in the assembly parser.
Craig Topper [Wed, 7 Aug 2019 05:34:27 +0000 (05:34 +0000)]
[X86] Limit vpermil2pd/vpermil2ps immediates to 4 bits in the assembly parser.

The upper 4 bits of the immediate byte are used to encode a
register. We need to limit the explicit immediate to fit in the
remaining 4 bits.

Fixes PR42899.

llvm-svn: 368123

4 years agoReverts commit r368117, r368115 and r368112
Petr Hosek [Wed, 7 Aug 2019 05:15:34 +0000 (05:15 +0000)]
Reverts commit r368117, r368115 and r368112

This reverts commits:

  "Added Delta IR Reduction Tool"
  "[Bugpoint redesign] Added Pass to Remove Global Variables"
  "Added Tool as Dependency to tests & fixed warnings"

Reduce/remove-funcs.ll is failing on bots.

llvm-svn: 368122

4 years agoAppend an executable suffix to the toolchain tool paths on Windows platform.
Galina Kistanova [Wed, 7 Aug 2019 03:19:40 +0000 (03:19 +0000)]
Append an executable suffix to the toolchain tool paths on Windows platform.

Append a default CMake suffix (CMAKE_EXECUTABLE_SUFFIX) for the build host to the toolchain tool path when adding a LLVM external project.
The tool binary files should contain .exe suffix to run them properly on Windows platform when building the projects.

Patch by Vlad Vereschaka.

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

llvm-svn: 368121

4 years agoFixes failing test cases on Windows for rL368119
Alex Brachet [Wed, 7 Aug 2019 03:18:23 +0000 (03:18 +0000)]
Fixes failing test cases on Windows for rL368119

Windows test cases were failing because the executable is called yaml2obj.exe
not just yaml2obj. I removed FileCheck patterns including yaml2obj so they
start matching at the error message not the program name.

llvm-svn: 368120

4 years ago[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Alex Brachet [Wed, 7 Aug 2019 02:44:49 +0000 (02:44 +0000)]
[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests

Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath

Reviewed By: rupprecht

Subscribers: gribozavr, mgrang, seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits

Tags: #llvm

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

llvm-svn: 368119

4 years agoUpstream a few small Apple changes to debugserver - arm64_32, Catalyst
Jason Molenda [Wed, 7 Aug 2019 02:06:06 +0000 (02:06 +0000)]
Upstream a few small Apple changes to debugserver - arm64_32, Catalyst

Adrian's changes to support Catalyst processes and my
changes to support debugserver running on an arm64_32
device (Apple Watch Series 4, which uses an IPL32 model
on arm64 cpus).

llvm-svn: 368118

4 years agoAdded Tool as Dependency to tests & fixed warnings
Diego Trevino Ferrer [Wed, 7 Aug 2019 01:51:56 +0000 (01:51 +0000)]
Added Tool as Dependency to tests & fixed warnings

Summary: Fixes http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-msan/builds/14002 and http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/35392/steps/build_Lld/logs/stdio

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368117

4 years ago[Gardening] Remove more dead code from IOHandler
Jonas Devlieghere [Wed, 7 Aug 2019 01:50:03 +0000 (01:50 +0000)]
[Gardening] Remove more dead code from IOHandler

Remove more dead code and reformat the file.

llvm-svn: 368116

4 years ago[Bugpoint redesign] Added Pass to Remove Global Variables
Diego Trevino Ferrer [Wed, 7 Aug 2019 00:42:50 +0000 (00:42 +0000)]
[Bugpoint redesign] Added Pass to Remove Global Variables

Summary:
This pass tries to remove Global Variables, as well as their derived uses. For example if a variable `@x` is used by `%call1` and `%call2`, both these uses and the definition of `@x` are deleted. Moreover if `%call1` or `%call2` are used elsewhere those uses are also deleted, and so on recursively.

I'm still uncertain if this pass should remove derived uses, I'm open to suggestions.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368115

4 years agoTLI: darwin does not support _bcmp
Alex Lorenz [Wed, 7 Aug 2019 00:03:37 +0000 (00:03 +0000)]
TLI: darwin does not support _bcmp

Not all Darwin targets support _bcmp in all circumstances.

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

llvm-svn: 368113

4 years agoAdded Delta IR Reduction Tool
Diego Trevino Ferrer [Wed, 7 Aug 2019 00:00:52 +0000 (00:00 +0000)]
Added Delta IR Reduction Tool

Summary: Tool parses input IR file, and runs the delta debugging algorithm to reduce the functions inside the input file.

Reviewers: alexshap, chandlerc

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

> llvm-svn: 368071

llvm-svn: 368112

4 years agoRequire lld for hwasan tests.
Peter Collingbourne [Tue, 6 Aug 2019 23:43:20 +0000 (23:43 +0000)]
Require lld for hwasan tests.

We're using relocations that are unsupported by the version of gold on the
bot, so force the use of lld. One of the tests is already using lld,
so this should be safe.

llvm-svn: 368111

4 years agoRegenerate mmx-arith.ll.
Mitch Phillips [Tue, 6 Aug 2019 23:39:07 +0000 (23:39 +0000)]
Regenerate mmx-arith.ll.

This test golden file has become out of date since the rollback of
rL368081. Update the test to have the correct values.

llvm-svn: 368110

4 years agoRevert "[X86] Add more extract subvector cost model tests for smaller element sizes...
Mitch Phillips [Tue, 6 Aug 2019 23:38:14 +0000 (23:38 +0000)]
Revert "[X86] Add more extract subvector cost model tests for smaller element sizes and smaller than 128-bit vectors."

This reverts commit fc33e33776b7a7ce22e539f0ec2e3bfdb09ad361.

This commit depends on the rolled back commit rL367901, and thus needs
to be rolled back.

llvm-svn: 368109

4 years ago[clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in create
Puyan Lotfi [Tue, 6 Aug 2019 23:25:34 +0000 (23:25 +0000)]
[clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in create

I also have replaced all the instances of
"auto DW = DirectoryWatcher::create" with
llvm::Expected<std::unique_ptr<DirectoryWatcher>> DW = DirectoryWatcher::create
to make it more clear that DirectoryWatcher::create is returning an Expected.

I've also allowed for logAllUnhandledErrors to consume errors in the case were
DirectoryWatcher::create produces them.

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

llvm-svn: 368108

4 years agoRevert "[X86] Enable -x86-experimental-vector-widening-legalization by default."
Mitch Phillips [Tue, 6 Aug 2019 23:00:43 +0000 (23:00 +0000)]
Revert "[X86] Enable -x86-experimental-vector-widening-legalization by default."

This reverts commit 3de33245d2c992c9e0af60372043540b60f3a810.

This commit broke the MSan buildbots. See
https://reviews.llvm.org/rL367901 for more information.

llvm-svn: 368107

4 years agoRevert "[X86] Remove uses of the -x86-experimental-vector-widening-legalization flag...
Mitch Phillips [Tue, 6 Aug 2019 23:00:30 +0000 (23:00 +0000)]
Revert "[X86] Remove uses of the -x86-experimental-vector-widening-legalization flag from test/CodeGen/X86/"

This reverts commit 3f572c7b8405f36993ec8a226dcddd57283a7c1e.

The MSan sanitizer buildbot was broken by rL367901. This commit
(rL368079) depends on the broken commit that need to be reverted, and
thus itself is being reverted.

See https://reviews.llvm.org/rL367901 for more information.

llvm-svn: 368106

4 years agoUse parenthses to silence warning.
Bill Wendling [Tue, 6 Aug 2019 22:47:47 +0000 (22:47 +0000)]
Use parenthses to silence warning.

llvm-svn: 368105

4 years agoDelay diagnosing asm constraints that require immediates until after inlining
Bill Wendling [Tue, 6 Aug 2019 22:41:22 +0000 (22:41 +0000)]
Delay diagnosing asm constraints that require immediates until after inlining

Summary:
An inline asm call may result in an immediate input value after inlining.
Therefore, don't emit a diagnostic here if the input isn't an immediate.

Reviewers: joerg, eli.friedman, rsmith

Subscribers: asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, s.egerton, krytarowski, mgorny, riccibruno, eraman, cfe-commits

Tags: #clang

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

llvm-svn: 368104

4 years ago[TSAN] Fix tsan on FreeBSD after D54889
Alexander Richardson [Tue, 6 Aug 2019 22:30:48 +0000 (22:30 +0000)]
[TSAN] Fix tsan on FreeBSD after D54889

Summary:
It appears that since https://reviews.llvm.org/D54889, BackgroundThread()
crashes immediately because cur_thread()-> will return a null pointer
which is then dereferenced. I'm not sure why I only see this issue on
FreeBSD and not Linux since it should also be unintialized on other platforms.

Reviewers: yuri, dvyukov, dim, emaste

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

Tags: #sanitizers, #llvm

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

llvm-svn: 368103

4 years agohwasan: Instrument globals.
Peter Collingbourne [Tue, 6 Aug 2019 22:07:29 +0000 (22:07 +0000)]
hwasan: Instrument globals.

Globals are instrumented by adding a pointer tag to their symbol values
and emitting metadata into a special section that allows the runtime to tag
their memory when the library is loaded.

Due to order of initialization issues explained in more detail in the comments,
shadow initialization cannot happen during regular global initialization.
Instead, the location of the global section is marked using an ELF note,
and we require libc support for calling a function provided by the HWASAN
runtime when libraries are loaded and unloaded.

Based on ideas discussed with @evgeny777 in D56672.

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

llvm-svn: 368102

4 years ago[WebAssembly] Lower ASan constructor priority on Emscripten
Guanzhong Chen [Tue, 6 Aug 2019 21:52:58 +0000 (21:52 +0000)]
[WebAssembly] Lower ASan constructor priority on Emscripten

Summary:
This change gives Emscripten the ability to use more than one constructor
priorities that runs before ASan. By convention, constructor priorites 0-100
are reserved for use by the system. ASan on Emscripten now uses priority 50,
leaving plenty of room for use by Emscripten before and after ASan.

This change is done in response to:
https://github.com/emscripten-core/emscripten/pull/9076#discussion_r310323723

Reviewers: kripken, tlively, aheejin

Reviewed By: tlively

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

Tags: #llvm, #clang

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

llvm-svn: 368101

4 years ago[NFC][ScopBuilder] Move buildDomains and its callees to ScopBuilder.
Dominik Adamski [Tue, 6 Aug 2019 21:51:18 +0000 (21:51 +0000)]
[NFC][ScopBuilder] Move buildDomains and its callees to ScopBuilder.

Scope of changes:

1) Moved buildDomains function to ScopBuilder class.
2) Moved buildDomainsWithBranchConstraints function to ScopBuilder class.
3) Moved propagateDomainConstraints to ScopBuilder class.
4) Moved propagateDomainConstraintsToRegionExit to ScopBuilder class.
5) Moved propagateInvalidStmtDomains to ScopBuilder class.
6) Moved getPredecessorDomainConstraints function to ScopBuilder class.
7) Moved addLoopBoundsToHeaderDomain function to ScopBuilder class.
8) Moved getPwAff function to ScopBuilder class.
9) Moved buildConditionSets functions to ScopBuilder class.
10) Added updateMaxLoopDepth, notifyErrorBlock, getOrInitEmptyDomain, isDomainDefined, setDomain functions to Scop class. They are used by ScopBuilder.
11) Moved helper functions: getRegionNodeBasicBlock, getRegionNodeSuccessor, containsErrorBlock, createNextIterationMap, collectBoundedParts, partitionSetParts, buildConditionSet to ScopBuilder.cpp file.

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

llvm-svn: 368100

4 years agogn build: Merge r368065.
Peter Collingbourne [Tue, 6 Aug 2019 21:48:06 +0000 (21:48 +0000)]
gn build: Merge r368065.

llvm-svn: 368099

4 years agogn build: Merge r368052.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:55 +0000 (21:47 +0000)]
gn build: Merge r368052.

llvm-svn: 368098

4 years agogn build: Merge r368054.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:46 +0000 (21:47 +0000)]
gn build: Merge r368054.

llvm-svn: 368097

4 years agogn build: Merge r368086.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:37 +0000 (21:47 +0000)]
gn build: Merge r368086.

llvm-svn: 368096

4 years agogn build: Merge r368070.
Peter Collingbourne [Tue, 6 Aug 2019 21:47:27 +0000 (21:47 +0000)]
gn build: Merge r368070.

llvm-svn: 368095

4 years agoIR: Disable verifier check for GlobalValues with private linkage named after a comdat...
Peter Collingbourne [Tue, 6 Aug 2019 21:47:18 +0000 (21:47 +0000)]
IR: Disable verifier check for GlobalValues with private linkage named after a comdat for non-COFF.

This check is only meaningful for COFF and it is perfectly valid to create
such a GlobalValue in ELF.

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

llvm-svn: 368094

4 years ago[Sanitizer] little typo
David Carlier [Tue, 6 Aug 2019 21:46:01 +0000 (21:46 +0000)]
[Sanitizer] little typo

llvm-svn: 368093

4 years agofix clang-scan-deps test to match filepaths on Windows
Alex Lorenz [Tue, 6 Aug 2019 21:45:43 +0000 (21:45 +0000)]
fix clang-scan-deps test to match filepaths on Windows

llvm-svn: 368092

4 years ago[X86] Don't allow combineSIntToFP to create v2i32 vectors after type legalization.
Craig Topper [Tue, 6 Aug 2019 21:43:15 +0000 (21:43 +0000)]
[X86] Don't allow combineSIntToFP to create v2i32 vectors after type legalization.

If we're after type legalization we should only be trying to turn
v2i64 into v2i32. So bitcast to v4i32, shuffle the even elements
together. Then use X86ISD::CVTSI2P. The alternative is to leave
the v2i64 type alone and let it scalarized. Hopefully keeping
it packed is better.

Fixes PR42905.

llvm-svn: 368091

4 years ago[Sanitizer] Linux explicitally migrate shadow mapping to Transparent Huge Page
David Carlier [Tue, 6 Aug 2019 21:30:03 +0000 (21:30 +0000)]
[Sanitizer] Linux explicitally migrate shadow mapping to Transparent Huge Page

in madvise mode, the shadow pages will be migrated only via madvise explicit calls.

Reviewers: vitalybuka

Reviewed By: vitalybuka

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

llvm-svn: 368090

4 years ago[NFC][ScopBuilder] Move addUserAssumptions to ScopBuilder
Dominik Adamski [Tue, 6 Aug 2019 21:25:35 +0000 (21:25 +0000)]
[NFC][ScopBuilder] Move addUserAssumptions to ScopBuilder

Scope of changes:
1) Moved addUserAssumptions function to ScopBuilder class.
2) Moved buildConditionSets functions to polly namespace.
3) Moved getRepresentingInvariantLoadSCEV to public section of the Scop class

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

llvm-svn: 368089

4 years ago[pstl][libc++] Provide uglified header names for interface headers
Louis Dionne [Tue, 6 Aug 2019 21:11:24 +0000 (21:11 +0000)]
[pstl][libc++] Provide uglified header names for interface headers

For the few (currently four) headers that make up the PSTL's interface
to other Standard Libraries, provide a stable uglified header file that
can be included by those Standard Libraries.

We can then more easily change the internal organization of the PSTL
without having to change the integration with Standard Libraries.

llvm-svn: 368088

4 years ago[clang-doc] Fix paths of js in import tags
Diego Astiazaran [Tue, 6 Aug 2019 20:59:14 +0000 (20:59 +0000)]
[clang-doc] Fix paths of js in import tags

HTML requires posix-style paths.

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

llvm-svn: 368087

4 years ago[clang-scan-deps] Implementation of dependency scanner over minimized sources
Alex Lorenz [Tue, 6 Aug 2019 20:43:25 +0000 (20:43 +0000)]
[clang-scan-deps] Implementation of dependency scanner over minimized sources

This commit implements the fast dependency scanning mode in clang-scan-deps: the
preprocessing is done on files that are minimized using the dependency directives source minimizer.

A shared file system cache is used to ensure that the file system requests and source minimization
is performed only once. The cache assumes that the underlying filesystem won't change during the course
of the scan (or if it will, it will not affect the output), and it can't be evicted. This means that the
service and workers can be used for a single run of a dependency scanner, and can't be reused across multiple,
incremental runs. This is something that we'll most likely support in the future though.
Note that the driver still utilizes the underlying real filesystem.

This commit is also still missing the fast skipped PP block skipping optimization that I mentioned at EuroLLVM talk.
Additionally, the file manager is still not reused by the threads as well.

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

llvm-svn: 368086

4 years agoRevert [InstCombine] Shift amount reassociation: shl-trunc-shl pattern
Reid Kleckner [Tue, 6 Aug 2019 20:32:07 +0000 (20:32 +0000)]
Revert [InstCombine] Shift amount reassociation: shl-trunc-shl pattern

This reverts r368059 (git commit 0f957109761913c563922f1afd4ceb29ef21bbd0)

This caused Clang to assert while self-hosting and compiling
SystemZInstrInfo.cpp. Reduction is running.

llvm-svn: 368084

4 years ago[clangd] Unfold SourceLocation flattening from findNameLoc in preparation for adding...
Sam McCall [Tue, 6 Aug 2019 20:25:59 +0000 (20:25 +0000)]
[clangd] Unfold SourceLocation flattening from findNameLoc in preparation for adding more overloads. NFC

llvm-svn: 368083

4 years ago[lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCode
Raphael Isemann [Tue, 6 Aug 2019 20:25:02 +0000 (20:25 +0000)]
[lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCode

llvm-svn: 368082

4 years ago[X86] Add more extract subvector cost model tests for smaller element sizes and small...
Craig Topper [Tue, 6 Aug 2019 20:12:41 +0000 (20:12 +0000)]
[X86] Add more extract subvector cost model tests for smaller element sizes and smaller than 128-bit vectors.

With the switch to widening legalization, we need to a better
job of costing extractions of less than 128-bits.

llvm-svn: 368081

4 years ago[X86] Remove tests for -x86-experimental-vector-widening-legalization from test/Analy...
Craig Topper [Tue, 6 Aug 2019 20:12:34 +0000 (20:12 +0000)]
[X86] Remove tests for -x86-experimental-vector-widening-legalization from test/Analysis/CostModel/X86/

This flag is now the default behavior so we don't need separate
tests.

llvm-svn: 368080

4 years ago[X86] Remove uses of the -x86-experimental-vector-widening-legalization flag from...
Craig Topper [Tue, 6 Aug 2019 20:12:20 +0000 (20:12 +0000)]
[X86] Remove uses of the -x86-experimental-vector-widening-legalization flag from test/CodeGen/X86/

This flag is now the default behavior so we no longer need to
set it in tests.

Some redundant tests have been removed after verifying we have
an equivalent test that didn't use the flag.

llvm-svn: 368079

4 years ago[WebAssembly] Fix null pointer in createInitTLSFunction
Guanzhong Chen [Tue, 6 Aug 2019 20:09:04 +0000 (20:09 +0000)]
[WebAssembly] Fix null pointer in createInitTLSFunction

Summary:
`createSyntheticSymbols`, which creates `WasmSym::InitTLS`, is only called
when `!config->relocatable`, but this condition is not checked when calling
`createInitTLSFunction`.

This diff checks `!config->relocatable` before calling `createInitTLSFunction`.

Fixes https://github.com/emscripten-core/emscripten/issues/9155.

Reviewers: tlively, aheejin, kripken, sbc100

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

Tags: #llvm

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

llvm-svn: 368078

4 years ago[libc++] Use the monorepo for the back-deployment testing scripts
Louis Dionne [Tue, 6 Aug 2019 20:01:28 +0000 (20:01 +0000)]
[libc++] Use the monorepo for the back-deployment testing scripts

llvm-svn: 368077

4 years ago[Attributor][modulemap] Revert r368064 but fix the build
Kristina Brooks [Tue, 6 Aug 2019 19:53:19 +0000 (19:53 +0000)]
[Attributor][modulemap] Revert r368064 but fix the build

Commit r368064 was necessary after r367953 (D65712) broke the module
build. That happened, apparently, because the template class IRAttribute
defined in the header had a virtual method defined in the corresponding
source file (IRAttribute::manifest). To unbreak the situation this patch
introduces a helper function IRAttributeManifest::manifestAttrs which
is used to implement IRAttribute::manifest in the header. The deifnition
of the helper function is still in the source file.

Patch by jdoerfert (Johannes Doerfert)

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

llvm-svn: 368076

4 years ago[SymbolFile] Remove commented out method
Alex Langford [Tue, 6 Aug 2019 19:47:08 +0000 (19:47 +0000)]
[SymbolFile] Remove commented out method

llvm-svn: 368075

4 years agoAdd order-dependencies to object libraries
Chris Bieneman [Tue, 6 Aug 2019 19:41:23 +0000 (19:41 +0000)]
Add order-dependencies to object libraries

Summary: If you are generating an object library that depends on table-gen generate sources, you need the object library to depend on the tablgen target. Currently llvm_add_library doesn't add dependencies for object libraries at all, which is clearly problematic.

Reviewers: compnerd, hintonda, smeenai

Reviewed By: smeenai

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368074

4 years agoRevert "Added Delta IR Reduction Tool"
Dmitri Gribenko [Tue, 6 Aug 2019 19:40:37 +0000 (19:40 +0000)]
Revert "Added Delta IR Reduction Tool"

This reverts commit r368071, it broke buildbots.

llvm-svn: 368073

4 years agoTeach some warnings to respect gsl::Pointer and gsl::Owner attributes
Gabor Horvath [Tue, 6 Aug 2019 19:13:29 +0000 (19:13 +0000)]
Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

This patch extends some existing warnings to utilize the knowledge about the gsl::Pointer and gsl::Owner attributes.

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

llvm-svn: 368072

4 years agoAdded Delta IR Reduction Tool
Diego Trevino Ferrer [Tue, 6 Aug 2019 18:59:11 +0000 (18:59 +0000)]
Added Delta IR Reduction Tool

Summary: Tool parses input IR file, and runs the delta debugging algorithm to reduce the functions inside the input file.

Reviewers: alexshap, chandlerc

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368071

4 years ago[clang-doc] Add index in each info html file
Diego Astiazaran [Tue, 6 Aug 2019 18:31:46 +0000 (18:31 +0000)]
[clang-doc] Add index in each info html file

An index structure is created while generating the output file for each
info. This structure is parsed to JSON and written to a file in the
output directory. The html for the index is not rendered by clang-doc. A
Javascript file is included in the output directory, this will the JSON
file and insert HTML elements into the file.

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

llvm-svn: 368070

4 years agoVarious build fixes for lldb on MinGW
Haibo Huang [Tue, 6 Aug 2019 18:20:43 +0000 (18:20 +0000)]
Various build fixes for lldb on MinGW

Subscribers: mstorsjo, lldb-commits

Tags: #lldb

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

llvm-svn: 368069

4 years ago[OPENMP][OFFLOADING]Fix the test, NFC.
Alexey Bataev [Tue, 6 Aug 2019 18:13:39 +0000 (18:13 +0000)]
[OPENMP][OFFLOADING]Fix the test, NFC.

llvm-svn: 368068

4 years ago[GISel]: Fix trivial build breakage
Aditya Nandakumar [Tue, 6 Aug 2019 17:53:04 +0000 (17:53 +0000)]
[GISel]: Fix trivial build breakage

llvm-svn: 368067

4 years ago[lldb][CMake] Generating Xcode projects
Stefan Granitz [Tue, 6 Aug 2019 17:21:34 +0000 (17:21 +0000)]
[lldb][CMake] Generating Xcode projects

Summary:
Print a warning if the wrong cache script is used when generating a Xcode project, because it's too easy to confuse with Apple-lldb-macOS.cmake

```
  When building with Xcode, we recommend using the corresponding cache
  script.  If this was a mistake, clean your build directory and re-run
  CMake with:

    -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake

  See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject
```

Also set the generator inside the cache script.

Reviewers: JDevlieghere, jingham, clayborg

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 368066

4 years ago[GISel]: Add GISelKnownBits analysis
Aditya Nandakumar [Tue, 6 Aug 2019 17:18:29 +0000 (17:18 +0000)]
[GISel]: Add GISelKnownBits analysis

https://reviews.llvm.org/D65698

This adds a KnownBits analysis pass for GISel. This was done as a
pass (compared to static functions) so that we can add other features
such as caching queries(within a pass and across passes) in the future.
This patch only adds the basic pass boiler plate, and implements a lazy
non caching knownbits implementation (ported from SelectionDAG). I've
also hooked up the AArch64PreLegalizerCombiner pass to use this - there
should be no compile time regression as the analysis is lazy.

llvm-svn: 368065

4 years ago[modulemap] exclude a non-module friendly header
Kristina Brooks [Tue, 6 Aug 2019 17:16:56 +0000 (17:16 +0000)]
[modulemap] exclude a non-module friendly header

Exclude Attributor.h from LLVM_Transforms to avoid
a link failure when building modular LLVM.

llvm-svn: 368064

4 years ago[globalisel] Allow SrcOp to convert an APInt and render it as an immediate operand...
Daniel Sanders [Tue, 6 Aug 2019 17:16:27 +0000 (17:16 +0000)]
[globalisel] Allow SrcOp to convert an APInt and render it as an immediate operand (MO.isImm() == true)

Summary:
This is tested by D61289 but has been pulled into a separate patch at
a reviewers request.

Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, arsenm, rovka

Reviewed By: arsenm

Subscribers: javed.absar, hiraditya, wdng, kristof.beyls, Petar.Avramovic, llvm-commits

Tags: #llvm

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

llvm-svn: 368063

4 years ago[Syntax] Do not add a node for 'eof' into the tree
Ilya Biryukov [Tue, 6 Aug 2019 17:07:58 +0000 (17:07 +0000)]
[Syntax] Do not add a node for 'eof' into the tree

Summary:
While useful as a sentinel value when iterating over tokens, having
'eof' in the tree, seems to do more harm than good.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

llvm-svn: 368062

4 years ago[X86] Move CPU features for Barcelona/K10 out of line
Roman Lebedev [Tue, 6 Aug 2019 17:04:02 +0000 (17:04 +0000)]
[X86] Move CPU features for Barcelona/K10 out of line

Summary:
Cleans X86.td's Barcelona entry to be more like the others,
by moving the features out of the `Proc<>`, thus potentially
making it possible to inherit from them.
Split off from D63628

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 368061

4 years ago[TableGen] FieldInit: improve assertion message
Roman Lebedev [Tue, 6 Aug 2019 17:03:50 +0000 (17:03 +0000)]
[TableGen] FieldInit: improve assertion message

Summary:
When fiddling with sched profiles, especially creating new ones, it's amazingly easy
to end up with malformed .td that crashes tablegen, without explanation of the bug.
This changes the most common assertion i have encountered to dump enough information
to be able to fix the .td

Split of from D63628

Reviewers: RKSimon, craig.topper, nhaehnle

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368060

4 years ago[InstCombine] Shift amount reassociation: shl-trunc-shl pattern
Roman Lebedev [Tue, 6 Aug 2019 17:03:40 +0000 (17:03 +0000)]
[InstCombine] Shift amount reassociation: shl-trunc-shl pattern

Summary:
Currently `reassociateShiftAmtsOfTwoSameDirectionShifts()` only handles
two shifts one after another. If the shifts are `shl`, we still can
easily perform the fold, with no extra legality checks:
https://rise4fun.com/Alive/OQbM

If we have right-shift however, we won't be able to make it
any simpler than it already is.

After this the only thing missing here is constant-folding: (`NewShAmt >= bitwidth(X)`)
* If it's a logical shift, then constant-fold to `0` (not `undef`)
* If it's a `ashr`, then a splat of original signbit
https://rise4fun.com/Alive/E1K
https://rise4fun.com/Alive/i0V

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368059

4 years agoFixed toHalfOpenFileRange assertion fail
Shaurya Gupta [Tue, 6 Aug 2019 17:01:12 +0000 (17:01 +0000)]
Fixed toHalfOpenFileRange assertion fail

Summary:
- Added new function that gets Expansion range with both ends in the same file.
- Fixes the crash at https://github.com/clangd/clangd/issues/113

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

Tags: #clang

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

llvm-svn: 368058

4 years ago[ELF][PPC] Don't relax ifunc toc-indirect accesses to toc-relative
Fangrui Song [Tue, 6 Aug 2019 16:57:54 +0000 (16:57 +0000)]
[ELF][PPC] Don't relax ifunc toc-indirect accesses to toc-relative

Fixes PR42759.

```
// If ifunc is taken address in -fPIC code, it may have a toc entry
.section .toc,"aw",@progbits
  .quad ifunc

// ifunc may be defined as STT_GNU_IFUNC in another object file
.type ifunc, %gnu_indirect_function
```

If ifunc is non-preemptable (e.g. when linking an executable), the toc
entry will be relocated by R_PPC64_IRELATIVE.

R_*_IRELATIVE represents the symbolic value of a
non-preemptable ifunc (not associated with a canonical PLT) in a writable location. It has an unknown value at
link time, so we cannot apply toc-indirect to toc-relative relaxation.

Reviewed By: luporl, sfertile

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

llvm-svn: 368057

4 years ago[NFC][EarlyCSE] Pre-commit unary FNeg tests.
Cameron McInally [Tue, 6 Aug 2019 16:41:30 +0000 (16:41 +0000)]
[NFC][EarlyCSE] Pre-commit unary FNeg tests.

llvm-svn: 368056

4 years agoRe-land D65760/r367944
Diego Caballero [Tue, 6 Aug 2019 16:24:17 +0000 (16:24 +0000)]
Re-land D65760/r367944

Fixed most vexing parse ambiguation.

llvm-svn: 368055

4 years ago[compiler-rt] Rename FuzzedDataProvider.h to .hpp and other minor changes.
Max Moroz [Tue, 6 Aug 2019 16:02:39 +0000 (16:02 +0000)]
[compiler-rt] Rename FuzzedDataProvider.h to .hpp and other minor changes.

Summary:
.hpp makes more sense for this header as it's C++ only, plus it
contains the actual implementation.

Reviewers: Dor1s

Reviewed By: Dor1s

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

Tags: #llvm, #sanitizers

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

llvm-svn: 368054

4 years ago[Path] Fix bug in make_absolute logic
Jonas Devlieghere [Tue, 6 Aug 2019 15:46:45 +0000 (15:46 +0000)]
[Path] Fix bug in make_absolute logic

This fixes a bug for making path with a //net style root absolute. I
discovered the bug while writing a test case for the VFS, which uses
these paths because they're both legal absolute paths on Windows and
Unix.

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

llvm-svn: 368053

4 years ago[AST] Traverse attributes inside DEF_TRAVERSE_DECL macro
Ilya Biryukov [Tue, 6 Aug 2019 15:46:12 +0000 (15:46 +0000)]
[AST] Traverse attributes inside DEF_TRAVERSE_DECL macro

Summary:
Instead of traversing inside the TraverseDecl() function.
Previously the attributes were traversed after Travese(Some)Decl
returns.

Logically attributes are properties of particular Decls and should be
traversed alongside other "child" nodes.

None of the tests relied on this behavior, hopefully this is an indication
that the change is relatively safe.

This change started with a discussion on cfe-dev, for details see:
https://lists.llvm.org/pipermail/cfe-dev/2019-July/062899.html

Reviewers: rsmith, gribozavr

Reviewed By: gribozavr

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 368052

4 years ago[libc++] Use the monorepo in the macos-trunk CI script
Louis Dionne [Tue, 6 Aug 2019 15:28:34 +0000 (15:28 +0000)]
[libc++] Use the monorepo in the macos-trunk CI script

llvm-svn: 368051

4 years ago[CMake] Add mapping for IBM XL -qnoeh and -qnortti
Hubert Tong [Tue, 6 Aug 2019 15:08:13 +0000 (15:08 +0000)]
[CMake] Add mapping for IBM XL -qnoeh and -qnortti

Summary:
This patch maps in the `-qnoeh` and `-qnortti` options for building with
IBM XL compilers.

Reviewers: daltenty, xingxue, jasonliu

Reviewed By: daltenty

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368050

4 years ago[AArch64] NFC: Generalize emitFrameOffset to support more than byte offsets.
Sander de Smalen [Tue, 6 Aug 2019 15:06:31 +0000 (15:06 +0000)]
[AArch64] NFC: Generalize emitFrameOffset to support more than byte offsets.

Refactor emitFrameOffset to accept a StackOffset struct as its offset argument.
This method currently only supports byte offsets (MVT::i8) but will be extended
in a later patch to support scalable offsets (MVT::nxv1i8) as well.

Reviewers: thegameg, rovka, t.p.northover, efriedma, greened

Reviewed By: efriedma

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

llvm-svn: 368049

4 years ago[XCOFF][MC] report_fatal_error before dereferencing NULL
Hubert Tong [Tue, 6 Aug 2019 15:05:20 +0000 (15:05 +0000)]
[XCOFF][MC] report_fatal_error before dereferencing NULL

This patch replaces a TODO comment with a call to `report_fatal_error`.
The path that reaches the added call to `report_fatal_error` manifestly
dereferences a null pointer.

llvm-svn: 368048

4 years ago[test/Object] - Cleanup the Object\obj2yaml.test a bit.
George Rimar [Tue, 6 Aug 2019 14:34:39 +0000 (14:34 +0000)]
[test/Object] - Cleanup the Object\obj2yaml.test a bit.

This makes 2 changes:

1) Removes unwind-section.elf-x86-64 object and the corresponding test case,
because SHT_X86_64_UNWIND is already tested here:
https://github.com/llvm-mirror/llvm/blob/master/test/tools/obj2yaml/section-type.yaml

2) Removes/partially moves "No such file or directory" test, because we already have a similar test here:
https://github.com/llvm-mirror/llvm/blob/master/test/tools/obj2yaml/invalid_input_file.test

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

llvm-svn: 368044

4 years ago[TargetLowering] SimplifyMultipleUseDemandedBits - return UNDEF for undemanded ops
Simon Pilgrim [Tue, 6 Aug 2019 14:30:42 +0000 (14:30 +0000)]
[TargetLowering] SimplifyMultipleUseDemandedBits - return UNDEF for undemanded ops

If we demand no bits/elts from an Op, just return UNDEF

llvm-svn: 368043

4 years ago[StructurizeCFG] Enable -structurizecfg-relaxed-uniform-regions by default
Tim Renouf [Tue, 6 Aug 2019 14:30:19 +0000 (14:30 +0000)]
[StructurizeCFG] Enable -structurizecfg-relaxed-uniform-regions by default

D62198 introduced an option to relax the checks for
hasOnlyUniformBranches. This commit turns the option on by default, for
better code generation in some cases in AMDGPU.

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

Change-Id: I9cbff002a1e74d3b7eb96b4192dc8129936d537d
llvm-svn: 368042

4 years ago[ELF][ARM] Fix /DISCARD/ of section with .ARM.exidx section
Peter Smith [Tue, 6 Aug 2019 14:13:38 +0000 (14:13 +0000)]
[ELF][ARM] Fix /DISCARD/ of section with .ARM.exidx section

The combineEhSections runs, by design, before processSectionCommands so
that input exception sections like .ARM.exidx and .eh_frame are not assigned
to OutputSections. Unfortunately if /DISCARD/ removes InputSections that
have associated .ARM.exidx sections without discarding the .ARM.exidx
synthetic section then we will end up crashing when trying to sort the
InputSections in ascending address order.

We fix this by filtering out the sections that have been discarded prior
to processing the InputSections in finalizeContents().

fixes pr42890

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

llvm-svn: 368041

4 years ago[ELF] Make binding (weak or non-weak) logic consistent for Undefined and SharedSymbol
Fangrui Song [Tue, 6 Aug 2019 14:03:45 +0000 (14:03 +0000)]
[ELF] Make binding (weak or non-weak) logic consistent for Undefined and SharedSymbol

This is a case missed by D64136. If %t1.o has a weak reference on foo,
and %t2.so has a non-weak reference on foo:

```
0. ld.lld %t1.o %t2.so          # ok; STB_WEAK; accepted since D64136
1. ld.lld %t2.so %t1.o          # undefined symbol: foo; STB_GLOBAL
2. gold %t1.o %t2.so            # ok; STB_WEAK
3. gold %t2.so %t1.o            # undefined reference to 'foo'; STB_GLOBAL
4. ld.bfd %t1.o %t2.so          # undefined reference to `foo'; STB_WEAK
5. ld.bfd %t2.so %t1.o          # undefined reference to `foo'; STB_WEAK
```

It can be argued that in both cases, the binding of the undefined foo
should be set to STB_WEAK, because the binding should not be affected by
referenced from shared objects.

--allow-shlib-undefined doesn't suppress errors (3,4,5), but -shared or
--noinhibit-exec allows ld.bfd/gold to produce a binary:

```
3. gold -shared %t2.so %t1.o    # ok; STB_GLOBAL
4. ld.bfd -shared %t2.so %t1.o  # ok; STB_WEAK
5. ld.bfd -shared %t1.o %t1.o   # ok; STB_WEAK
```

If %t2.so has DT_NEEDED entries, ld.bfd will load them (lld/gold don't
have the behavior). If one of the DSO defines foo and it is in the
link-time search path (e.g. DT_NEEDED entry is an absolute path, via
-rpath=, via -rpath-link=, etc),
`ld.bfd %t1.o %t2.so` and `ld.bfd %t1.o %t2.so` will not error.

In this patch, we make Undefined and SharedSymbol share the same binding
computing logic. Case 1 will be allowed:

```
0. ld.lld %t1.o %t2.so          # ok; STB_WEAK; accepted since D64136
1. ld.lld %t2.so %t1.o          # ok; STB_WEAK; changed by this patch
```

In the future, we can explore the option that turns both (0,1) into
errors if --no-allow-shlib-undefined (default when linking an
executable) is in action.

Reviewed By: ruiu

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

llvm-svn: 368038