platform/upstream/llvm.git
4 years ago[LoopPred/WC] Use a dominating widenable condition to remove analyze loop exits
Philip Reames [Mon, 18 Nov 2019 19:21:53 +0000 (11:21 -0800)]
[LoopPred/WC] Use a dominating widenable condition to remove analyze loop exits

This implements a version of the predicateLoopExits transform from IndVarSimplify extended to exploit widenable conditions - and thus be much wider in scope of legality. The code structure ends up being almost entirely different, so I chose to duplicate this into the LoopPredication pass instead of trying to reuse the code in the IndVars.

The core notions of the transform are as follows:

    If we have a widenable condition which controls entry into the loop, we're allowed to widen it arbitrarily. Given that, it's simply a *profitability* question as to what conditions to fold into the widenable branch.
    To avoid pass ordering issues, we want to avoid widening cases that would otherwise be dischargeable. Or... widen in a form which can still be discharged. Thus, we phrase the transform as selecting one analyzeable exit from the set of analyzeable exits to keep. This avoids creating pass ordering complexities.
    Since none of the above proves that we actually exit through our analyzeable exits - we might exit through something else entirely - we limit ourselves to cases where a) the latch is analyzeable and b) the latch is predicted taken, and c) the exit being removed is statically cold.

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

4 years agoReland: [Remarks][Driver] Use different remark files when targeting multiple architec...
Francis Visoiu Mistrih [Mon, 18 Nov 2019 18:09:31 +0000 (10:09 -0800)]
Reland: [Remarks][Driver] Use different remark files when targeting multiple architectures

When the driver is targeting multiple architectures at once, for things
like Universal Mach-Os, we need to emit different remark files for each
cc1 invocation to avoid overwriting the files from a different
invocation.

For example:

$ clang -c -o foo.o -fsave-optimization-record -arch x86_64 -arch x86_64h

will create two remark files:

* foo-x86_64.opt.yaml
* foo-x86_64h.opt.yaml

4 years ago[PowerPC] Test case for vector float gather on ppc64le and ppc64
Stefan Pintilie [Mon, 18 Nov 2019 19:08:22 +0000 (13:08 -0600)]
[PowerPC] Test case for vector float gather on ppc64le and ppc64

Test case to verify that the expected code is generated for a
vector float gather based on the patterns in tablegen for big
and little endian cases.

Patch by: Kamau Bridgeman

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

4 years agoRevert "[Remarks][Driver] Use different remark files when targeting multiple architec...
Reid Kleckner [Mon, 18 Nov 2019 18:52:10 +0000 (10:52 -0800)]
Revert "[Remarks][Driver] Use different remark files when targeting multiple architectures"

This reverts commit b4e2b112b58154a89171df39dae80044865ff4ff.

Test doesn't appear to pass on Windows, maybe all non-Mac.

4 years agoTemporarily Revert "Add support for options -frounding-math, ftrapping-math, -ffp...
Eric Christopher [Mon, 18 Nov 2019 18:45:23 +0000 (10:45 -0800)]
Temporarily Revert "Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior="
and a follow-up NFC rearrangement as it's causing a crash on valid. Testcase is on the original review thread.

This reverts commits af57dbf12e54f3a8ff48534bf1078f4de104c1cd and e6584b2b7b2de06f1e59aac41971760cac1e1b79

4 years agoAllocate builtins table earlier to fix bug found by ubsan
Reid Kleckner [Mon, 18 Nov 2019 18:37:54 +0000 (10:37 -0800)]
Allocate builtins table earlier to fix bug found by ubsan

Follow up to 979da9a4c3ba

4 years ago[Remarks][Driver] Use different remark files when targeting multiple architectures
Francis Visoiu Mistrih [Mon, 18 Nov 2019 18:09:31 +0000 (10:09 -0800)]
[Remarks][Driver] Use different remark files when targeting multiple architectures

When the driver is targeting multiple architectures at once, for things
like Universal Mach-Os, we need to emit different remark files for each
cc1 invocation to avoid overwriting the files from a different
invocation.

For example:

$ clang -c -o foo.o -fsave-optimization-record -arch x86_64 -arch x86_64h

will create two remark files:

* foo-x86_64.opt.yaml
* foo-x86_64h.opt.yaml

4 years ago[builtins] Implement rounding mode support for i386/x86_64
Yi Kong [Thu, 26 Sep 2019 21:45:09 +0000 (14:45 -0700)]
[builtins] Implement rounding mode support for i386/x86_64

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

4 years ago[Signal] Allow llvm clients to opt into one-shot SIGPIPE handling
Vedant Kumar [Thu, 14 Nov 2019 22:30:56 +0000 (14:30 -0800)]
[Signal] Allow llvm clients to opt into one-shot SIGPIPE handling

Allow clients of the llvm library to opt-in to one-shot SIGPIPE
handling, instead of forcing them to undo llvm's SIGPIPE handler
registration (which is brittle).

The current behavior is preserved for all llvm-derived tools (except
lldb) by means of a default-`true` flag in the InitLLVM constructor.

This prevents "IO error" crashes in long-lived processes (lldb is the
motivating example) which both a) load llvm as a dynamic library and b)
*really* need to ignore SIGPIPE.

As llvm signal handlers can be installed when calling into libclang
(say, via RemoveFileOnSignal), thereby overriding a previous SIG_IGN for
SIGPIPE, there is no clean way to opt-out of "exit-on-SIGPIPE" in the
current model.

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

4 years ago[libomptarget][nfc] Move some source into common from nvptx
Jon Chesterfield [Mon, 18 Nov 2019 18:16:35 +0000 (18:16 +0000)]
[libomptarget][nfc] Move some source into common from nvptx

Summary:
[libomptarget][nfc] Move some source into common from nvptx

Moves some source that compiles cleanly under amdgcn into a common subdirectory
Includes some non-trivial files and some headers. Keeps the cuda file extension.

