platform/upstream/llvm.git
4 years ago[lldb-vscode] Ensure that target matches the executable file
Tatyana Krasnukha [Thu, 13 Feb 2020 16:33:08 +0000 (19:33 +0300)]
[lldb-vscode] Ensure that target matches the executable file

This commit fixes an issue with lldb-vscode failing to run programs that
use different architecture/platform than the "empty" in the target.
Original implementation was creating a default target without specifying
the target architecture, platform or program, and then would set
executable file through SBLaunchInfo, assuming that this would update
architecture and platform accordingly. However this wasn't really
happening, and architecture and platform would remain at whatever values
were in the "empty" target. The simple solution is to create target
already for a desired architecture and platform.

Function request_attach is updated in a similar fashion.

This commit also adds new JSON properties to "launch" and "attach"
packets to allow user to override desired platform and architecture.
This might be especially important for cases where information in ELF is
not enough to derive those values correctly.

New code has a behavior similar to LLDB MI [1], where typically IDE would
specify target file with -file-exec-and-symbols, and then only do -exec-run
command that would launch the process. In lldb-vscode those two actions are
merged into one request_launch function. Similarly in the interpreter
session, user would first do "file" command, then "process launch"

Differential Revision: https://reviews.llvm.org/D70847
Signed-off-by: Anton Kolesov <anton.kolesov@synopsys.com>
4 years agoStop emitting a breakpoint for each location in a breakpoint when responding to break...
Greg Clayton [Wed, 29 Jan 2020 22:11:40 +0000 (14:11 -0800)]
Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.

Summary: The VS Code DAP expects on response for each breakpoint that was requested. If we responsd with multiple entries for one breakpoint the VS Code UI gets out of date. Currently the VS code DAP doesn't handle one breakpoint with multiple locations. If this ever gets fixed we can modify our code.

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[ARM] Fix infinite loop when lowering STRICT_FP_EXTEND
John Brawn [Thu, 13 Feb 2020 14:52:33 +0000 (14:52 +0000)]
[ARM] Fix infinite loop when lowering STRICT_FP_EXTEND

If the target has FP64 but not FP16 then we have custom lowering for FP_EXTEND
and STRICT_FP_EXTEND with type f64. However if the extend is from f32 to f64 the
current implementation will cause in infinite loop for STRICT_FP_EXTEND due to
emitting a merge_values of the original node which after replacement becomes a
merge_values of itself.

Fix this by not doing anything for f32 to f64 extend when we have FP64, though
for STRICT_FP_EXTEND we have to do the strict-to-nonstrict mutation as that
doesn't happen automatically for opcodes with custom lowering.

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

4 years ago[OPENMP50]Fix handling of clauses in parallel master taskloop directive.
Alexey Bataev [Thu, 13 Feb 2020 14:21:15 +0000 (09:21 -0500)]
[OPENMP50]Fix handling of clauses in parallel master taskloop directive.

We need to capture correctly the value of num_tasks clause and should
not try to emit the if clause at all in the task region.

4 years ago[MLIR][GPU] Implement initial mapping from loop.parallel to gpu.launch.
Stephan Herhut [Fri, 7 Feb 2020 12:22:10 +0000 (13:22 +0100)]
[MLIR][GPU] Implement initial mapping from loop.parallel to gpu.launch.

Summary:
To unblock other work, this implements basic lowering based on mapping
attributes that have to be provided on all loop.parallel. The lowering
does not yet support reduce.

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

4 years ago[VectorCombine] adjust tests for extract-binop; NFC
Sanjay Patel [Thu, 13 Feb 2020 15:50:03 +0000 (10:50 -0500)]
[VectorCombine] adjust tests for extract-binop; NFC

We want the extra-use tests to be consistent with the
earlier single-use tests and be as cheap as possible
in vector form to show cost model edge cases. So use
i8 and extract from element 0 since that should be
cheap for all x86 targets.

4 years ago[OPENMP]Fix the test, NFC.
Alexey Bataev [Thu, 13 Feb 2020 15:29:22 +0000 (10:29 -0500)]
[OPENMP]Fix the test, NFC.

4 years ago[VectorCombine] add more extract-binop tests; NFC
Sanjay Patel [Thu, 13 Feb 2020 15:06:25 +0000 (10:06 -0500)]
[VectorCombine] add more extract-binop tests; NFC

See D74495.

4 years ago[llvm][lldb] Update links to ABI for the Arm Architecture. [NFC]
Francesco Petrogalli [Thu, 13 Feb 2020 14:50:22 +0000 (14:50 +0000)]
[llvm][lldb] Update links to ABI for the Arm Architecture. [NFC]

4 years ago[PowerPC][NFC] Small cleanup to restore CR field code in PPCFrameLowering.
Sean Fertile [Thu, 13 Feb 2020 14:22:47 +0000 (09:22 -0500)]
[PowerPC][NFC] Small cleanup to restore CR field code in PPCFrameLowering.

Skip the loop over the CalleSavedInfos in 'restoreCalleeSavedRegisters' when
the register is a CR field and we are not targeting 32-bit ELF. This is safe
because:
1) The helper function 'restoreCRs' returns if the target is not 32-bit ELF,
   making all the code in the loop related to CR fields dead for every other
   subtarget. This code is only called on ELF right now, but the patch
   to extend it for AIX also needs to skip 'restoreCRs'.
2) The loop will not otherwise modify the iterator, so the iterator
   manipulations at the bottom of the loop end up setting 'I' to its
   current value.

This simplifciation allows us to remove one argument from 'restoreCRs'.

Also add a helper function to determine if a register is one of the
callee saved condition register fields.

4 years agoattempt to fix check-clang on windows after c49866ac
Nico Weber [Thu, 13 Feb 2020 14:31:50 +0000 (09:31 -0500)]
attempt to fix check-clang on windows after c49866ac

4 years ago[lldb] Introduce "RegInfoBasedABI"
Pavel Labath [Sun, 2 Feb 2020 09:27:40 +0000 (10:27 +0100)]
[lldb] Introduce "RegInfoBasedABI"

Summary:
This patch creates a new subclass of the ABI class in order to abstract away the
mechanism in which we "augment" register information. This enables alternate
augmentation strategies to be introduced.

All existing ABI classes have been modified to inherit from RegInfoBasedABI, but
they will be refactored in subsequent patches.

Reviewers: JDevlieghere, jasonmolenda

Subscribers: sdardis, nemanjai, kbarton, jrtc27, atanasyan, jsji, lldb-commits

Tags: #lldb

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

4 years agoMove FIXME to start of comment so visual studio actually tags it. NFC.
Simon Pilgrim [Thu, 13 Feb 2020 13:56:23 +0000 (13:56 +0000)]
Move FIXME to start of comment so visual studio actually tags it. NFC.

4 years ago[X86][SSE] Add i686-SSE2 bswap vector tests
Simon Pilgrim [Thu, 13 Feb 2020 13:53:45 +0000 (13:53 +0000)]
[X86][SSE] Add i686-SSE2 bswap vector tests

4 years ago[gn build] Fix sync script on renames like "Foo.cpp" -> "LLVMFoo.cpp"
Nico Weber [Thu, 13 Feb 2020 13:51:42 +0000 (08:51 -0500)]
[gn build] Fix sync script on renames like "Foo.cpp" -> "LLVMFoo.cpp"

Before, the script used `git log -SFoo.cpp` to find a commit where
the number of occurrences of "Foo.cpp" changed -- but since
a patch with

  + LLVMFoo.cpp
  - Foo.cpp

contains the same number of instances of "Foo.cpp", the script
incorrectly skipped this type of rename.

As fix, look for '\bFoo\.cpp\b' instead and pass --pickaxe-regex
so that we can grep for word boundaries.

To test, check out 7531a5039fd (which renamed in llvm/lib/IR
RemarkStreamer.cpp to LLVMRemarkStreamer.cpp) and look at the output of
the script.  Before this change, it correctly assigned the addition
of LLVMRemarkStreamer.cpp to 7531a5039fd but incorrectly assigned
the removal of RemarkStreamer.cpp to b8a847c.  With this, it
correctly assigns both to 7531a5039fd.

4 years ago[debuginfo-tests][Dexter] Fix some Windows-unfriendly Dexter behaviours
Jeremy Morse [Thu, 13 Feb 2020 14:24:33 +0000 (14:24 +0000)]
[debuginfo-tests][Dexter] Fix some Windows-unfriendly Dexter behaviours