The build systems for different architectures seem unlikely to have much in
common. The idea is therefore to set include paths such that files under
common/src compile as if they were under arch/src as the mechanism for sharing.
In particular, files under common/src need to be able to include target_impl.h.

The corresponding -Icommon is left out in favour of explicit includes on the
basis that the it makes it clearer which files under common are used by a given
architecture.

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: ABataev

Subscribers: jfb, mgorny, openmp-commits

Tags: #openmp

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

4 years agoFix shared lib build.
Michael Liao [Mon, 18 Nov 2019 18:07:08 +0000 (13:07 -0500)]
Fix shared lib build.

4 years agoReplace bitfield in lldb::Type with byte-sized members. (NFC)
Adrian Prantl [Mon, 18 Nov 2019 17:58:16 +0000 (09:58 -0800)]
Replace bitfield in lldb::Type with byte-sized members. (NFC)

Due to alginment and packing using separate members takes up the same
amount of space, but makes it far less cumbersome to deal with it in
constructors etc.

4 years ago[cmake] Factor out DEFAULT_SANITIZER_MIN_OSX_VERSION
Julian Lettner [Mon, 18 Nov 2019 17:37:40 +0000 (09:37 -0800)]
[cmake] Factor out DEFAULT_SANITIZER_MIN_OSX_VERSION

4 years agoBump sanitizer iOS deployment target to 9.0
Julian Lettner [Thu, 7 Nov 2019 00:41:40 +0000 (16:41 -0800)]
Bump sanitizer iOS deployment target to 9.0

Bump default value for `-miphoneos-version-min=x` to 9.0 (from 8.0).
TSan tests that use thread local storage `__thread` (e.g., tls_race.cpp)
are failing to link for the iOS simulator (arch=x86_64 and
-miphoneos-version-min=8.0) on internal/master (will be submitted to
Glacier train):
```
ld: targeted OS version does not support use of thread local variables in _main for architecture x86_64
```

iOS 9.0 was released 2015.

4 years agoBump sanitizer macOS deployment target to 10.10
Julian Lettner [Thu, 7 Nov 2019 00:32:05 +0000 (16:32 -0800)]
Bump sanitizer macOS deployment target to 10.10

Bump default value for `SANITIZER_MIN_OSX_VERSION` to 10.10 (from 10.9).
TSan does not work on macOS 10.9 and a nice error message is preferable
to an "unreferenced symbol" error when loading the TSan runtime.

We could try to only bump the deployment target for TSan, but we would
have to invest into adding support for this to our CMake build and it
does not seem worth it.  macOS 10.10 was released in 2014.

rdar://31335781

4 years ago[Docs] Add Python caveats under the development section
Jonas Devlieghere [Mon, 18 Nov 2019 17:14:14 +0000 (09:14 -0800)]
[Docs] Add Python caveats under the development section

This adds a page named Caveats with a section on some of the things to
be aware of related to Python. It's a question we've seen more than once
pop up and I think it's good to have it documentation on the website.
Even though some of it might be useful to users, I still put it under
"development" because it requires some understanding of how LLDB is
built.

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

4 years ago[yaml2obj][test] Move tests to binary format specific subdirectories
Fangrui Song [Mon, 18 Nov 2019 17:06:14 +0000 (09:06 -0800)]
[yaml2obj][test] Move tests to binary format specific subdirectories

Create COFF/, ELF/, and Minidump and move tests there.

Also

* Rename `*.test` to `*.yaml`
* For yaml2obj RUN lines, use `-o %t` instead of `> %t` for consistency.
  We still have tests that check stdout is the default output, e.g.
  multi-doc.test
* Update tests to consistently use `##` for comments.
  `#` is for RUN and CHECK lines.
* Merge symboless-relocation.yaml and invalid-symboless-relocation.yaml to ELF/relocation-implicit-symbol-index.test

Reviewed By: grimar, jhenderson

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

4 years ago[Attr] Fix `-ast-print` for `asm` attribute
Joel E. Denny [Mon, 18 Nov 2019 15:22:14 +0000 (10:22 -0500)]
[Attr] Fix `-ast-print` for `asm` attribute

Without this fix, the tests introduced here produce the following
assert fail:

```
clang: /home/jdenny/llvm/clang/include/clang/Basic/AttributeCommonInfo.h:163: unsigned int clang::AttributeCommonInfo::getAttributeSpellingListIndex() const: Assertion `(isAttributeSpellingListCalculated() || AttrName) && "Spelling cannot be found"' failed.
```

The bug was introduced by D67368, which caused `AsmLabelAttr`'s
spelling index to be set to `SpellingNotCalculated`.

Reviewed By: aaron.ballman

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

4 years ago[dwarfgen] Fix initialization order error. [NFCI]
Francesco Petrogalli [Mon, 18 Nov 2019 16:41:03 +0000 (16:41 +0000)]
[dwarfgen] Fix initialization order error. [NFCI]

This commit fixes the `-Werror=reorder` builds.

4 years ago[OPENMP50]Fix PR44024: runtime assert in distribute construct.
Alexey Bataev [Mon, 18 Nov 2019 16:13:08 +0000 (11:13 -0500)]
[OPENMP50]Fix PR44024: runtime assert in distribute construct.

If the code is emitted for distribute construct, the nonmonotonic
modifier should not be added.

4 years ago[ASan] Mark test as UNSUPPORTED for iOS simulator
Julian Lettner [Mon, 18 Nov 2019 16:00:46 +0000 (08:00 -0800)]
[ASan] Mark test as UNSUPPORTED for iOS simulator

coverage-fork.cpp uses `fork()` which requires additional permissions
in the iOS simulator sandbox.  We cannot use `sandbox-exec` to grant
these permissions since this is a Posix (not Darwin) test.

4 years agogn build: Merge 2054ed052f1
LLVM GN Syncbot [Mon, 18 Nov 2019 15:48:35 +0000 (15:48 +0000)]
gn build: Merge 2054ed052f1

4 years ago[clangd] Store xref for Macros in ParsedAST.
Utkarsh Saxena [Thu, 7 Nov 2019 11:14:38 +0000 (12:14 +0100)]
[clangd] Store xref for Macros in ParsedAST.

This patch adds the cross references for Macros in the MainFile.
We add references for the main file to the ParsedAST. We query the
references from it using the SymbolID.
Xref outside main file will be added to the index in a separate patch.

4 years ago[NFC] Clean up debug-names-verify-completeness.s test
Pavel Labath [Mon, 18 Nov 2019 15:15:02 +0000 (16:15 +0100)]
[NFC] Clean up debug-names-verify-completeness.s test

This patch replaces the tabs by spaces and avoid the need for a
debug_str section by moving all strings inline. It also removes the
hardcoded DIE offsets in the test, which will simplify a follow-up
patch.

4 years ago[clangd] Implement rename by using SelectionTree and findExplicitReferences.
Haojian Wu [Wed, 6 Nov 2019 14:04:48 +0000 (15:04 +0100)]
[clangd] Implement rename by using SelectionTree and findExplicitReferences.

Summary:
With the new implemenation, we will have better coverage of various AST
nodes, and fix some known/potential bugs.

Also added the existing clang-renamae tests. Known changed behavior:
 - "~Fo^o()" will not trigger the rename, will fix afterwards
 - references in macro bodies are not renamed now

This fixes:
- https://github.com/clangd/clangd/issues/167
- https://github.com/clangd/clangd/issues/169
- https://github.com/clangd/clangd/issues/171

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[NFC] Fix test reserve_global_reg.ll after 2d739f9
Russell Gallop [Mon, 18 Nov 2019 15:03:14 +0000 (15:03 +0000)]
[NFC] Fix test reserve_global_reg.ll after 2d739f9

4 years agoRevert "[DWARF5]Addition of alignment atrribute in typedef DIE."
Sam McCall [Mon, 18 Nov 2019 14:53:22 +0000 (15:53 +0100)]
Revert "[DWARF5]Addition of alignment atrribute in typedef DIE."

This reverts commit 423f541c1a322963cf482683fe9777ef0692082d, which
breaks llvm-c ABI.

4 years agoarm64_32: support function return in FastISel.
Tim Northover [Mon, 24 Sep 2018 13:07:59 +0000 (14:07 +0100)]
arm64_32: support function return in FastISel.

4 years agoRe-commit "DWARF location lists: Add section index dumping"
Pavel Labath [Thu, 14 Nov 2019 10:22:00 +0000 (11:22 +0100)]
Re-commit "DWARF location lists: Add section index dumping"

This reapplies c0f6ad7d1f3ccb9d0b9ce9ef8dfa06409ccf1b3e with an
additional fix in test/DebugInfo/X86/constant-loclist.ll, which had a
slightly different output on windows targets. The test now accounts for
this difference.

The original commit message follows.

Summary:
As discussed in D70081, this adds the ability to dump section
names/indices to the location list dumper. It does this by moving the
range specific logic from DWARFDie.cpp:dumpRanges into the
DWARFAddressRange class.

The trickiest part of this patch is the backflip in the meanings of the
two dump flags for the location list sections.

The dumping of "raw" location list data is now controlled by
"DisplayRawContents" flag. This frees up the "Verbose" flag to be used
to control whether we print the section index. Additionally, the
DisplayRawContents flag is set for section-based dumps whenever the
--verbose option is passed, but this is not done for the "inline" dumps.

Also note that the index dumping currently does not work for the DWARF
v5 location lists, as the parser does not fill out the appropriate
fields. This will be done in a separate patch.

Reviewers: dblaikie, probinson, JDevlieghere, SouraVX

Subscribers: sdardis, hiraditya, jrtc27, atanasyan, arphaman, aprantl, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU][MC][GFX10] Enabled v_movrel*[sdwa|dpp|dpp8] opcodes
Dmitry Preobrazhensky [Mon, 18 Nov 2019 14:23:40 +0000 (17:23 +0300)]
[AMDGPU][MC][GFX10] Enabled v_movrel*[sdwa|dpp|dpp8] opcodes

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

Reviewers: arsenm, rampitec

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

4 years ago[clangd] Fix some clang-tidy warnings on SourceCodeTests.cpp, NFC.
Haojian Wu [Mon, 18 Nov 2019 14:17:50 +0000 (15:17 +0100)]
[clangd] Fix some clang-tidy warnings on SourceCodeTests.cpp, NFC.

4 years ago[lldb] Fix JSON parser to allow empty arrays
Alex Cameron [Mon, 18 Nov 2019 14:11:29 +0000 (15:11 +0100)]
[lldb] Fix JSON parser to allow empty arrays

Summary:
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=39405
```
alexc@kitty:~/work/wiredtiger/build_posix$ cat breakpoint.json
[{"Breakpoint" : {"BKPTOptions" : {"AutoContinue" : false,"ConditionText" : "","EnabledState" : true,"IgnoreCount" : 0,"OneShotState" : false},"BKPTResolver" : {"Options" : {"NameMask" : [56],"Offset" : 0,"SkipPrologue" : true,"SymbolNames" : ["__wt_btcur_search"]},"Type" : "SymbolName"},"Hardware" : false,"SearchFilter" : {"Options" : {},"Type" : "Unconstrained","Foo" : []}}}]
```
**Before**
```
(lldb) breakpoint read --file breakpoint.json
error: Invalid JSON from input file: /home/alexc/work/wiredtiger/build_posix/breakpoint.json.
```
**After**
```
(lldb) breakpoint read --file breakpoint.json
New breakpoints:
Breakpoint 1: where = libwiredtiger-3.2.2.so`__wt_btcur_search + 15 at bt_cursor.c:522:5, address = 0x00007ffff576ab2f
```

Reviewers: xbolva00, davide, labath

Reviewed By: davide, labath

Subscribers: mgorny, jingham, labath, davide, JDevlieghere, lldb-commits