These are some minor things that I've run into on Windows, largely in
error handling paths:

 * Giving --lldb-executable on Windows triggers a "useless option" code
   path, which touches an attribute that only exists in the
   list_debuggers tool. Switch this to use hasattr, which will work in
   all subtools.
 * We were over-decoding some text reporting errors, but only in an
   exception path
 * The path to lldb on Windows needs to be quoted (even though dexter
   isn't making use of it).

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

4 years ago[clangd] Expose Code Completion score to the client
Kirill Bobyrev [Thu, 13 Feb 2020 13:17:30 +0000 (14:17 +0100)]
[clangd] Expose Code Completion score to the client

Summary:
Make it possible for the client to adjust the ranking by using the score Clangd
calculates for the completion items.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test...
Raphael Isemann [Thu, 13 Feb 2020 12:40:22 +0000 (13:40 +0100)]
[lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test suite

Summary:
The error message from the construct `assertTrue(a == b, "msg") ` are nearly always completely useless for actually debugging the issue.
This patch is just replacing this construct (and similar ones like `assertTrue(a != b, ...)` with the proper call to assertEqual or assertNotEquals.

This patch was mostly written by a shell script with some manual verification afterwards:
```
lang=python
import sys

def sanitize_line(line):
  if line.strip().startswith("self.assertTrue(") and " == " in line:
    line = line.replace("self.assertTrue(", "self.assertEquals(")
    line = line.replace(" == ", ", ", 1)
  if line.strip().startswith("self.assertTrue(") and " != " in line:
    line = line.replace("self.assertTrue(", "self.assertNotEqual(")
    line = line.replace(" != ", ", ", 1)
  return line

for a in sys.argv[1:]:
  with open(a, "r") as f:
    lines = f.readlines()
  with open(a, "w") as f:
    for line in lines:
      f.write(sanitize_line(line))
```

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: abidh, lldb-commits

Tags: #lldb

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

4 years agoAdd '#include <functional>` to PassManager.h.
Alexander Belyaev [Wed, 12 Feb 2020 09:12:28 +0000 (10:12 +0100)]
Add '#include <functional>` to PassManager.h.

Summary:
On some platforms the build fails "std::function is not found". The include is used in
PassManager::IRPrinterConfig::enableIRPrinting.

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

4 years ago[lldb] Fix lldb-dotest
Pavel Labath [Thu, 13 Feb 2020 13:29:50 +0000 (14:29 +0100)]
[lldb] Fix lldb-dotest

to account for the new location of test files from 99451b445.

4 years agoFix integration of pass plugins with llvm dylib
serge-sans-paille [Wed, 12 Feb 2020 07:57:19 +0000 (08:57 +0100)]
Fix integration of pass plugins with llvm dylib

Call llvm_process_pass_plugin from clang when in standalone mode.

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

4 years agoRework go bindings so that validation works fine
serge-sans-paille [Thu, 13 Feb 2020 11:03:33 +0000 (12:03 +0100)]
Rework go bindings so that validation works fine

Basically change the layout to please `go build` and remove references to
`llvm-go`.

Update llvm/test/Bindings/Go/ to use the system go compiler

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

4 years ago[PowerPC] Exploit VSX rounding instrs for rint
Qiu Chaofan [Thu, 13 Feb 2020 12:59:50 +0000 (20:59 +0800)]
[PowerPC] Exploit VSX rounding instrs for rint

Exploit native VSX rounding instruction, x(v|s)r(d|s)pic, which does
rounding using current rounding mode.

According to C standard library, rint may raise INEXACT exception while
nearbyint won't.

Reviewed By: lkail

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

4 years ago[analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax
Gabor Marton [Thu, 13 Feb 2020 11:11:24 +0000 (12:11 +0100)]
[analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

Summary:
Both EOF and the max value of unsigned char is platform dependent. In this
patch we try our best to deduce the value of EOF from the Preprocessor,
if we can't we fall back to -1.

Reviewers: Szelethus, NoQ

Subscribers: whisperity, xazax.hun, kristof.beyls, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalh

Tags: #clang

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

4 years ago[debuginfo-tests] Fix Dexter process creation failure on Windows
Jeremy Morse [Thu, 13 Feb 2020 12:43:28 +0000 (12:43 +0000)]
[debuginfo-tests] Fix Dexter process creation failure on Windows

When writing the Windows dbgeng driver for Dexter, I couldn't work out why it
would either launch a process and leave it free running, or if I started the
process suspended, never do anything with it. The result was a hack to create
and attach processes manually. This has been flaking out on Reids Windows
buildbot, and clearly wasn't a good solution.

Digging into this, it turns out that the "normal" cdb / windbg behaviour of
breaking whenever we attach to a process is not the default: it has to be
explicitly requested from the debug engine. This patch does so (by setting
DEBUG_ENGOPT_INITIAL_BREAK in the engine options), after which we can simply
call "CreateProcessAndAttach2" and everything automagically works.

No test for this behaviour: everything was just broken before.

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

4 years ago[clangd] Print the Spelled RefKind.
Haojian Wu [Thu, 13 Feb 2020 12:26:42 +0000 (13:26 +0100)]
[clangd] Print the Spelled RefKind.

4 years agoRe-revert: Recover debug intrinsics when killing duplicated/empty blocks
stozer [Thu, 13 Feb 2020 10:40:51 +0000 (10:40 +0000)]
Re-revert: Recover debug intrinsics when killing duplicated/empty blocks

This reverts commit 61b35e4111160fe834a00c33d040e01150b576ac.

This commit causes a timeout in chromium builds; likely to have a
similar cause to the previous timeout issue caused by this commit (see
6ded69f294a9 for more details). It is possible that there is no way to
fix this bug that will not cause this issue; further investigations as
to the efficiency of handling large amounts of debug info will be
necessary.

4 years agoFix the mac buildbot failure.
Haojian Wu [Thu, 13 Feb 2020 11:38:47 +0000 (12:38 +0100)]
Fix the mac buildbot failure.

4 years ago[clang] stop baremetal driver to append .a to lib
Christof Douma [Thu, 13 Feb 2020 11:08:46 +0000 (11:08 +0000)]
[clang] stop baremetal driver to append .a to lib

When the clang baremetal driver selects the rt.builtins static library
it prefix with "-l" and appends ".a". The result is a nonsense option
which lld refuses to accept.

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

Change-Id: Ic753b6104e259fbbdc059b68fccd9b933092d828

4 years ago[AArch64] Fix BTI landing pad generation.
Daniel Kiss [Thu, 13 Feb 2020 10:42:39 +0000 (10:42 +0000)]
[AArch64] Fix BTI landing pad generation.

In some cases BTI landing pad is inserted even compatible instruction
was there already. Meta instruction does not count in this case
therefore skip them in the check for first instructions in the function.

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

4 years ago[AArch64][SVE] Add mul/mla/mls lane & dup intrinsics
Kerry McLaughlin [Thu, 13 Feb 2020 10:11:22 +0000 (10:11 +0000)]
[AArch64][SVE] Add mul/mla/mls lane & dup intrinsics

Summary:
Implements the following intrinsics:
 - @llvm.aarch64.sve.dup
 - @llvm.aarch64.sve.mul.lane
 - @llvm.aarch64.sve.mla.lane
 - @llvm.aarch64.sve.mls.lane

Reviewers: c-rhodes, sdesmalen, dancgr, efriedma, rengolin

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

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

4 years agoFix unneeded semi column
Guillaume Chatelet [Thu, 13 Feb 2020 10:18:28 +0000 (11:18 +0100)]
Fix unneeded semi column

4 years ago[ARM] Fix ReconstructShuffle for bigendian
David Green [Wed, 12 Feb 2020 20:51:39 +0000 (20:51 +0000)]
[ARM] Fix ReconstructShuffle for bigendian

Simon pointed out that this function is doing a bitcast, which can be
incorrect for big endian. That makes the lowering of VMOVN in MVE
wrong, but the function is shared between Neon and MVE so both can
be incorrect.

This attempts to fix things by using the newly added VECTOR_REG_CAST
instead of the BITCAST. As it may now be used on Neon, I've added the
relevant patterns for it there too. I've also added a quick dag combine
for it to remove them where possible.

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

4 years ago[ARM] Extra vmovn tests to show BE differences. NFC
David Green [Wed, 12 Feb 2020 18:18:23 +0000 (18:18 +0000)]
[ARM] Extra vmovn tests to show BE differences. NFC

4 years ago[NFC][llvm-exegesis] Docs/help: opcode-index=-1 means measure everything
Roman Lebedev [Thu, 13 Feb 2020 09:45:15 +0000 (12:45 +0300)]
[NFC][llvm-exegesis] Docs/help: opcode-index=-1 means measure everything

4 years ago[LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.
Peter Smith [Thu, 13 Feb 2020 08:42:17 +0000 (08:42 +0000)]
[LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.

Recommit of 0b4a047bfbd11fe1f5abda8da0e2391c1918162a
(reverted in c29003813ab9bd6ea7b6de40ea8f1fe21979f13f) to incorporate
subsequent fix and add a warning when LLD's interworking behavior has
changed.

D73474 disabled the generation of interworking thunks for branch
relocations to non STT_FUNC symbols. This patch handles the case of BL and
BLX instructions to non STT_FUNC symbols. LLD would normally look at the
state of the caller and the callee and write a BL if the states are the
same and a BLX if the states are different.

This patch disables BL/BLX substitution when the destination symbol does
not have type STT_FUNC. This brings our behavior in line with GNU ld which
may prevent difficult to diagnose runtime errors when switching to lld.

This change does change how LLD handles interworking of symbols that do not
have type STT_FUNC from previous versions including the 10.0 release. This
brings LLD in line with ld.bfd but there may be programs that have not been
linked with ld.bfd that depend on LLD's previous behavior. We emit a warning
when the behavior changes.

A summary of the difference between 10.0 and 11.0 is that for symbols
that do not have a type of STT_FUNC LLD will not change a BL to a BLX or
vice versa. The table below enumerates the changes
| relocation     | STT_FUNC | bit(0) | in  | 10.0- out | 11.0+ out |
| R_ARM_CALL     | no       | 1      | BL  | BLX       | BL        |
| R_ARM_CALL     | no       | 0      | BLX | BL        | BLX       |
| R_ARM_THM_CALL | no       | 1      | BLX | BL        | BLX       |
| R_ARM_THM_CALL | no       | 0      | BL  | BLX       | BL        |

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

4 years ago[lldb] Clean up ProcessGDBRemote::DidLaunchOrAttach
Pavel Labath [Thu, 13 Feb 2020 09:26:58 +0000 (10:26 +0100)]
[lldb] Clean up ProcessGDBRemote::DidLaunchOrAttach

- reduce indentation by removing the defensive
  GetID()!=INVALID_PROCESS_ID check -- this function is only called when
  an attach or launch succeeds
- replace LLDB_LOGF with LLDB_LOG

4 years ago[clangd] Query constructors in the index during rename.
Haojian Wu [Tue, 11 Feb 2020 15:37:37 +0000 (16:37 +0100)]
[clangd] Query constructors in the index during rename.

Summary:
Though this is not needed when using clangd's own index, other indexes
(e.g. kythe) need it, as classes and their constructors are different
symbols, otherwise we will miss renaming constructors.

Reviewers: kbobyrev

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

Tags: #clang

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

4 years agoDon't call memcpy(p, 0, 0).
Richard Smith [Thu, 13 Feb 2020 08:35:27 +0000 (00:35 -0800)]
Don't call memcpy(p, 0, 0).

Found by UBSan, reported by Kostya. Thanks!

4 years ago[DebugInfo] Fix dumping CIE ID in .eh_frame sections.
Igor Kudrin [Wed, 29 Jan 2020 14:28:46 +0000 (21:28 +0700)]
[DebugInfo] Fix dumping CIE ID in .eh_frame sections.

We do not keep the actual value of the CIE ID field, because it is
predefined, and use a constant when dumping a CIE record. The issue
was that the predefined value is different for .debug_frame and
.eh_frame sections, but we always printed the one which corresponds
to .debug_frame. The patch fixes that by choosing an appropriate
constant to print.

See the following for more information about .eh_frame sections:
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html

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

4 years ago[mlir] Add elementAttr to TypedArrayAttrBase.
Abdurrahman Akkas [Thu, 13 Feb 2020 08:23:37 +0000 (09:23 +0100)]
[mlir] Add elementAttr to TypedArrayAttrBase.

In code generators, one can automate the translation of typed ArrayAttrs
if element attribute translators are already implemented. However, the
type of the element attribute is lost at the construction of
TypedArrayAttrBase. With this change one can inspect the element type
and generate the translation logic automatically, which will reduce the
code repetition.

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

4 years ago[NFC][mlir] Adding some helpful EDSC intrinsics
Kern Handa [Thu, 13 Feb 2020 08:20:50 +0000 (09:20 +0100)]
[NFC][mlir] Adding some helpful EDSC intrinsics

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

4 years ago[lldb] Make gdbremote.py utility py2and3 compatible
Pavel Labath [Thu, 13 Feb 2020 08:18:10 +0000 (09:18 +0100)]
[lldb] Make gdbremote.py utility py2and3 compatible

4 years ago[mlir][DeclarativeParser] Move operand type resolution into a functor to
River Riddle [Thu, 13 Feb 2020 07:56:07 +0000 (23:56 -0800)]
[mlir][DeclarativeParser] Move operand type resolution into a functor to
share code.

This reduces the duplication for the two different cases.

4 years ago[mlir][ODS][NFC] Mark OpaqueType as a buildable type.
River Riddle [Thu, 13 Feb 2020 07:51:38 +0000 (23:51 -0800)]
[mlir][ODS][NFC] Mark OpaqueType as a buildable type.

This allows for using it in the declarative assembly form, among other
things.

4 years ago[OpenMP][FIX] Collect blocks to be outlined after finalization
Johannes Doerfert [Thu, 13 Feb 2020 06:39:55 +0000 (00:39 -0600)]
[OpenMP][FIX] Collect blocks to be outlined after finalization

Finalization can introduce new blocks we need to outline as well so it
makes sense to identify the blocks that need to be outlined after
finalization happened. There was also a minor unit test adjustment to
account for the fact that we have a single outlined exit block now.

4 years ago[ELF][test] Change -o %t to -o /dev/null if the output is not needed
Fangrui Song [Thu, 13 Feb 2020 05:48:45 +0000 (21:48 -0800)]
[ELF][test] Change -o %t to -o /dev/null if the output is not needed

4 years agoExplicitly state the output file.
Sterling Augustine [Thu, 13 Feb 2020 05:22:34 +0000 (21:22 -0800)]
Explicitly state the output file.

Summary:
Even though this test is a check for failure, lld still attempts
to open the final output file, which fails when the default "a.out"
file is used and the current directory is read-only. Specifying an
output file works around this problem.

Reviewers: espindola

Subscribers: emaste, MaskRay, llvm-commits

Tags: #llvm

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

4 years agoRevert "Replace std::foo with std::foo_t in LLVM."
Vladimir Vereschaka [Thu, 13 Feb 2020 04:51:05 +0000 (20:51 -0800)]
Revert "Replace std::foo with std::foo_t in LLVM."

This reverts commit a4384c756bd8a819051009b5b273b2a34be8261b.

These changes break LLVM build on Windows builders.

See https://reviews.llvm.org/rGa4384c756bd8a819051009b5b273b2a34be8261b
for details.

4 years ago[X86] Add test RUN lines to show cases where we use 512-bit vcmppd/ps with garbage...
Craig Topper [Thu, 13 Feb 2020 04:39:30 +0000 (20:39 -0800)]
[X86] Add test RUN lines to show cases where we use 512-bit vcmppd/ps with garbage upper bits for 128/256-bit strict_fsetcc

On KNL targets, we widen 128/256-bit strict_fsetcc nodes to
512-bits without forcing the upper bits to zero. This can cause
spurious exceptions due to garbage upper bits. This behavior was
inherited from the non-strict case where the spurious exception
isn't a problem.

4 years ago[BPF] explicit warning of not supporting dynamic stack allocation
Yonghong Song [Thu, 13 Feb 2020 04:00:20 +0000 (20:00 -0800)]
[BPF] explicit warning of not supporting dynamic stack allocation

Currently, BPF does not support dynamic static allocation.
For a program like below:
  extern void bar(int *);
  void foo(int n) {
    int a[n];
    bar(a);
  }

The current error message looks like:
  unimplemented operand
  UNREACHABLE executed at /.../llvm/lib/Target/BPF/BPFISelLowering.cpp:199!

Let us make error message explicit so it will be clear to the user
what is the problem. With this patch, the error message looks like:
  fatal error: error in backend: Unsupported dynamic stack allocation
  ...

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

4 years agoReapply "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"
Johannes Doerfert [Thu, 13 Feb 2020 02:52:23 +0000 (20:52 -0600)]
Reapply "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

Reapply 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f with minor fixes.

The problem was that cancellation can cause new edges to the parallel
region exit block which is not outlined. The CodeExtractor will encode
the information which "exit" was taken as a return value. The fix is to
ensure we do not return any value from the outlined function, to prevent
control to value conversion we ensure a single exit block for the
outlined region.

This reverts commit 3aac953afa34885a72df96f2b703b65f85cbb149.

4 years ago[Statepoint] Remove redundant clear of call target on register
Serguei Katkov [Wed, 12 Feb 2020 07:28:25 +0000 (14:28 +0700)]
[Statepoint] Remove redundant clear of call target on register

Patchable statepoint is lowered into sequence of nops, so zeroed call target
should not be on register. It is better to use getTargetConstant instead
of getConstant to select zero constant for call target.

Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D74465

4 years ago[AMDGPU][GlobalISel] Handle 64byte EltSIze in getRegSplitParts
Austin Kerbow [Wed, 12 Feb 2020 22:52:48 +0000 (14:52 -0800)]
[AMDGPU][GlobalISel] Handle 64byte EltSIze in getRegSplitParts

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix regression due to reviews.llvm.org/D74436 by adding option ffp-contract=off to...
Melanie Blower [Thu, 13 Feb 2020 03:05:18 +0000 (19:05 -0800)]
Fix regression due to reviews.llvm.org/D74436 by adding option ffp-contract=off to RUN line

4 years agoFix ReST syntax on link to "Bisecting LLVM code" page
Nico Weber [Thu, 13 Feb 2020 02:18:25 +0000 (21:18 -0500)]
Fix ReST syntax on link to "Bisecting LLVM code" page

Patch from nicolas17 (Nicolás Alvarez)!

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

4 years ago[MLIR][Affine] Add affine.parallel op
Frank Laub [Thu, 13 Feb 2020 01:59:57 +0000 (17:59 -0800)]
[MLIR][Affine] Add affine.parallel op

Summary:
As discussed in https://llvm.discourse.group/t/rfc-add-affine-parallel/350, this is the first in a series of patches to bring in support for the `affine.parallel` operation.

This first patch adds the IR representation along with custom printer/parser implementations.

Reviewers: bondhugula, herhut, mehdi_amini, nicolasvasilache, rriddle, earhart, jbruestle

Reviewed By: bondhugula, nicolasvasilache, rriddle, earhart, jbruestle

Subscribers: jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[AsmPrinter][ELF] Emit local alias for ExternalLinkage dso_local GlobalAlias
Fangrui Song [Wed, 12 Feb 2020 00:07:06 +0000 (16:07 -0800)]
[AsmPrinter][ELF] Emit local alias for ExternalLinkage dso_local GlobalAlias

4 years agoRevert "[X86][SSE] lowerShuffleAsBitRotate - lower to vXi8 shuffles to ROTL on pre...
Amy Huang [Thu, 13 Feb 2020 00:59:17 +0000 (16:59 -0800)]
Revert "[X86][SSE] lowerShuffleAsBitRotate - lower to vXi8 shuffles to ROTL on pre-SSSE3 targets"

This reverts commit 11c16e71598d51f15b4cfd0f719c4dabcc0bebf7 because it
causes a crash in chromium code. See
https://reviews.llvm.org/rG11c16e71598d51f15b4cfd0f719c4dabcc0bebf7.

4 years agoRevert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"
Johannes Doerfert [Thu, 13 Feb 2020 00:50:22 +0000 (18:50 -0600)]
Revert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

This reverts commit 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f.

Will be recommitted once the clang test problem is addressed.

4 years agoAMDGPU/GlobalISel: Select G_CTTZ_ZERO_UNDEF
Matt Arsenault [Fri, 7 Feb 2020 16:08:52 +0000 (11:08 -0500)]
AMDGPU/GlobalISel: Select G_CTTZ_ZERO_UNDEF

Directly select this rather than going through the intermediate
instruction, which may provide some combine value in the future.

4 years agoAMDGPU/GlobalISel: Select G_CTLZ_ZERO_UNDEF
Matt Arsenault [Fri, 7 Feb 2020 02:54:41 +0000 (21:54 -0500)]
AMDGPU/GlobalISel: Select G_CTLZ_ZERO_UNDEF

Directly select this rather than going through the intermediate
instruction, which may provide some combine value in the future.

4 years agoAMDGPU/GlobalISel: Fix mapping G_ICMP with constrained result
Matt Arsenault [Thu, 6 Feb 2020 21:11:45 +0000 (16:11 -0500)]
AMDGPU/GlobalISel: Fix mapping G_ICMP with constrained result

When SI_IF is inserted, it constrains the source register with a
register class, which was quite likely a G_ICMP. This was incorrectly
treating it as a scalar, and then applyMappingImpl would end up
producing invalid MIR since this was unexpected.

Also fix not using all VGPR sources for vcc outputs.

4 years agoPPC: Prepare tests for switch of default denormal-fp-math
Matt Arsenault [Fri, 8 Nov 2019 02:26:17 +0000 (18:26 -0800)]
PPC: Prepare tests for switch of default denormal-fp-math

These tests fail when the default is switched to assume IEEE denormal
handling. I'm not sure if PPC really has a way to control the denormal
input handling.

4 years agoReplace std::foo with std::foo_t in LLVM.
Caroline Lebar [Thu, 13 Feb 2020 00:14:30 +0000 (16:14 -0800)]
Replace std::foo with std::foo_t in LLVM.

This patch is replacements missed in my last change doing this across LLVM.

No functional change, although I think there was a missing typename
in struct conjunction that is now fixed.

4 years ago[GWP-ASan] [NFC] Change enum from ANDROID->BIONIC.
Mitch Phillips [Thu, 13 Feb 2020 00:06:42 +0000 (16:06 -0800)]
[GWP-ASan] [NFC] Change enum from ANDROID->BIONIC.

4 years ago[Fuzzer] Rename ExecuteCommandWithPopen to ExecuteCommandNon-Fushsia target will...
Yuanfang Chen [Wed, 12 Feb 2020 23:43:44 +0000 (15:43 -0800)]
[Fuzzer] Rename ExecuteCommandWithPopen to ExecuteCommandNon-Fushsia target will keep using popen/pclose implementation. OnFuchsia, Two-args version of `ExecuteCommand` is a simple wrapper of theone-arg version. (Hopefully) Fix D73329 build on Fuchsia.

4 years ago[OpenMP][IRBuilder] Perform finalization (incl. outlining) late
Johannes Doerfert [Mon, 10 Feb 2020 20:28:47 +0000 (14:28 -0600)]
[OpenMP][IRBuilder] Perform finalization (incl. outlining) late

In order to fix PR44560 and to prepare for loop transformations we now
finalize a function late, which will also do the outlining late. The
logic is as before but the actual outlining step happens now after the
function was fully constructed. Once we have loop transformations we
can apply them in the finalize step before the outlining.

Reviewed By: JonChesterfield

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

4 years agoFix a reentrance bug with deserializing ObjC type parameters.
John McCall [Wed, 12 Feb 2020 23:40:00 +0000 (18:40 -0500)]
Fix a reentrance bug with deserializing ObjC type parameters.

This is a longstanding bug that seems to have been hidden by
a combination of (1) the normal flow being to deserialize the
interface before deserializing its parameter and (2) a precise
ordering of work that was apparently recently disturbed,
perhaps by my abstract-serialization work or Bruno's ObjC
module merging work.

Fixes rdar://59153545.

4 years ago[Attributor] Use fine-grained liveness in all helpers
Johannes Doerfert [Sun, 12 Jan 2020 07:09:22 +0000 (01:09 -0600)]
[Attributor] Use fine-grained liveness in all helpers

We used coarse-grained liveness before, thus we looked if the
instruction was executed, but we did not use fine-grained liveness,
hence if the instruction was needed or could be deleted even if the
surrounding ones are live. This patches introduces this level of
liveness checks together with other liveness queries, e.g., for uses.

For more control we enforce that all liveness queries go through the
Attributor.

Test have been adjusted to reflect the changes or augmented to prevent
deletion of the parts we want to check.

Reviewed By: sstefan1

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

4 years ago[Attributor] Ignore uses if a value is simplified
Johannes Doerfert [Thu, 23 Jan 2020 23:12:56 +0000 (17:12 -0600)]
[Attributor] Ignore uses if a value is simplified

If we have a replacement for a value, via AAValueSimplify, the original
value will lose all its uses. Thus, as long as a value is simplified we
can skip the uses in checkForAllUses, given that these uses are
transitive uses for the simplified version and will therefore affect the
simplified version as necessary.

Since this allowed us to remove calls without side-effects and a known
return value, we need to make sure not to eliminate `musttail` calls.
Those we keep around, or later remove the entire `musttail` call chain.

4 years ago[Attributor] Use assumed information to determine side-effects
Johannes Doerfert [Sun, 12 Jan 2020 06:34:38 +0000 (00:34 -0600)]
[Attributor] Use assumed information to determine side-effects

We relied on wouldInstructionBeTriviallyDead before but that functions
does not take assumed information, especially for calls, into account.
The replacement, AAIsDead::isAssumeSideEffectFree, does.

This change makes AAIsDeadCallSiteReturn more complex as we can have
a dead call or only dead users.

The test have been modified to include a side effect where there was
none in order to keep the coverage.

Reviewed By: sstefan1

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

4 years agoChanged omp_get_max_threads() implementation to more closely match spec description.
Ethan Stewart [Wed, 12 Feb 2020 23:29:10 +0000 (23:29 +0000)]
Changed omp_get_max_threads() implementation to more closely match spec description.

Summary: The 5.0 spec states, "The omp_get_max_threads routine returns an upper bound on the number of threads that could be used to form a new team if a parallel construct without a num_threads clause were encountered after execution returns from this routine." The attached test shows Max Threads: 96, Num Threads: 128 without the proposed change. The number of threads should not exceed the (max) nthreads ICV, hence we should return the higher SPMD thread number even when omp_get_max_threads() is called in a generic kernel. This change does fail the api test, max_threads.c, because now it would return 64 instead of 32.

Reviewers: jdoerfert, ABataev, grokos, JonChesterfield

Reviewed By: jdoerfert

Subscribers: openmp-commits

Tags: #openmp

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

4 years ago[libomptarget][nfc] Change enum values to match those in cuda/rtl
JonChesterfield [Wed, 12 Feb 2020 23:25:33 +0000 (23:25 +0000)]
[libomptarget][nfc] Change enum values to match those in cuda/rtl

Summary:
[libomptarget][nfc] Change enum values to match those in cuda/rtl

support.h and cuda/rtl.cpp (and downsteam hsa/rtl.cpp) have enums for execution
mode. These are actually independent - the numbers that used within support, or
within the plugin, are never passed across the boundary.

Nevertheless, trying to work out why the values are different between the two
has generated a reasonable amount of confusion. This patch changes support to
match the values in plugin, on the basis that the plugin also has some comments
which I'd have to update if I changed that one instead. Credit to Ron for
working through this in our own fork. See rocm-developer-tools/aomp/issues/7
for that earlier diagnostic write up.

Also happy with generic = 0, spmd = 1 - provided it's the same in both places.

Reviewers: jdoerfert, grokos, ABataev, ronlieb

Reviewed By: grokos

Subscribers: openmp-commits

Tags: #openmp

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

4 years ago[GWP-ASan] Update alignment on Android.
Mitch Phillips [Wed, 12 Feb 2020 23:24:55 +0000 (15:24 -0800)]
[GWP-ASan] Update alignment on Android.

Summary:
Android has different alignment requirements. You can read more about
them here
(https://cs.android.com/android/platform/superproject/+/master:bionic/tests/malloc_test.cpp;l=808),
but the general gist is that for malloc(x <= 8), we do malloc(8), and
for everything else, we do 16-byte alignment.

Reviewers: eugenis, morehouse, cferris

Reviewed By: eugenis, morehouse

Subscribers: #sanitizers, llvm-commits, pcc

Tags: #sanitizers, #llvm

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

4 years ago[MBP] Partial tail duplication into hot predecessors
Guozhi Wei [Wed, 12 Feb 2020 23:22:33 +0000 (15:22 -0800)]
[MBP] Partial tail duplication into hot predecessors

Current tail duplication embedded in MBP duplicates a BB into all or none of its predecessors without too much cost analysis. So sometimes it is duplicated into cold predecessors, and in other cases it may miss the duplication into hot predecessors.

This patch improves tail duplication in 3 aspects:

  A successor can be duplicated into part of its predecessors.
  A more fine-grained benefit analysis, combined with 1, now a successor is duplicated into hot predecessors only.
  If a successor can't be duplicated into one predecessor, it doesn't impact the duplication into other predecessors.

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

4 years ago[CMake][Fuchsia] Enable in-process cc1
Petr Hosek [Wed, 12 Feb 2020 22:04:11 +0000 (14:04 -0800)]
[CMake][Fuchsia] Enable in-process cc1

This is now supported by Goma so we can re-enable it.

4 years ago[Clang] Limit -fintegrated-cc1 to only one TU
Alexandre Ganea [Wed, 12 Feb 2020 22:01:55 +0000 (17:01 -0500)]
[Clang] Limit -fintegrated-cc1 to only one TU

As discussed in https://reviews.llvm.org/D74447, this patch disables integrated-cc1 behavior if there's more than one job to be executed. This is meant to limit memory bloating, given that currently jobs don't clean up after execution (-disable-free is always active in cc1 mode).

I see this behavior as temporary until release 10.0 ships (to ease merging of this patch), then we'll reevaluate the situation, see if D74447 makes more sense on the long term.

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

4 years ago[Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles before exiting...
Alexandre Ganea [Wed, 12 Feb 2020 18:02:51 +0000 (13:02 -0500)]
[Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles before exiting cc_main()

This fixes cc1 execution when '-disable-free' is not used (currently not the case, that flag is always used for cc1).

4 years ago[mlir][Linalg] Fix build warnings
Nicolas Vasilache [Wed, 12 Feb 2020 21:43:33 +0000 (16:43 -0500)]
[mlir][Linalg] Fix build warnings

4 years ago[lldb/Plugins] Move DynamicLoaderMacOS into DynamicLoaderMacOSXDYLD (NFCI)
Jonas Devlieghere [Wed, 12 Feb 2020 21:44:05 +0000 (13:44 -0800)]
[lldb/Plugins] Move DynamicLoaderMacOS into DynamicLoaderMacOSXDYLD (NFCI)

Move the logic for initialization and termination for DynamicLoaderMacOS
into DynamicLoaderMacOSXDYLD so that there's one initializer for the
DynamicLoaderMacOSXDYLD plugin.

4 years ago[mlir] support creating memref descriptors from static shape with non-zero offset
Tobias Gysi [Wed, 12 Feb 2020 21:36:21 +0000 (22:36 +0100)]
[mlir] support creating memref descriptors from static shape with non-zero offset

This patch adapts the method MemRefDescriptor::fromStaticShape to
support static non-zero offsets. The updated method uses the
getStridesAndOffset method to extract strides and offset. The patch also
adapts the test cases since sizes and strides are now set in forward
instead of reverse order.

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

4 years ago[MLIR] Fix wrong header for mlir-cuda-runner
Valentin Clement [Wed, 12 Feb 2020 21:35:02 +0000 (22:35 +0100)]
[MLIR] Fix wrong header for mlir-cuda-runner

Just updated the wrong header probably copied from the mlir-cpu-runner

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

4 years agoFix type-dependency of bitfields in templates
Elizabeth Andrews [Wed, 12 Feb 2020 19:30:02 +0000 (11:30 -0800)]
Fix type-dependency of bitfields in templates

This patch is a follow up to 878a24ee244a24. Name of bitfields
with value-dependent width should be set as type-dependent. This
patch adds the required value-dependency check and sets the
type-dependency accordingly.

Patch fixes PR44886

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

4 years ago[TBLGEN] Fix subreg value overflow in DAGISelMatcher
Stanislav Mekhanoshin [Mon, 10 Feb 2020 21:37:00 +0000 (13:37 -0800)]
[TBLGEN] Fix subreg value overflow in DAGISelMatcher

Tablegen's DAGISelMatcher emits integers in a VBR format,
so if an integer is below 128 it can fit into a single
byte, otherwise high bit is set, next byte is used etc.
MatcherTable is essentially an unsigned char table. When
SelectionDAGISel parses the table it does a reverse translation.

In a situation when numeric value of an integer to emit is
unknown it can be emitted not as OPC_EmitInteger but as
OPC_EmitStringInteger using a symbolic name of the value.
In this situation the value should not exceed 127.

One of the situations when OPC_EmitStringInteger is used is
if we need to emit a subreg into a matcher table. However,
number of subregs can exceed 127. Currently last defined subreg
for AMDGPU is 192. That results in a silent bug in the ISel
with matcher reading from an invalid offset.

Fixed this bug to emit actual VBR encoded value for a subregs
which value exceeds 127.

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

4 years ago[docs] Minor updates to DeveloperPolicy due to svn to git
Jinsong Ji [Wed, 12 Feb 2020 21:07:40 +0000 (21:07 +0000)]
[docs] Minor updates to DeveloperPolicy due to svn to git

Reviewed By: efriedma

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

4 years ago[README] Add note on using cmake to perform the build
Evandro Menezes [Wed, 12 Feb 2020 20:21:02 +0000 (14:21 -0600)]
[README] Add note on using cmake to perform the build

Also, some spelling fixes.  Test commit.

4 years ago[OpenMP] update strings output of libomp.so [NFC]
Kelvin Li [Wed, 12 Feb 2020 20:38:54 +0000 (15:38 -0500)]
[OpenMP] update strings output of libomp.so [NFC]

Change the string from "Intel(R) OMP" to "LLVM OMP" in libomp.so

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

4 years ago[LoopExtractor] Fix legacy pass dependencies
Ehud Katz [Wed, 12 Feb 2020 20:39:21 +0000 (22:39 +0200)]
[LoopExtractor] Fix legacy pass dependencies

Fixes a memory leak of allocating `LoopInfoWrapperPass` and `DominatorTreeWrapperPass`.

4 years ago[llvm-exegesis] CombinationGenerator: don't store function_ref
Roman Lebedev [Wed, 12 Feb 2020 20:30:22 +0000 (23:30 +0300)]
[llvm-exegesis] CombinationGenerator: don't store function_ref

function_ref is non-owning, so if we get it as a parameter in constructor,
our reference goes out-of-scope as soon as constructor returns.
Instead, let's just take it as a parameter to the actual `generate()` call

4 years agoRevert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"
Erik Pilkington [Wed, 12 Feb 2020 20:02:58 +0000 (12:02 -0800)]
Revert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"

This reverts commit fafc6e4fdf3673dcf557d6c8ae0c0a4bb3184402.

Should fix ppc stage2 failure: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/23546

Conflicts:
clang/lib/CodeGen/CGCall.cpp

4 years ago[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.
Nicolas Vasilache [Wed, 12 Feb 2020 19:41:11 +0000 (14:41 -0500)]
[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.

This revision prepares the ground for declaratively defining Linalg "named" ops.
Such named ops form the backbone of operations that are ubiquitous in the ML
application domain.

This revision closely related to the definition of a "Tensor Computation
Primitives Dialect" and demonstrates that ops can be expressed as declarative
configurations of the `linalg.generic` op.

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

4 years ago[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)
Jonas Devlieghere [Wed, 12 Feb 2020 19:01:43 +0000 (11:01 -0800)]
[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)

Move the logic for initialization and termination for
SymbolFileDWARFDebugMap into SymbolFileDWARF so that there's one
initializer for the SymbolFileDWARF plugin.

4 years ago[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC
Vedant Kumar [Wed, 5 Feb 2020 17:46:51 +0000 (09:46 -0800)]
[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC

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

4 years ago[lldb/StringPrinter] Avoid reading garbage in uninitialized strings
Vedant Kumar [Sat, 1 Feb 2020 07:18:17 +0000 (23:18 -0800)]
[lldb/StringPrinter] Avoid reading garbage in uninitialized strings

This patch fixes a few related out-of-bounds read bugs in the
string data formatters. These issues have to do with mishandling of un-
initialized strings. These manifest as ASan exceptions when debugging a
clang binary.

The first issue was that the std::string formatter treated strings in
"short mode" with length greater than the size of the inline buffer as
valid.

The second issue was that the StringPrinter facility did not check that
a full utf8 codepoint sequence can be read from the buffer (i.e. there
are some missing range checks). I took the opportunity here to delete
some untested code that was meant to deal with invalid input and replace
it with fail-on-invalid logic ([1][2][3]). This means we'll give up on
formatting an invalid string instead of guessing our way through it.

The third issue is that StringPrinter did not check that a utf8 sequence
could actually be fully read from the string payload. This one is especially
tricky as we may overflow the buffer pointer while reading the sequence.

I also noticed that the std::string formatter would spew the raw version of
the underlying ValueObject when garbage is detected. I've changed this to
just print "Summary Unavailable" instead, as we do elsewhere.

I've added regression tests for these issues to
test/functionalities/data-formatter/data-formatter-stl/libcxx/string.

[1]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L136
[2]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L163
[3]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L357

rdar://59080026

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

4 years ago[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl:...
Vedant Kumar [Wed, 22 Jan 2020 22:32:20 +0000 (14:32 -0800)]
[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl::Create

This fixes a UBSan error seen while debugging clang:

Member call on null pointer of type 'clang::TypeSourceInfo'

rdar://58783517

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

4 years ago[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare
Vedant Kumar [Tue, 11 Feb 2020 00:22:27 +0000 (16:22 -0800)]
[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare

Various parts of the LLVM code generator assume that the address
argument of a dbg.declare is not a `ptrtoint`-of-alloca. ASan breaks
this assumption, and this results in local variables sometimes being
unavailable at -O0.

GlobalISel, SelectionDAG, and FastISel all do not appear to expect
dbg.declares to have a `ptrtoint` as an operand. This means that they do
not place entry block allocas in the usual side table reserved for local
variables available in the whole function scope. This isn't always a
problem, as LLVM can try to lower the dbg.declare to a DBG_VALUE, but
those DBG_VALUEs can get dropped for all the usual reasons DBG_VALUEs
get dropped. In the ObjC test case I'm looking at, the cause happens to
be that `replaceDbgDeclare` has hoisted dbg.declares into the entry
block, causing LiveDebugValues to "kill" the DBG_VALUEs because the
lexical dominance check fails.

To address this, I propose:

1) Have ASan (always) pass an alloca to dbg.declares (this patch). This
   is a narrow bugfix for -O0 debugging.

2) Make replaceDbgDeclare not move dbg.declares around. This should be a
   generic improvement for optimized debug info, as it would prevent the
   lexical dominance check in LiveDebugValues from killing as many
   variables.

   This means reverting llvm/r227544, which fixed an assertion failure
   (llvm.org/PR22386) but no longer seems to be necessary. I was able to
   complete a stage2 build with the revert in place.

rdar://54688991

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

4 years ago[KnownBits] Introduce anyext instead of passing a flag into zext
Jay Foad [Wed, 12 Feb 2020 13:27:28 +0000 (13:27 +0000)]
[KnownBits] Introduce anyext instead of passing a flag into zext

Summary:
This was a very odd API, where you had to pass a flag into a zext
function to say whether the extended bits really were zero or not. All
callers passed in a literal true or false.

I think it's much clearer to make the function name reflect the
operation being performed on the value we're tracking (rather than on
the KnownBits Zero and One fields), so zext means the value is being
zero extended and new function anyext means the value is being extended
with unknown bits.

NFC.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract
Nicolas Vasilache [Wed, 12 Feb 2020 18:43:10 +0000 (13:43 -0500)]
[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract

Summary:
This revision allows model builder to create a linalg_matmul whose body
is a vector.contract. This shows the abstractions compose nicely.

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

4 years ago[gn build] Port 6030fe01f4e
LLVM GN Syncbot [Wed, 12 Feb 2020 18:34:39 +0000 (18:34 +0000)]
[gn build] Port 6030fe01f4e