Tags: #llvm, #lldb

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

4 years agoRemove useless param tag to fix Wdocumentation warning. NFCI.
Simon Pilgrim [Mon, 18 Nov 2019 14:08:46 +0000 (14:08 +0000)]
Remove useless param tag to fix Wdocumentation warning. NFCI.

4 years ago[clangd] Fix diagnostic warnings in the RenameTests, NFC.
Haojian Wu [Mon, 18 Nov 2019 13:56:59 +0000 (14:56 +0100)]
[clangd] Fix diagnostic warnings in the RenameTests, NFC.

4 years agoFix cppcheck shadow variable warning. NFC.
Simon Pilgrim [Mon, 18 Nov 2019 13:57:20 +0000 (13:57 +0000)]
Fix cppcheck shadow variable warning. NFC.

4 years agollvm-objcopy - fix uninitialized variable warnings. NFC.
Simon Pilgrim [Mon, 18 Nov 2019 13:56:21 +0000 (13:56 +0000)]
llvm-objcopy  - fix uninitialized variable warnings. NFC.

4 years agoAvoid duplicate exe_path definition on recent FreeBSD
Ed Maste [Mon, 18 Nov 2019 13:49:55 +0000 (08:49 -0500)]
Avoid duplicate exe_path definition on recent FreeBSD

4 years ago[OpenMP] Add implementation and tests of Archer tool
protze@itc.rwth-aachen.de [Mon, 18 Nov 2019 00:23:31 +0000 (01:23 +0100)]
[OpenMP] Add implementation and tests of Archer tool

The tool provides TSAN annotations for OpenMP synchronization. The tool
is activated if no other OMPT tool is loaded.

The tool detects whether the application was built with TSan and rejects
activation according to the OMPT protocol if there is no TSan-rt.

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

4 years agoRevert rGc0f6ad7d1f3c : "DWARF location lists: Add section index dumping"
Simon Pilgrim [Mon, 18 Nov 2019 13:26:32 +0000 (13:26 +0000)]
Revert rGc0f6ad7d1f3c : "DWARF location lists: Add section index dumping"

This reverts commit c0f6ad7d1f3ccb9d0b9ce9ef8dfa06409ccf1b3e to fix the buildbots.

4 years agoDwarfGenerator - fix uninitialized variable warnings. NFC.
Simon Pilgrim [Mon, 18 Nov 2019 12:06:13 +0000 (12:06 +0000)]
DwarfGenerator - fix uninitialized variable warnings. NFC.

4 years agoFix uninitialized variable warning. NFC.
Simon Pilgrim [Mon, 18 Nov 2019 12:05:40 +0000 (12:05 +0000)]
Fix uninitialized variable warning. NFC.

4 years agollvm-rc - fix uninitialized variable warnings. NFC.
Simon Pilgrim [Mon, 18 Nov 2019 12:04:48 +0000 (12:04 +0000)]
llvm-rc - fix uninitialized variable warnings. NFC.

4 years agoFix uninitialized variable warning. NFC.
Simon Pilgrim [Mon, 18 Nov 2019 11:55:30 +0000 (11:55 +0000)]
Fix uninitialized variable warning. NFC.

4 years ago[lldb][NFC] Cleanup comments in ClangASTSource.h
Raphael Isemann [Mon, 18 Nov 2019 13:14:52 +0000 (14:14 +0100)]
[lldb][NFC] Cleanup comments in ClangASTSource.h

The current file doesn't follow the 80 character limit and uses this
cramped comment style that is hard to read.

4 years agoFix a print error found while testing llvm-objcopy
Aaron Smith [Mon, 18 Nov 2019 13:07:35 +0000 (13:07 +0000)]
Fix a print error found while testing llvm-objcopy

A value was not printed as hex. This updates the output and test cases.

4 years ago[PowerPC] [NFC] add IR testcases for folding rlwinma.
czhengsz [Mon, 18 Nov 2019 12:43:30 +0000 (07:43 -0500)]
[PowerPC] [NFC] add IR testcases for folding rlwinma.

4 years ago[SVE][CodeGen] Scalable vector MVT size queries
Graham Hunter [Wed, 14 Aug 2019 10:48:39 +0000 (11:48 +0100)]
[SVE][CodeGen] Scalable vector MVT size queries

* Implements scalable size queries for MVTs, split out from D53137.

* Contains a fix for FindMemType to avoid using scalable vector type
  to contain non-scalable types.

* Explicit casts for several places where implicit integer sign
  changes or promotion from 32 to 64 bits caused problems.

* CodeGenDAGPatterns will treat scalable and non-scalable vector types
  as different.

Reviewers: greened, cameron.mcinally, sdesmalen, rovka

Reviewed By: rovka

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

4 years ago[clangd] Expose the xref's incomplete flag to clangdServer API.
Haojian Wu [Mon, 18 Nov 2019 10:35:00 +0000 (11:35 +0100)]
[clangd] Expose the xref's incomplete flag to clangdServer API.

Summary: so that clangd C++ API users (via ClangdServer) can access it.

Reviewers: sammccall

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

Tags: #clang

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

4 years agoFix "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Mon, 18 Nov 2019 11:42:14 +0000 (11:42 +0000)]
Fix "not all control paths return a value" warning. NFCI.

4 years ago[X86][SSE] Add test for extractelement with multiple uses
Simon Pilgrim [Mon, 18 Nov 2019 11:36:14 +0000 (11:36 +0000)]
[X86][SSE] Add test for extractelement with multiple uses

Mentioned in D70267

4 years agoFix signed/unsigned comparison warning. NFCI.
Simon Pilgrim [Mon, 18 Nov 2019 11:34:34 +0000 (11:34 +0000)]
Fix signed/unsigned comparison warning. NFCI.

4 years ago[RISCV] Add assembly mnemonic spell checking
Simon Cook [Mon, 18 Nov 2019 10:58:00 +0000 (10:58 +0000)]
[RISCV] Add assembly mnemonic spell checking

Summary:
This allows the assembler to suggest alternative assembly mnemonics when
an invalid one has been provided.

Reviewers: asb, lenary, lewis-revill

Reviewed By: asb

Subscribers: hiraditya, rbar, johnrusso, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, sameer.abuasal, llvm-commits

Tags: #llvm

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

4 years ago[RISCV] Set triple based on -march flag
Simon Cook [Mon, 18 Nov 2019 10:44:13 +0000 (10:44 +0000)]
[RISCV] Set triple based on -march flag

For RISC-V the value provided to -march should determine whether to
compile for 32- or 64-bit RISC-V irrespective of the target provided to
the Clang driver. This adds a test for this flag for RISC-V and sets the
Target architecture correctly in these cases.

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

4 years ago[NFC][Test] Add the vavg test for PowerPC
QingShan Zhang [Mon, 18 Nov 2019 10:13:21 +0000 (10:13 +0000)]
[NFC][Test] Add the vavg test for PowerPC

4 years ago[ARM,MVE] Add InstCombine rules for pred_i2v / pred_v2i.
Simon Tatham [Mon, 18 Nov 2019 10:38:17 +0000 (10:38 +0000)]
[ARM,MVE] Add InstCombine rules for pred_i2v / pred_v2i.

If you're writing C code using the ACLE MVE intrinsics that passes the
result of a vcmp as input to a predicated intrinsic, e.g.

  mve_pred16_t pred = vcmpeqq(v1, v2);
  v_out = vaddq_m(v_inactive, v3, v4, pred);

then clang's codegen for the compare intrinsic will create calls to
`@llvm.arm.mve.pred.v2i` to convert the output of `icmp` into an
`mve_pred16_t` integer representation, and then the next intrinsic
will call `@llvm.arm.mve.pred.i2v` to convert it straight back again.
This will be visible in the generated code as a `vmrs`/`vmsr` pair
that move the predicate value pointlessly out of `p0` and back into it again.

To prevent that, I've added InstCombine rules to remove round trips of
the form `v2i(i2v(x))` and `i2v(v2i(x))`. Also I've taught InstCombine
about the known and demanded bits of those intrinsics. As a result,
you now get just the generated code you wanted:

  vpt.u16 eq, q1, q2
  vaddt.u16 q0, q3, q4

Reviewers: ostannard, MarkMurrayARM, dmgreen

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ARM,MVE] Add intrinsics for vector comparisons.
Simon Tatham [Mon, 18 Nov 2019 10:38:48 +0000 (10:38 +0000)]
[ARM,MVE] Add intrinsics for vector comparisons.

This adds the `vcmp` family of ACLE MVE intrinsics: vector/vector,
vector/scalar, and the predicated forms of both. All are represented
using standard existing IR: vector/scalar comparisons are represented
by making a vector out of the scalar first, and predicated forms are
represented by taking the bitwise AND of the input predicate and the
output of the comparison. Existing LLVM-side tests demonstrate that
ISel will pattern-match all of that back down to single MVE VCMPs.

The idiom of handling a vector/scalar operation by generating IR to
expand the scalar into a second vector is going to be needed for a lot
of MVE intrinsics, so to make that easy, I've provided a helper
function that automatically works out the element count.

The comparison intrinsics are the first ones that have to //return// a
predicate, in the user-facing `mve_pred16_t` format. This means we
have to use the `arm_mve_pred_v2i` low-level intrinsic to convert it
back from the logical `<n x i1>` form used in IR. I've done that
explicitly in the code gen specification for the builtins, because it
happens much more rarely in the ACLE API than passing a Predicate as
input, so it didn't seem worth automating in MveEmitter.

Reviewers: ostannard, MarkMurrayARM, dmgreen

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[lldb] [Process/NetBSD] Implement thread name getting
Michał Górny [Sun, 17 Nov 2019 21:01:19 +0000 (22:01 +0100)]
[lldb] [Process/NetBSD] Implement thread name getting

Implement thread name getting sysctl() on NetBSD.  Also fix
the incorrect type in pthread_setname_np() in the relevant test.

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

4 years ago[lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs
Michał Górny [Fri, 15 Nov 2019 20:02:57 +0000 (21:02 +0100)]
[lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs

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

4 years ago[AST] Attach comment in `/** doc */ typedef struct A {} B` to B as well as A.
Sam McCall [Wed, 13 Nov 2019 20:30:31 +0000 (21:30 +0100)]
[AST] Attach comment in `/** doc */ typedef struct A {} B` to B as well as A.

Summary:
Semantically they're the same thing, and it's important when the underlying
struct is anonymous.

There doesn't seem to be a problem attaching the same comment to multiple things
as it already happens with `/** doc */ int a, b;`

This affects an Index test but the results look better (name present, USR points
to the typedef).

Fixes https://github.com/clangd/clangd/issues/189

Reviewers: kadircet, lh123

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

Tags: #clang

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

4 years ago[ARM] Allocatable Global Register Variables for ARM
Anna Welker [Thu, 14 Nov 2019 11:56:07 +0000 (11:56 +0000)]
[ARM] Allocatable Global Register Variables for ARM

      Provides support for using r6-r11 as globally scoped
      register variables. This requires a -ffixed-rN flag
      in order to reserve rN against general allocation.

      If for a given GRV declaration the corresponding flag
      is not found, or the the register in question is the
      target's FP, we fail with a diagnostic.

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

4 years agoDWARF location lists: Add section index dumping
Pavel Labath [Thu, 14 Nov 2019 10:22:00 +0000 (11:22 +0100)]
DWARF location lists: Add section index dumping

Summary:
As discussed in D70081, this adds the ability to dump section
names/indices to the location list dumper. It does this by moving the
range specific logic from DWARFDie.cpp:dumpRanges into the
DWARFAddressRange class.

The trickiest part of this patch is the backflip in the meanings of the
two dump flags for the location list sections.

The dumping of "raw" location list data is now controlled by
"DisplayRawContents" flag. This frees up the "Verbose" flag to be used
to control whether we print the section index. Additionally, the
DisplayRawContents flag is set for section-based dumps whenever the
--verbose option is passed, but this is not done for the "inline" dumps.

Also note that the index dumping currently does not work for the DWARF
v5 location lists, as the parser does not fill out the appropriate
fields. This will be done in a separate patch.

Reviewers: dblaikie, probinson, JDevlieghere, SouraVX

Subscribers: sdardis, hiraditya, jrtc27, atanasyan, arphaman, aprantl, llvm-commits

Tags: #llvm

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

4 years ago[Sparc] Fix "Cannot select" error for AtomicFence on 32-bit V9
James Clarke [Mon, 18 Nov 2019 09:45:07 +0000 (09:45 +0000)]
[Sparc] Fix "Cannot select" error for AtomicFence on 32-bit V9

Summary:
This also adds testing of 32-bit V9 atomic lowering, splitting the
64-bit-only tests out into their own file.

Reviewers: venkatra, jyknight

Reviewed By: jyknight

Subscribers: hiraditya, fedor.sergeev, jfb, llvm-commits, glaubitz

Tags: #llvm

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

4 years ago[LegalizeTypes] Remove SoftenFloat handling from ExpandIntRes_LLROUND_LLRINT and...
Craig Topper [Mon, 18 Nov 2019 07:23:07 +0000 (23:23 -0800)]
[LegalizeTypes] Remove SoftenFloat handling from ExpandIntRes_LLROUND_LLRINT and remove assert from the strict fp path.

These were both recently added. While the call to GetSoftenedFloat
is a little more optimal, we don't do it in the expand for
FP_TO_SINT/UINT so there's no real reason to do it here. This
avoids a FIXME for strict fp.

4 years ago[LegalizeTypes] Remove unnecessary conversion from EVT to MVT to MVT::SimpleValueType...
Craig Topper [Mon, 18 Nov 2019 05:43:56 +0000 (21:43 -0800)]
[LegalizeTypes] Remove unnecessary conversion from EVT to MVT to MVT::SimpleValueType just to assign back to EVT. NFC

4 years agoFix Windows buildbots
Rui Ueyama [Mon, 18 Nov 2019 07:44:13 +0000 (16:44 +0900)]
Fix Windows buildbots

`stdout` and `stderr` might be defined as macros, so we needed to
avoid using them as variable names.

4 years agoRename __is_foo_iterator traits to reflect their Cpp17 nature.
Eric Fiselier [Mon, 18 Nov 2019 06:46:58 +0000 (01:46 -0500)]
Rename __is_foo_iterator traits to reflect their Cpp17 nature.

With the upcoming introduction of iterator concepts in ranges,
the meaning of "__is_contiguous_iterator" changes drastically.

Currently we intend it to mean "does it have this iterator category",
but it could now also mean "does it meet the requirements of this
concept", and these can be different.

4 years agollvm/ObjCARC: Split OptimizeIndividualCallImpl out of OptimizeIndividualCalls, NFC
Duncan P. N. Exon Smith [Mon, 18 Nov 2019 00:51:34 +0000 (16:51 -0800)]
llvm/ObjCARC: Split OptimizeIndividualCallImpl out of OptimizeIndividualCalls, NFC

Split out a helper function for the individual call optimizations and
skip useless calls to it (where the instruction is not an ARC
intrinsic).  Besides reducing indentation (and possibly speeding up
compile time in some small way), an upcoming patch will add additional
calls and expand out the `switch`.

4 years ago[LegalizeTypes][X86] Add support for expanding the result type of STRICT_LLROUND...
Craig Topper [Mon, 18 Nov 2019 03:58:11 +0000 (19:58 -0800)]
[LegalizeTypes][X86] Add support for expanding the result type of STRICT_LLROUND and STRICT_LLRINT.

This doesn't handle softening the input type, but we don't handle
softening any of the strict nodes yet. Skipping that made it easy
to reuse an existing function for creating a libcall from a node
with a chain.

4 years ago[PowerPC] extend PPCPreIncPrep Pass for ds/dq form
czhengsz [Mon, 18 Nov 2019 02:32:26 +0000 (21:32 -0500)]
[PowerPC] extend PPCPreIncPrep Pass for ds/dq form

Now, PPCPreIncPrep pass changes a loop to update form and update all load/store
with same base accordingly. We can do more for load/store with same base, for
example, convert load/store with same base to ds/dq form.

Reviewed by: jsji

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

4 years ago[docs] Fix broken links in Kaleidoscope chapter 3
Brian Gesiak [Mon, 18 Nov 2019 02:35:02 +0000 (21:35 -0500)]
[docs] Fix broken links in Kaleidoscope chapter 3

Several links in this document referred to `LangImpl4.html` or
`LangImpl7.html`. However, now these pages use two digits, so for these
links to function they need to be modified to `LangImpl04.html`, and so
on -- note the extra `0`.

4 years agollvm/ObjCARC: Use continue to reduce some nesting, NFC
Duncan P. N. Exon Smith [Mon, 18 Nov 2019 00:29:44 +0000 (16:29 -0800)]
llvm/ObjCARC: Use continue to reduce some nesting, NFC

4 years agoMake it possible to redirect not only errs() but also outs()
Rui Ueyama [Fri, 15 Nov 2019 05:06:57 +0000 (14:06 +0900)]
Make it possible to redirect not only errs() but also outs()

This change is for those who use lld as a library. Context:
https://reviews.llvm.org/D70287

This patch adds a new parmeter to lld::*::link() so that we can pass
an raw_ostream object representing stdout. Previously, lld::*::link()
took only an stderr object.

Justification for making stdoutOS and stderrOS mandatory: I wanted to
make link() functions to take stdout and stderr in that order.
However, if we change the function signature from

  bool link(ArrayRef<const char *> args, bool canExitEarly,
            raw_ostream &stderrOS = llvm::errs());

to

  bool link(ArrayRef<const char *> args, bool canExitEarly,
            raw_ostream &stdoutOS = llvm::outs(),
            raw_ostream &stderrOS = llvm::errs());

, then the meaning of existing code that passes stderrOS silently
changes (stderrOS would be interpreted as stdoutOS). So, I chose to
make existing code not to compile, so that developers can fix their
code.

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

4 years ago[InstCombine] prevent crashing/assert on shift constant expression (PR44028)
Sanjay Patel [Sun, 17 Nov 2019 22:26:11 +0000 (17:26 -0500)]
[InstCombine] prevent crashing/assert on shift constant expression (PR44028)

The binary operator cast implies an instruction, but the matcher for shift does not:
https://bugs.llvm.org/show_bug.cgi?id=44028

4 years ago[LegalizeTypes] When expanding the integer result of LLROUND/LLRINT, also call GetSof...
Craig Topper [Sun, 17 Nov 2019 06:08:53 +0000 (22:08 -0800)]
[LegalizeTypes] When expanding the integer result of LLROUND/LLRINT, also call GetSoftenedFloat if the floating point input needs to be softened.

Before this we were emitting a bitcast to integer from the lowering
code that itself will need to be legalized. By calling
GetSoftenedFloat we get the integer conversion in one step without
needing to relegalize a bitcast.

4 years ago[LegalizeTypes] Remove PromoteFloat support form ExpandIntRes_LLROUND_LLRINT.
Craig Topper [Sun, 17 Nov 2019 03:46:53 +0000 (19:46 -0800)]
[LegalizeTypes] Remove PromoteFloat support form ExpandIntRes_LLROUND_LLRINT.

This code isn't exercised, and was in the wrong place. If we need
this, we would need to promote the type before figuring out which
libcall to use.

I'm choosing to remove it rather than fixing since we don't
support PromoteFloat for LRINT/LROUND/LLRINT/LLROUND when the
result type is legal so I don't see much reason to support it
for the case where the result type isn't legal.

4 years ago[LegalizeTypes] Merge ExpandIntRes_LLROUND and ExpandIntRes_LLRINT into one function...
Craig Topper [Sun, 17 Nov 2019 03:27:43 +0000 (19:27 -0800)]
[LegalizeTypes] Merge ExpandIntRes_LLROUND and ExpandIntRes_LLRINT into one function that handles both. NFC

These too functions are were the same except for which libcall gets
emitted. Just merge them into one.

This is prep work for some other work including strict fp support.

4 years ago[ConstantFold] Handle identity folds at top of ConstantFoldBinaryInst
Florian Hahn [Sun, 17 Nov 2019 21:29:55 +0000 (21:29 +0000)]
[ConstantFold] Handle identity folds at top of ConstantFoldBinaryInst

Currently we miss folds with undef and identity values for binary ops
that do not fold to undef in general.

We can generalize the identity simplifications and do them before
checking for undef in particular.

Alive checks:
 * OR - https://rise4fun.com/Alive/8OsK
 * AND - https://rise4fun.com/Alive/e3tE

This will also allow us to remove some now redundant cases throughout
the function, but I would like to do this as follow-up. That should make
tracking down potential issues easier.

Reviewers: spatel, RKSimon, lebedev.ri

Reviewed By: spatel

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

4 years ago[ConstantFold] Add some tests for binops with constants and undefs.
Florian Hahn [Wed, 13 Nov 2019 10:20:59 +0000 (10:20 +0000)]
[ConstantFold] Add some tests for binops with constants and undefs.

Precommit tests for D70169.

4 years ago[Attributor] Use nofree argument attribute for heap-to-stack conversion
Stefan Stipanovic [Sun, 17 Nov 2019 20:35:04 +0000 (21:35 +0100)]
[Attributor] Use nofree argument attribute for heap-to-stack conversion

Reviewers: jdoerfert, uenoku

Subscribers:

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

4 years ago[SimplifyCFG] propagate fast-math-flags (FMF) from phi to select
Sanjay Patel [Sun, 17 Nov 2019 16:23:44 +0000 (11:23 -0500)]
[SimplifyCFG] propagate fast-math-flags (FMF) from phi to select

Similar to/extension of D70208 (rGee0882bdf866), but this one
may finally allow closing motivating bugs.

This is another step towards having FMF apply only to FP values
rather than those + fcmp. See PR38086 for one of the original
discussions/motivations:
https://bugs.llvm.org/show_bug.cgi?id=38086

And the test here is derived from PR39535:
https://bugs.llvm.org/show_bug.cgi?id=39535

Currently, we lose FMF when converting any phi to select in
SimplifyCFG. There are a small number of similar changes needed
to correct within SimplifyCFG, so it should be quick to patch
this pass up.

FMF was extended to select and phi with:
D61917
D67564

4 years ago[SimplifyCFG] add fast-math-flags to tests for better coverage; NFC
Sanjay Patel [Sun, 17 Nov 2019 15:37:42 +0000 (10:37 -0500)]
[SimplifyCFG] add fast-math-flags to tests for better coverage; NFC

The conversion to select fails to propagate FMF.

4 years ago[SimplifyCFG] add tests for possible FP speculative select; NFC
Sanjay Patel [Sun, 17 Nov 2019 15:27:47 +0000 (10:27 -0500)]
[SimplifyCFG] add tests for possible FP speculative select; NFC

It doesn't seem that there are any perf/param knobs that can be turned
to create selects for the FP variants of the tests, but that may not
always be true in the future. If it changes, we should propagate FMF.

4 years ago[InstCombine] Canonicalize ssub.with.overflow with clamp to ssub.sat
David Green [Sun, 17 Nov 2019 10:45:00 +0000 (10:45 +0000)]
[InstCombine] Canonicalize ssub.with.overflow with clamp to ssub.sat

Working on top of D69252, this adds canonicalisation patterns for ssub.with.overflow to ssub.sats.

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

4 years ago[InstCombine] Canonicalize sadd.with.overflow with clamp to sadd.sat
David Green [Sun, 17 Nov 2019 10:40:26 +0000 (10:40 +0000)]
[InstCombine] Canonicalize sadd.with.overflow with clamp to sadd.sat

This adds to D69245, adding extra signed patterns for folding from a
sadd_with_overflow to a sadd_sat. These are more complex than the
unsigned patterns, as the overflow can occur in either direction.

For the add case, the positive overflow can only occur if both of the
values are positive (same for both the values being negative). So there
is an extra select on whether to use the positive or negative overflow
limit.

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

4 years ago[InstCombine] Add extra tests for overflow_to_sat.ll. NFC
David Green [Sun, 17 Nov 2019 10:32:12 +0000 (10:32 +0000)]
[InstCombine] Add extra tests for overflow_to_sat.ll. NFC

4 years agoRevert "[NFC] Refactor representation of materialized temporaries"
Nico Weber [Sun, 17 Nov 2019 07:09:25 +0000 (02:09 -0500)]
Revert "[NFC] Refactor representation of materialized temporaries"

This reverts commit 08ea1ee2db5f9d6460fef1d79d0d1d1a5eb78982.
It broke ./ClangdTests/FindExplicitReferencesTest.All
on the bots, see comments on https://reviews.llvm.org/D69360

4 years ago[MIRNamer]: Make the check lines in the test robust with regex.
Aditya Nandakumar [Sun, 17 Nov 2019 06:58:45 +0000 (22:58 -0800)]
[MIRNamer]: Make the check lines in the test robust with regex.

Previously we were checking for specific hashes. Make it check for
regexes.

Should fix failure caused by: 72768685567b

4 years ago[libc++] Add _ITER_CONCEPT and _ITER_TRAITS implementations from C++20
Eric Fiselier [Sun, 17 Nov 2019 01:24:39 +0000 (20:24 -0500)]
[libc++] Add _ITER_CONCEPT and _ITER_TRAITS implementations from C++20

These traits are currently unused because we don't implement ranges.
However, their addition is part of ongoing work to allow libc++
to optimize on user-provided contiguous iterators.

4 years ago[libc++] Add C++20 contiguous_iterator_tag.
Eric Fiselier [Sun, 17 Nov 2019 01:12:48 +0000 (20:12 -0500)]
[libc++] Add C++20 contiguous_iterator_tag.

This work is part of an ongoing effort to allow libc++ to
optimize user provided contiguous iterators.

4 years ago[Docs] Remove stray :doc: directive.
kristina [Sat, 16 Nov 2019 23:32:48 +0000 (23:32 +0000)]
[Docs] Remove stray :doc: directive.

4 years ago[Docs] Fix sphinx warning.
kristina [Sat, 16 Nov 2019 23:23:26 +0000 (23:23 +0000)]
[Docs] Fix sphinx warning.

Fix sphinx warning over an ambigious reference.

4 years ago[Docs] Try fixing the tutorial toctree
kristina [Sat, 16 Nov 2019 23:06:50 +0000 (23:06 +0000)]
[Docs] Try fixing the tutorial toctree

Unorphan the old tutorial and reference every page in the index
explicitly. This should hopefully make Sphinx generate correct
hyperlinks now.

4 years agoMake it possible to run MIRCanonicalizer in pipeline.
Aditya Nandakumar [Sat, 16 Nov 2019 22:14:20 +0000 (14:14 -0800)]
Make it possible to run MIRCanonicalizer in pipeline.

https://reviews.llvm.org/D70321

4 years ago[libc++] Rename __to_raw_pointer to __to_address.
Eric Fiselier [Sat, 16 Nov 2019 22:13:26 +0000 (17:13 -0500)]
[libc++] Rename __to_raw_pointer to __to_address.

This function has the same behavior as the now-standand std::to_address.
Re-using the name makes the behavior more clear, and in the future it
will allow us to correctly get the raw pointer for user provided pointer
types.

4 years ago[Docs] Fix relative links in tutorial.
kristina [Sat, 16 Nov 2019 20:58:08 +0000 (20:58 +0000)]
[Docs] Fix relative links in tutorial.

Update relative links in Kaleidoscope tutorial.

4 years ago[mips] Remove redundant cast. NFC
Simon Atanasyan [Sat, 16 Nov 2019 07:09:01 +0000 (10:09 +0300)]
[mips] Remove redundant cast. NFC

4 years ago[mips] Remove old FIXME comment. NFC
Simon Atanasyan [Sat, 16 Nov 2019 06:19:58 +0000 (09:19 +0300)]
[mips] Remove old FIXME comment. NFC

The issue was fixed at r275050.

4 years ago[NFC] Refactor representation of materialized temporaries
Tyker [Sat, 16 Nov 2019 16:04:34 +0000 (17:04 +0100)]
[NFC] Refactor representation of materialized temporaries

Summary:
this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718

Reviewers: rsmith, martong, shafik

Reviewed By: rsmith

Subscribers: rnkovacs, arphaman, cfe-commits

Tags: #clang

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

4 years ago[DWARF5]Addition of alignment atrribute in typedef DIE.
Sourabh Singh Tomar [Fri, 15 Nov 2019 20:44:34 +0000 (02:14 +0530)]
[DWARF5]Addition of alignment atrribute in typedef DIE.

This patch, adds support for DW_AT_alignment[DWARF5] attribute, to be emitted with typdef DIE.
When explicit alignment is specified.

Patch by Awanish Pandey <Awanish.Pandey@amd.com>

Reviewers: aprantl, dblaikie, jini.susan.george, SouraVX, alok,
deadalinx

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

4 years ago[clangd] Improve long and confusing preamble log message.
Sam McCall [Sat, 16 Nov 2019 16:11:54 +0000 (17:11 +0100)]
[clangd] Improve long and confusing preamble log message.