platform/upstream/llvm.git
4 years ago[clangd] Fix the build with clang <3.9.
Michael Spencer [Fri, 17 Jul 2020 22:12:18 +0000 (16:12 -0600)]
[clangd] Fix the build with clang <3.9.

In clang <3.9 the `unique_ptr` constructor that is supposed to allow
for Derived to Base conversion does not work. Remove this if we drop
support for such configurations.

This is the same fix as in fda901a987ddd, and it updates the comments
to better reflect the actual issue. The same thing reproduces with
libc++ with older clangs.

4 years agoTemporarily Revert "[OpenMP] Add Additional Function Attribute Information to OMPKind...
Eric Christopher [Fri, 17 Jul 2020 22:05:42 +0000 (15:05 -0700)]
Temporarily Revert "[OpenMP] Add Additional Function Attribute Information to OMPKinds.def"
as it's causing a few unused variable warnings via the macro instantiation:

sources/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def:649:17: error: unused variable 'InaccessibleOnlyAttrs' [-Werror,-Wunused-variable]
__OMP_ATTRS_SET(InaccessibleOnlyAttrs,
                ^

This reverts commit 09fe0c5ab9ca5846d6cb625e9be47fdcfe49b93c.

4 years agoTemporarily Revert "[InlineAdvisor] New inliner advisor to replay inlining from optim...
Eric Christopher [Fri, 17 Jul 2020 21:58:01 +0000 (14:58 -0700)]
Temporarily Revert "[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks"
as it is failing the inline-replay.ll test as well as sanitizers/Werror
from returning a stack local variable.

This reverts commit 029946b112684c27b27f7c2d7554f22b33ae1e0b.

4 years ago[OpenMP] Add Additional Function Attribute Information to OMPKinds.def
Joseph Huber [Fri, 17 Jul 2020 21:54:01 +0000 (17:54 -0400)]
[OpenMP] Add Additional Function Attribute Information to OMPKinds.def

Summary:
This patch adds more function attribute information to the runtime function definitions in OMPKinds.def. The goal is to provide sufficient information about OpenMP runtime functions to perform more optimizations on OpenMP code.

Reviewers: jdoerfert

Subscribers: aaron.ballman cfe-commits yaxunl guansong sstefan1 llvm-commits

Tags: #OpenMP #clang #llvm

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

4 years ago[compiler-rt][asan][hwasan] Fix Fuchsia build
Teresa Johnson [Fri, 17 Jul 2020 21:48:28 +0000 (14:48 -0700)]
[compiler-rt][asan][hwasan] Fix Fuchsia build

Fix build failure in Fuchsia build from refactoring in
5d2be1a18845c528d3e86f7efcc59872e4a757c3

Guard the moved versions of ReserveShadowMemoryRange and ProtectGap
the same way they were in the asan code originally (not for Fuchsia or
RTEMS). Otherwise we end up with unsats as they invoke functions not
defined there.

4 years ago[flang] Rework read/write permission management for runtime file opening
peter klausler [Fri, 17 Jul 2020 18:24:29 +0000 (11:24 -0700)]
[flang] Rework read/write permission management for runtime file opening

Anonymous Fortran unit files (e.g., "./fort.7") need to be created
O_RDWR so that they can be written, rewound, and read.  Other
files opened with no ACTION= specifier need to set read/write
permissions based on the file, if it exists.

Reviewed By: sscalpone

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

4 years agoRemove clang matrix lowering test for now as it is still failing under the NPM.
Sjoerd Meijer [Fri, 17 Jul 2020 21:40:41 +0000 (22:40 +0100)]
Remove clang matrix lowering test for now as it is still failing under the NPM.

4 years ago[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks
Wenlei He [Tue, 14 Jul 2020 05:12:28 +0000 (22:12 -0700)]
[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks

Summary:
This change added a new inline advisor that takes optimization remarks for previous inlining as input, and provide the decision as advice so current inlining can replay inline decision of a different compilation. Dwarf inline stack with line and discriminator is used as anchor for call sites. The change can be useful for Inliner tuning.
A switch -sample-profile-inline-replay=<inline_remarks_file> is added to hook up the new inliner advisor with SampleProfileLoader's inline decision for replay. The new inline advisor can also be used by regular CGSCC inliner later if needed.

Reviewers: davidxl, mtrofin, wmi, hoy

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AIX] report_fatal_error on `-fregister_global_dtors_with_atexit` for static init
Xiangling Liao [Thu, 16 Jul 2020 18:29:13 +0000 (14:29 -0400)]
[AIX] report_fatal_error on `-fregister_global_dtors_with_atexit` for static init

On AIX, the semantic of global_dtors contains __sterm functions associated with C++
cleanup actions and user-declared __attribute__((destructor)) functions. We should
never merely register __sterm with atexit(), so currently
-fregister_global_dtors_with_atexit does not work well on AIX: It would cause
finalization actions to not occur when unloading shared libraries.  We need to figure
out a way to handle that when we start supporting user-declared
__attribute__((destructor)) functions.

Currently we report_fatal_error on this option temporarily.

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

4 years ago[GWP-ASan] Split the unwinder into segv/non-segv.
Mitch Phillips [Fri, 17 Jul 2020 19:59:09 +0000 (12:59 -0700)]
[GWP-ASan] Split the unwinder into segv/non-segv.

Summary:
Splits the unwinder into a non-segv (for allocation/deallocation traces) and a
segv unwinder. This ensures that implementations can select an accurate, slower
unwinder in the segv handler (if they choose to use the GWP-ASan provided one).
This is important as fast frame-pointer unwinders (like the sanitizer unwinder)
don't like unwinding through signal handlers.

Reviewers: morehouse, cryptoad

Reviewed By: morehouse, cryptoad

Subscribers: cryptoad, mgorny, eugenis, pcc, #sanitizers

Tags: #sanitizers

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

4 years ago[InstCombine] Fix typo in comment.
Xinan Jiang [Fri, 17 Jul 2020 19:57:08 +0000 (20:57 +0100)]
[InstCombine] Fix typo in comment.

Reviewers: fhahn

Reviewed By: fhahn

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

4 years ago[InstCombine] Fold X sdiv (-1 << C) -> -(X u>> Y) iff X is non-negative
Roman Lebedev [Fri, 17 Jul 2020 19:35:21 +0000 (22:35 +0300)]
[InstCombine] Fold  X sdiv (-1 << C) -> -(X u>> Y)  iff X is non-negative

This is the one i'm seeing as missed optimization,
although there are likely other possibilities, as usual.

There are 4 variants of a general sdiv->udiv fold:
https://rise4fun.com/Alive/VS6

Name: v0
Pre: C0 >= 0 && C1 >= 0
%r = sdiv i8 C0, C1
  =>
%r = udiv i8 C0, C1

Name: v1
Pre: C0 <= 0 && C1 >= 0
%r = sdiv i8 C0, C1
  =>
%t0 = udiv i8 -C0, C1
%r = sub i8 0, %t0

Name: v2
Pre: C0 >= 0 && C1 <= 0
%r = sdiv i8 C0, C1
  =>
%t0 = udiv i8 C0, -C1
%r = sub i8 0, %t0

Name: v3
Pre: C0 <= 0 && C1 <= 0
%r = sdiv i8 C0, C1
  =>
%r = udiv i8 -C0, -C1

If we really don't like sdiv (more than udiv that is),
and are okay with increasing instruction count (2 new negations),
and we ensure that we don't undo the fold,
then we could just implement these..

4 years ago[NFC][InstCombine] Add some tests with sdiv-by-negative-power-of-two
Roman Lebedev [Fri, 17 Jul 2020 19:28:36 +0000 (22:28 +0300)]
[NFC][InstCombine] Add some tests with sdiv-by-negative-power-of-two

4 years ago[flang] Add entry points for internal scalar list-directed I/O
peter klausler [Fri, 17 Jul 2020 18:27:40 +0000 (11:27 -0700)]
[flang] Add entry points for internal scalar list-directed I/O

BeginInternalListInput and BeginInternalListOutput were missing
from the I/O API implementation; add them.

Reviewed By: PeteSteinfeld

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

4 years ago[Clang] Fix building with Clang < 3.9.
Michael Spencer [Fri, 17 Jul 2020 19:32:12 +0000 (13:32 -0600)]
[Clang] Fix building with Clang < 3.9.

This is a workaround for a bug in older versions of Clang when. The
constructor that is supposed to allow for Derived to Base conversion
does not work. Remove this if we drop support for such configurations.

4 years ago[libc][NFC] Use RemoveCVType to implement IsIntegral and IsPointerType.
Siva Chandra Reddy [Thu, 16 Jul 2020 19:49:47 +0000 (12:49 -0700)]
[libc][NFC] Use RemoveCVType to implement IsIntegral and IsPointerType.

Added IsSameV as a convenience variable and used it where convenient.

Reviewers: abrachet, lntue

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

4 years agoPass -rtlib=libgcc in tests conditioned on the default.
Stella Laurenzo [Fri, 17 Jul 2020 18:12:07 +0000 (11:12 -0700)]
Pass -rtlib=libgcc in tests conditioned on the default.

Summary:
* This test was failing in our builds that configure compiler-rt as the configure-time rtlib.
* Opted for this test fix instead of a rollback, and hopefully TI can fix forward if this weakens the tests beyond expectations.
* Suspected this failure introduced in D81676.

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[llvm] Add contains(KeyType) -> bool methods to StringSet
David Blaikie [Fri, 17 Jul 2020 17:43:12 +0000 (10:43 -0700)]
[llvm] Add contains(KeyType) -> bool methods to StringSet

Matches C++20 API addition.

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

4 years ago[llvm] Add contains(KeyType) -> bool methods to SparseSet
David Blaikie [Fri, 17 Jul 2020 17:43:01 +0000 (10:43 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SparseSet

Matches C++20 API addition.

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

4 years ago[llvm] Add contains(KeyType) -> bool methods to SmallSet
David Blaikie [Fri, 17 Jul 2020 17:42:23 +0000 (10:42 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SmallSet

Matches C++20 API addition.

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

4 years ago[llvm] Add contains(KeyType) -> bool methods to SmallPtrSet
David Blaikie [Fri, 17 Jul 2020 17:41:35 +0000 (10:41 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SmallPtrSet

Matches C++20 API addition.

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

4 years ago[llvm] Add contains(KeyType) -> bool methods to SetVector
David Blaikie [Fri, 17 Jul 2020 17:41:03 +0000 (10:41 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SetVector

Matches C++20 API addition.

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

4 years ago[llvm] Add contains(KeyType) -> bool methods to DenseSet
David Blaikie [Fri, 17 Jul 2020 17:40:42 +0000 (10:40 -0700)]
[llvm] Add contains(KeyType) -> bool methods to DenseSet

Matches C++20 API addition.

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

4 years ago[OpenMP] libomp: add itt notifications for teams construct on host
AndreyChurbanov [Fri, 17 Jul 2020 18:10:25 +0000 (21:10 +0300)]
[OpenMP] libomp: add itt notifications for teams construct on host

Add barrier/region notification for parallel inside teams construct
when number of teams is 1, as VTune only shows outer level regions for
simplicity.

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

4 years agoFixed warning about signed/unsigned comparison
Stanislav Mekhanoshin [Wed, 15 Jul 2020 22:30:46 +0000 (15:30 -0700)]
Fixed warning about signed/unsigned comparison

I've got the report clang11 issues signed/unsigned mismatch
warning here. For some reason only clang11 seems to issue
this warning.

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

4 years ago[lldb] Unify sleep and time outs in GDB remote testcases
Jonas Devlieghere [Fri, 17 Jul 2020 15:18:22 +0000 (08:18 -0700)]
[lldb] Unify sleep and time outs in GDB remote testcases

Reduce sleep and time outs in GDB remote testcases to one default value
for each. Stop passing these values around and always use the default
instead.

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

4 years agoAdded missing API call to OpenMP test
George Rokos [Thu, 16 Jul 2020 22:57:27 +0000 (15:57 -0700)]
Added missing API call to OpenMP test

4 years ago[mlir][Vector] Fix masking logic in VectorToSCF
Nicolas Vasilache [Fri, 17 Jul 2020 17:17:09 +0000 (13:17 -0400)]
[mlir][Vector] Fix masking logic in VectorToSCF

Summary: The logic was conservative but inverted: cases that should remain unmasked became 1-D masked.

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

4 years ago[AMDGPU] Removed s_mov_regrd and mov_fed opcodes
Dmitry Preobrazhensky [Fri, 17 Jul 2020 16:48:36 +0000 (19:48 +0300)]
[AMDGPU] Removed s_mov_regrd and mov_fed opcodes

These opcodes are not intended for public use.

Reviewers: arsenm, rampitec

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

4 years ago[clang][Tooling] Try to avoid file system access if there is no record for the file...
Aleksandr Platonov [Fri, 17 Jul 2020 16:48:56 +0000 (18:48 +0200)]
[clang][Tooling] Try to avoid file system access if there is no record for the file in compile_commads.json

Summary:
If there is no record in compile_commands.json, we try to find suitable record with `MatchTrie.findEquivalent()` call.
This is very expensive operation with a lot of `llvm::sys::fs::equivalent()` calls in some cases.

This patch disables file symlinks for performance reasons.

Example scenario without this patch:
- compile_commands.json generated at clangd build (contains ~3000 files).
- it tooks more than 1 second to get compile command for newly created file in the root folder of LLVM project.
- we wait for 1 second every time when clangd requests compile command for this file (at file change).

Reviewers: sammccall, kadircet, hokein

Reviewed By: sammccall

Subscribers: chandlerc, djasper, klimek, ilya-biryukov, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agoBPF: generate .rodata BTF datasec for certain initialized local var's
Yonghong Song [Thu, 16 Jul 2020 21:26:09 +0000 (14:26 -0700)]
BPF: generate .rodata BTF datasec for certain initialized local var's

Currently, BTF datasec type for .rodata is generated only if there are
user-defined readonly global variables which have debuginfo generated.

Certain readonly global variables may be generated from initialized
local variables. For example,
  void foo(const void *);
  int test() {
    const struct {
      unsigned a[4];
      char b;
    } val = { .a = {2, 3, 4, 5}, .b = 6 };
    foo(&val);
    return 0;
  }

The clang will create a private linkage const global to store
the initialized value:
  @__const.test.val = private unnamed_addr constant %struct.anon
      { [4 x i32] [i32 2, i32 3, i32 4, i32 5], i8 6 }, align 4

This global variable eventually is put in .rodata ELF section.

If there is .rodata ELF section, libbpf expects a BTF .rodata
datasec as well even though it may be empty meaning there are no
global readonly variables with proper debuginfo. Martin reported
a bug where without this empty BTF .rodata datasec, the bpftool
gen will exit with an error.

This patch fixed the issue by generating .rodata BTF datasec
if there exists local var intial data which will result in
.rodata ELF section.

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

4 years agoWith MSVC, file needs to be compiled with /BIGOBJ
Adrian McCarthy [Thu, 16 Jul 2020 22:15:51 +0000 (15:15 -0700)]
With MSVC, file needs to be compiled with /BIGOBJ

MSVC, by default, limits the number of sections generated by a single
translation unit to 2^16.  In a debug build, each function or method
can require 4 sections, so it's not uncommon to hit it.

I saw the problem when building tests for LLDB (but, interestingly, not
for LLDB itself).

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

4 years ago[OptTable] Support grouped short options
Fangrui Song [Fri, 17 Jul 2020 16:18:24 +0000 (09:18 -0700)]
[OptTable] Support grouped short options

POSIX.1-2017 12.2 Utility Syntax Guidelines, Guideline 5 says:

> One or more options without option-arguments, followed by at most one option that takes an option-argument, should be accepted when grouped behind one '-' delimiter.

i.e. -abc represents -a -b -c. The grouped short options are very common.  Many
utilities extend the syntax by allowing (an option with an argument) following a
sequence of short options.

This patch adds the support to OptTable, similar to cl::Group for CommandLine
(D58711).  llvm-symbolizer will use the feature (D83530). CommandLine is exotic
in some aspects. OptTable is preferred if the user wants to get rid of the
behaviors.

* `cl::opt<bool> i(...)` can be disabled via -i=false or -i=0, which is
  different from conventional --no-i.
* Handling --foo & --no-foo requires a comparison of argument positions,
  which is a bit clumsy in user code.

OptTable::parseOneArg (non-const reference InputArgList) is added along with
ParseOneArg (const ArgList &). The duplicate does not look great at first
glance. However, The implementation can be simpler if ArgList is mutable.
(ParseOneArg is used by clang-cl (FlagsToInclude/FlagsToExclude) and lld COFF
(case-insensitive). Adding grouped short options can make the function even more
complex.)

The implementation allows a long option following a group of short options. We
probably should refine the code to disallow this in the future. Allowing this
seems benign for now.

Reviewed By: grimar, jhenderson

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

4 years ago[gn build] Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Fri, 17 Jul 2020 16:30:25 +0000 (12:30 -0400)]
[gn build] Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

4 years ago[IR] Fix MSVC warning (NFC)
Nikita Popov [Fri, 17 Jul 2020 16:25:56 +0000 (18:25 +0200)]
[IR] Fix MSVC warning (NFC)

As requested by Andrew Kaylor, rewrite this code in a way that does
not warn on old MSVC versions.

Avoid the buggy constexpr warning by just not using constexpr and
removing the static_assert that depends on it.

4 years ago[gn build] (manually) merge 6c43ed608
Nico Weber [Fri, 17 Jul 2020 16:27:21 +0000 (12:27 -0400)]
[gn build] (manually) merge 6c43ed608

4 years ago[mlir] [vector] Add an optional filter to vector contract lowering patterns.
Pierre Oechsel [Fri, 17 Jul 2020 16:02:11 +0000 (12:02 -0400)]
[mlir] [vector] Add an optional filter to vector contract lowering patterns.

Summary: Vector contract patterns were only parameterized by a `vectorTransformsOptions`. As a result, even if an mlir file was containing several occurrences of `vector.contract`, all of them would be lowered in the same way. More granularity might be required . This Diff adds a `constraint` argument to each of these patterns which allows the user to specify with more precision on which `vector.contract` should each of the lowering apply.

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

4 years ago[gn build] Make sync_source_lists_from_cmake handle one-line sources lines
Nico Weber [Fri, 17 Jul 2020 15:51:08 +0000 (11:51 -0400)]
[gn build] Make sync_source_lists_from_cmake handle one-line sources lines

sync_source_lists_from_cmake now also looks for source files in
`sources += [ "foo.cc" ]` lines, which allows us to remove most
`# Make `gn format` not collapse this` comments.

(sync_source_lists_from_cmake doesn't look for `foo_headers += [...]`
still, so the comment is still needed in two places for that.)

No intentional behavior change.

4 years ago[InstSimplify] add tests for fcmp with infinity; NFC
Sanjay Patel [Fri, 17 Jul 2020 13:48:27 +0000 (09:48 -0400)]
[InstSimplify] add tests for fcmp with infinity; NFC

4 years agoAMDGPU: Fix promoting f16 fpowi with legal f16
Matt Arsenault [Fri, 17 Jul 2020 15:02:10 +0000 (11:02 -0400)]
AMDGPU: Fix promoting f16 fpowi with legal f16

4 years ago[gn format] (manually) merge 6bddd099ac
Nico Weber [Fri, 17 Jul 2020 15:21:42 +0000 (11:21 -0400)]
[gn format] (manually) merge 6bddd099ac

4 years ago[mlir][EDSC] Allow conditionBuilder to capture the IfOp
Nicolas Vasilache [Fri, 17 Jul 2020 15:09:35 +0000 (11:09 -0400)]
[mlir][EDSC] Allow conditionBuilder to capture the IfOp

When the IfOp returns values, it can easily be obtained from one of the Values.
However, when no values are returned, the information is lost.
This revision lets the caller specify a capture IfOp* to return the produced
IfOp.

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

4 years agoIntroducing llvm-libtool-darwin
Sameer Arora [Wed, 1 Jul 2020 21:41:07 +0000 (14:41 -0700)]
Introducing llvm-libtool-darwin

This diff starts the implementation of llvm-libtool-darwin
(an llvm based replacement of cctool's libtool).
Libtool is used for creating static and dynamic libraries
from a bunch of object files given as input.

Reviewed by alexshap, smeenai, jhenderson, MaskRay

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

4 years ago[gn build] Port 6bddd099ac1
LLVM GN Syncbot [Fri, 17 Jul 2020 14:58:08 +0000 (14:58 +0000)]
[gn build] Port 6bddd099ac1

4 years agoRevert "[llvm-exegesis] Add benchmark latency option on X86 that uses LBR for more...
Clement Courbet [Fri, 17 Jul 2020 14:53:44 +0000 (16:53 +0200)]
Revert "[llvm-exegesis] Add benchmark latency option on X86 that uses LBR for more precise measurements."

From @erichkeane:
```
This patch doesn't seem to build for me:
/iusers/ekeane1/workspaces/llvm-project/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp: In function ‘llvm::Error llvm::exegesis::parseDataBuffer(const char*, size_t, const void*, const void*, llvm::SmallVector<long int, 4>*)’:
/iusers/ekeane1/workspaces/llvm-project/llvm/tools/llvm-exegesis/lib/X86/X86Counter.cpp:99:37: error: ‘struct perf_branch_entry’ has no member named ‘cycles’

CycleArray->push_back(Entry.cycles);
I'm on RHEL7, so I have kernel 3.10, so it doesn't have 'cycles'.

According ot this: https://elixir.bootlin.com/linux/v4.3/source/include/uapi/linux/perf_event.h#L963 kernel 4.3 is the first time that 'cycles' appeared in this structure.
```

4 years ago[ARM][MVE] Reorg of the LV tail-folding tests
Sjoerd Meijer [Fri, 17 Jul 2020 14:13:26 +0000 (15:13 +0100)]
[ARM][MVE] Reorg of the LV tail-folding tests

It was getting difficult to see which test was in which file, so this
reorganises the test files so that now all filenames start with tail-folding-*
followed by a more descriptive name what that group of tests check.

4 years ago[Matrix] Only run matrix lowering early with -O0.
Florian Hahn [Fri, 17 Jul 2020 14:50:47 +0000 (15:50 +0100)]
[Matrix] Only run matrix lowering early with -O0.

Currently matrix lowering is run twice if OptLevel > 0. Fix that and
also add a test for OptLevel > 0 with matrix lowering enabled.

4 years ago[gn build] Port c7562e77b3a
LLVM GN Syncbot [Fri, 17 Jul 2020 14:38:56 +0000 (14:38 +0000)]
[gn build] Port c7562e77b3a

4 years ago[OpenMP][NFC] Generalize CGOpenMPRuntimeNVPTX as CGOpenMPRuntimeGPU
Saiyedul Islam [Fri, 17 Jul 2020 14:17:32 +0000 (14:17 +0000)]
[OpenMP][NFC] Generalize CGOpenMPRuntimeNVPTX as CGOpenMPRuntimeGPU

Refactors CGOpenMPRuntimeNVPTX as CGOpenMPRuntimeGPU to make it a
generalization for OpenMP GPU Codegen. Target specific specialized
methods for NVPTX are defined in class CGOpenMPRuntimeNVPTX. This
paves the way for a clean and maintainable extension to more GPU
targets for OpenMP Codegen.

For original author (git blame) list of CGOpenMPRuntimeGPU code,
look in history of CGOpenMPRuntimeNVPTX.cpp and .h, after this commit.

Reviewed By: ABataev

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

4 years ago[flang][OpenMP] Added support for lowering OpenMP taskwait construct
Sourabh Singh Tomar [Thu, 16 Jul 2020 20:00:11 +0000 (01:30 +0530)]
[flang][OpenMP] Added support for lowering OpenMP taskwait construct

Summary:
This patch lower `!OMP TASKWAIT` construct from PFT to
OpenMPDialect operations.
Construct is lowered with conformance to OpenMP 4.5 spec.

Patch is carved out of following approved PR:
https://github.com/flang-compiler/f18-llvm-project/pull/280

Reviewed By: kiranchandramohan, clementval

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

4 years ago[z/OS][AIX] Move lambda definition to fix build problem
David Tenty [Thu, 16 Jul 2020 23:55:45 +0000 (19:55 -0400)]
[z/OS][AIX] Move lambda definition to fix build problem

This is a follow on change to eed19bd8 and contains a fix for a build
failure that occurs on both z/OS and AIX as a result of this commit:

https://reviews.llvm.org/rG670915094462d831e3733e5b01a76471b8cf6dd8.

4 years ago[Loop Simplify] Resolve an issue where metadata is not applied to a loop latch.
Sidharth Baveja [Fri, 17 Jul 2020 14:01:03 +0000 (14:01 +0000)]
[Loop Simplify] Resolve an issue where metadata is not applied to a loop latch.

Summary:
This patch resolves an issue where the metadata of a loop is not added to the
new loop latch, and not removed from the old loop latch. This issue occurs in
the SplitBlockPredecessors function, which  adds a new block in a loop, and
in the case that the block passed into this function is the header of the loop,
the loop can be modified such that the latch of the loop is replaced.
This patch applies to the Loop Simplify pass since it ensures that each loop
has exit blocks which only have predecessors that are inside of the loop. In
the case that this is not true, the pass will create a new exit block for the
loop. This guarantees that the loop preheader/header will dominate the exit blocks.

Author: sidbav (Sidharth Baveja)

Reviewers: asbirlea (Alina Sbirlea), chandlerc (Chandler Carruth), Whitney (Whitney Tsang), bmahjour (Bardia Mahjour)

Reviewed By:  asbirlea (Alina Sbirlea)

Subscribers: hiraditya (Aditya Kumar), llvm-commits

Tag: LLVM

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

4 years agorecommit 4fc752b30b9a [CUDA][HIP] Always defer diagnostics for wrong-sided reference
Yaxun (Sam) Liu [Wed, 15 Jul 2020 17:25:32 +0000 (13:25 -0400)]
recommit 4fc752b30b9a [CUDA][HIP] Always defer diagnostics for wrong-sided reference

Fixed regression in test builtin-amdgcn-atomic-inc-dec-failure.cpp.

4 years ago[NFC][ARM] Add SimplifyCFG test
Sam Parker [Fri, 17 Jul 2020 13:06:32 +0000 (14:06 +0100)]
[NFC][ARM] Add SimplifyCFG test

4 years ago[ms] [llvm-ml] Remove unused function
Eric Astor [Wed, 15 Jul 2020 19:00:34 +0000 (15:00 -0400)]
[ms] [llvm-ml] Remove unused function

Summary: Remove unused function

Reviewed By: lbenes

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

4 years ago[MSP430] Actualize the toolchain description
Anatoly Trosinenko [Fri, 17 Jul 2020 10:35:57 +0000 (13:35 +0300)]
[MSP430] Actualize the toolchain description

Reviewed By: krisb

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

4 years ago[analyzer] Add system header simulator a symmetric random access iterator operator+
Endre Fülöp [Mon, 6 Jul 2020 14:25:57 +0000 (16:25 +0200)]
[analyzer] Add system header simulator a symmetric random access iterator operator+

Summary:
Random access iterators must handle operator+, where the iterator is on the
RHS. The system header simulator library is extended with these operators.

Reviewers: Szelethus

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, steakhal, martong, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[LV] Enable the LoopVectorizer to create pointer inductions
Anna Welker [Fri, 17 Jul 2020 10:34:28 +0000 (11:34 +0100)]
[LV] Enable the LoopVectorizer to create pointer inductions

This patch enables the LoopVectorizer to build a phi of pointer
type and provide the vector loads and stores with vector type
getelementptrs built from the pointer induction variable, which
produces much less instructions than the previous approach of
creating scalar getelementpointers and glue them together to a
vector.

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

4 years ago[llvm-readobj] - Add proper testing for the SHT_MIPS_ABIFLAGS section.
Georgii Rymar [Thu, 16 Jul 2020 15:07:33 +0000 (18:07 +0300)]
[llvm-readobj] - Add proper testing for the SHT_MIPS_ABIFLAGS section.

This rewrites the mips-abiflags.test to stop using recompiled objects,
adds testing for all missed bits and also adds two missing enum values
to lib/ObjectYAML, which are used in the new test.

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

4 years agoAdd -o /dev/null to make it explicit that we don't care about the
Adrian Kuegel [Fri, 17 Jul 2020 12:21:13 +0000 (14:21 +0200)]
Add -o /dev/null to make it explicit that we don't care about the
compiler output.

4 years agoRevert "[CUDA][HIP] Always defer diagnostics for wrong-sided reference"
Yaxun (Sam) Liu [Fri, 17 Jul 2020 12:09:44 +0000 (08:09 -0400)]
Revert "[CUDA][HIP] Always defer diagnostics for wrong-sided reference"

This reverts commit 4fc752b30b9acac73a282cb844a6240e6cb70cca.

4 years ago[AMDGPU] Add some missing check prefixes and tweak test
Jay Foad [Fri, 17 Jul 2020 11:57:23 +0000 (12:57 +0100)]
[AMDGPU] Add some missing check prefixes and tweak test

The test needed some extra ALU instructions to prevent it from being
memory bound.

4 years ago[AMDGPU] Add some missing check prefixes
Jay Foad [Fri, 17 Jul 2020 11:56:29 +0000 (12:56 +0100)]
[AMDGPU] Add some missing check prefixes

4 years ago[x86] add tests for FMA with FMF; NFC
Sanjay Patel [Thu, 16 Jul 2020 19:01:01 +0000 (15:01 -0400)]
[x86] add tests for FMA with FMF; NFC

4 years ago[CUDA][HIP] Always defer diagnostics for wrong-sided reference
Yaxun (Sam) Liu [Wed, 15 Jul 2020 17:25:32 +0000 (13:25 -0400)]
[CUDA][HIP] Always defer diagnostics for wrong-sided reference

When a device function calls a host function or vice versa, this is wrong-sided
reference. Currently clang immediately diagnose it. This is different from nvcc
behavior, where it is diagnosed only if the function is really emitted.

Current clang behavior causes false alarms for valid use cases.

This patch let clang always defer diagnostics for wrong-sided
reference.

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

4 years agoMake helpers static. NFC.
Benjamin Kramer [Fri, 17 Jul 2020 11:49:11 +0000 (13:49 +0200)]
Make helpers static. NFC.

4 years agoAdd -flang flag to the test-release.sh script
Hans Wennborg [Fri, 17 Jul 2020 11:22:17 +0000 (13:22 +0200)]
Add -flang flag to the test-release.sh script

The flag is off by default.

4 years ago[lldb/COFF] Remove strtab zeroing hack
Pavel Labath [Wed, 15 Jul 2020 15:13:20 +0000 (17:13 +0200)]
[lldb/COFF] Remove strtab zeroing hack

Summary:
This code (recently responsible for a unaligned access sanitizer
failure) claims that the string table offset zero should result in an
empty string.

I cannot find any mention of this detail in the Microsoft COFF
documentation, and the llvm COFF parser also does not handle offset zero
specially. This code was introduced in 0076e7159, which also does not go
into specifics, citing "various bugfixes".

Given that this is obviously a hack, and does not cause tests to fail, I
think we should just delete it.

Reviewers: amccarth, markmentovai

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[HWLoops] Stop converting to a while loop when it would be unsafe to
Sam Tebbs [Thu, 16 Jul 2020 14:55:50 +0000 (15:55 +0100)]
[HWLoops] Stop converting to a while loop when it would be unsafe to

There were cases where a do-while loop would be converted to a while
loop before finding out that it would be unsafe to expand the SCEV in
this situation and then bailing out of hardware loop conversion.

This patch checks if it would be unsafe to expand the SCEV and if so stops converting the do-while into a while, allowing conversion to a hardware loop.

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

4 years ago[AMDGPU] Avoid splitting FLAT offsets in unsafe ways
Jay Foad [Wed, 8 Jul 2020 13:13:32 +0000 (14:13 +0100)]
[AMDGPU] Avoid splitting FLAT offsets in unsafe ways

As explained in the comment:

// For a FLAT instruction the hardware decides whether to access
// global/scratch/shared memory based on the high bits of vaddr,
// ignoring the offset field, so we have to ensure that when we add
// remainder to vaddr it still points into the same underlying object.
// The easiest way to do that is to make sure that we split the offset
// into two pieces that are both >= 0 or both <= 0.

In particular FLAT (as opposed to SCRATCH and GLOBAL) instructions have
an unsigned immediate offset field, so we can't use it to help split a
negative offset.

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

4 years ago[TableGen] Report an error instead of asserting
Jay Foad [Thu, 16 Apr 2020 08:29:28 +0000 (09:29 +0100)]
[TableGen] Report an error instead of asserting

This gives a nice error if you accidentally try to use an empty list for
the RegTypes of a RegisterClass.

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

4 years ago[InstCombine][Test] Test for fix of replacing select with Phis when branch has the...
Max Kazantsev [Fri, 17 Jul 2020 09:59:19 +0000 (16:59 +0700)]
[InstCombine][Test] Test for fix of replacing select with Phis when branch has the same labels

An additional test that allows to check the correctness of handling the case of the same
branch labels in the dominator when trying to replace select with phi-node.

Patch By: Kirill Polushin
Differential Revision: https://reviews.llvm.org/D84006
Reviewed By: mkazantsev

4 years ago[Sema][AArch64] Add parsing support for arm_sve_vector_bits attribute
Cullen Rhodes [Fri, 29 May 2020 09:17:37 +0000 (09:17 +0000)]
[Sema][AArch64] Add parsing support for arm_sve_vector_bits attribute

Summary:

This patch implements parsing support for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE, version 00bet5,
section 3.7.3) for SVE [1].

The purpose of this attribute is to define fixed-length (VLST) versions
of existing sizeless types (VLAT). For example:

    #if __ARM_FEATURE_SVE_BITS==512
    typedef svint32_t fixed_svint32_t __attribute__((arm_sve_vector_bits(512)));
    #endif

Creates a type 'fixed_svint32_t' that is a fixed-length version of
'svint32_t' that is normal-sized (rather than sizeless) and contains
exactly 512 bits. Unlike 'svint32_t', this type can be used in places
such as structs and arrays where sizeless types can't.

Implemented in this patch is the following:

  * Defined and tested attribute taking single argument.
  * Checks the argument is an integer constant expression.
  * Attribute can only be attached to a single SVE vector or predicate
    type, excluding tuple types such as svint32x4_t.
  * Added the `-msve-vector-bits=<bits>` flag. When specified the
    `__ARM_FEATURE_SVE_BITS__EXPERIMENTAL` macro is defined.
  * Added a language option to store the vector size specified by the
    `-msve-vector-bits=<bits>` flag. This is used to validate `N ==
    __ARM_FEATURE_SVE_BITS`, where N is the number of bits passed to the
    attribute and `__ARM_FEATURE_SVE_BITS` is the feature macro defined under
    the same flag.

The `__ARM_FEATURE_SVE_BITS` macro will be made non-experimental in the final
patch of the series.

[1] https://developer.arm.com/documentation/100987/latest

This is patch 1/4 of a patch series.

Reviewers: sdesmalen, rsandifo-arm, efriedma, ctetreau, cameron.mcinally, rengolin, aaron.ballman

Reviewed By: sdesmalen, aaron.ballman

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

4 years ago[MachineScheduler] Fix the TopDepth/BotHeightReduce latency heuristics
Jay Foad [Tue, 7 Jan 2020 15:43:46 +0000 (15:43 +0000)]
[MachineScheduler] Fix the TopDepth/BotHeightReduce latency heuristics

tryLatency compares two sched candidates. For the top zone it prefers
the one with lesser depth, but only if that depth is greater than the
total latency of the instructions we've already scheduled -- otherwise
its latency would be hidden and there would be no stall.

Unfortunately it only tests the depth of one of the candidates. This can
lead to situations where the TopDepthReduce heuristic does not kick in,
but a lower priority heuristic chooses the other candidate, whose depth
*is* greater than the already scheduled latency, which causes a stall.

The fix is to apply the heuristic if the depth of *either* candidate is
greater than the already scheduled latency.

All this also applies to the BotHeightReduce heuristic in the bottom
zone.

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

4 years ago[lldb/DWARF] Don't get confused by line sequences with tombstone values
Pavel Labath [Thu, 16 Jul 2020 15:28:17 +0000 (17:28 +0200)]
[lldb/DWARF] Don't get confused by line sequences with tombstone values

Summary:
With D81784, lld has started debug info resolving relocations to
garbage-collected symbols as -1 (instead of relocation addend). For an
unaware consumer this generated sequences which seemingly wrap the
address space -- their first entry was 0xfffff, but all other entries
were low numbers.

Lldb stores line sequences concatenated into one large vector, sorted by
the first entry, and searched with std::lower_bound. This resulted in
the low-value entries being placed at the end of the vector, which
utterly confused the lower_bound algorithm, and caused it to not find a
match. (Previously, these sequences would be at the start of the vector,
and normally would contain addresses that are far smaller than any real
address we want to look up, so std::lower_bound was fine.)

This patch makes lldb ignore these kinds of sequences completely. It
does that by changing the construction algorithm from iterating over the
rows (as parsed by llvm), to iterating over the sequences. This is
important because the llvm parsed performs validity checks when
constructing the sequence array, whereas the row array contains raw
data.

Reviewers: JDevlieghere, MaskRay

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

4 years ago[asan] Dedup MemToShadowSize
Vitaly Buka [Fri, 17 Jul 2020 09:38:18 +0000 (02:38 -0700)]
[asan] Dedup MemToShadowSize

Added D83247 and D84004.

4 years ago[ScheduleDAG] Move DBG_VALUEs after first term forward.
Florian Hahn [Fri, 17 Jul 2020 09:27:14 +0000 (10:27 +0100)]
[ScheduleDAG] Move DBG_VALUEs after first term forward.

MBBs are not allowed to have non-terminator instructions after the first
terminator. Currently in some cases (see the modified test),
EmitSchedule can add DBG_VALUEs after the last terminator, for example
when referring a debug value that gets folded into a TCRETURN
instruction on ARM.

This patch updates EmitSchedule to move inserted DBG_VALUEs just before
the first terminator. I am not sure if there are terminators produce
values that can in turn be used by a DBG_VALUE. In that case, moving the
DBG_VALUE might result in referencing an undefined register. But in any
case, it seems like currently there is no way to insert a proper DBG_VALUEs
for such registers anyways.

Alternatively it might make sense to just remove those extra DBG_VALUES.

I am not too familiar with the details of debug info in the backend and
would appreciate any suggestions on how to address the issue in the best
possible way.

Reviewers: vsk, aprantl, jpaquette, efriedma, paquette

Reviewed By: aprantl

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

4 years ago[msan] Fix strxfrm test
Vitaly Buka [Fri, 17 Jul 2020 08:45:14 +0000 (01:45 -0700)]
[msan] Fix strxfrm test

Revert D83719 and explicitly set locate to "C".

4 years ago[lsan] Fix SyntaxWarning: "is" with a literal
Vitaly Buka [Fri, 17 Jul 2020 08:47:45 +0000 (01:47 -0700)]
[lsan] Fix SyntaxWarning: "is" with a literal

4 years ago[gwp-asan] Fix check-all with LIT_FILTER
Vitaly Buka [Fri, 17 Jul 2020 08:46:14 +0000 (01:46 -0700)]
[gwp-asan] Fix check-all with LIT_FILTER

4 years ago[sanitizer] Fix protoent without network
Vitaly Buka [Fri, 17 Jul 2020 08:23:27 +0000 (01:23 -0700)]
[sanitizer] Fix protoent without network

4 years ago[PowerPC] Precommit test case for PR46759. NFC.
Kai Luo [Fri, 17 Jul 2020 08:36:30 +0000 (08:36 +0000)]
[PowerPC] Precommit test case for PR46759. NFC.

4 years ago[TSan] Add option for emitting compound read-write instrumentation
Marco Elver [Fri, 17 Jul 2020 06:53:56 +0000 (08:53 +0200)]
[TSan] Add option for emitting compound read-write instrumentation

This adds option -tsan-compound-read-before-write to emit different
instrumentation for the write if the read before that write is omitted
from instrumentation. The default TSan runtime currently does not
support the different instrumentation, and the option is disabled by
default.

Alternative runtimes, such as the Kernel Concurrency Sanitizer (KCSAN)
can make use of the feature. Indeed, the initial motivation is for use
in KCSAN as it was determined that due to the Linux kernel having a
large number of unaddressed data races, it makes sense to improve
performance and reporting by distinguishing compounded operations. E.g.
the compounded instrumentation is typically emitted for compound
operations such as ++, +=, |=, etc. By emitting different reports, such
data races can easily be noticed, and also automatically bucketed
differently by CI systems.

Reviewed By: dvyukov, glider

Tags: #llvm

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

4 years ago[compiler-rt][asan] Define MemToShadowSize for sparc64
Rainer Orth [Fri, 17 Jul 2020 08:04:19 +0000 (10:04 +0200)]
[compiler-rt][asan] Define MemToShadowSize for sparc64

[compiler-rt][asan][hwasan] Refactor shadow setup into sanitizer_common (NFCI) <https://reviews.llvm.org/D83247>
broke the Solaris/sparcv9 <http://lab.llvm.org:8014/builders/clang-solaris11-sparcv9/builds/6623> build:

  FAILED: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o
  /opt/llvm-buildbot/bin/c++  -D_DEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/asan -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan -Iinclude -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/Support/Solaris -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3     -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -UNDEBUG -std=c++14 -MD -MT projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o -MF projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o.d -o projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o -c /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp
  /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp: In function ‘__sanitizer::uptr __asan::FindDynamicShadowStart()’:
  /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp:103:28: error: ‘MemToShadowSize’ was not declared in this scope
     uptr shadow_size_bytes = MemToShadowSize(kHighMemEnd);
                              ^~~~~~~~~~~~~~~
  /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp:103:28: note: suggested alternative: ‘MemToShadow’
     uptr shadow_size_bytes = MemToShadowSize(kHighMemEnd);
                              ^~~~~~~~~~~~~~~
                              MemToShadow

Fixed by also definining `MemToShadowSize` in `compiler-rt/lib/asan/asan_mapping_sparc64.h`.

Tested on `sparcv9-sun-solaris2.11`.

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

4 years ago[ARM] halfword store hits llvm_unreachable with big-endian
Simon Wallis [Fri, 17 Jul 2020 07:26:30 +0000 (08:26 +0100)]
[ARM] halfword store hits llvm_unreachable with big-endian

Summary:
[ARM] halfword store hits llvm_unreachable with big-endian

Provide missing case in getFixupKindContainerSizeBytes().

This stops execution reaching llvm_unreachable("Unknown fixup kind!")

D83947

Reviewers: olista01, ostannard

Reviewed By: ostannard

Subscribers: ostannard, kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

Change-Id: I598aa1fb51fd1c6f424c557c85d6df6d1958bc62

4 years ago[lldb] Store StackFrameRecognizers in the target instead of a global list
Raphael Isemann [Fri, 17 Jul 2020 06:36:38 +0000 (08:36 +0200)]
[lldb] Store StackFrameRecognizers in the target instead of a global list

Summary:

Currently the frame recognizers are stored in a global list (the list in the
StackFrameRecognizersManagerImpl singleton to be precise). All commands and
plugins that modify the list are just modifying that global list of recognizers
which is shared by all Target and Debugger instances.

This is clearly against the idea of LLDB being usable as a library and it also
leads to some very obscure errors as now multiple tests are sharing the used
frame recognizers. For example D83400 is currently failing as it reorders some
test_ functions which permanently changes the frame recognizers of all
debuggers/targets. As all frame recognizers are also initialized in a 'once'
guard, it's also impossible to every restore back the original frame recognizers
once they are deleted in a process.

This patch just moves the frame recognizers into the current target. This seems
the way everyone assumes the system works as for example the assert frame
recognizers is using the current target to find the function/so-name to look for
(which only works if the recognizers are stored in the target).

Reviewers: jingham, mib

Reviewed By: jingham, mib

Subscribers: MrHate, JDevlieghere

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

4 years ago[libc][Obvious] Cleanup of include lines and target listings in FPUtil.
Siva Chandra Reddy [Fri, 17 Jul 2020 07:08:28 +0000 (00:08 -0700)]
[libc][Obvious] Cleanup of include lines and target listings in FPUtil.

4 years ago[sanitizer] Revert accidentally committed file
Vitaly Buka [Fri, 17 Jul 2020 07:08:45 +0000 (00:08 -0700)]
[sanitizer] Revert accidentally committed file

4 years ago[profile] Enabled test on windows
Vitaly Buka [Fri, 17 Jul 2020 07:05:07 +0000 (00:05 -0700)]
[profile] Enabled test on windows

Works with D34797

4 years ago[InstCombine] Fix replace select with Phis when branch has the same labels
Max Kazantsev [Fri, 17 Jul 2020 07:01:59 +0000 (14:01 +0700)]
[InstCombine] Fix replace select with Phis when branch has the same labels

```
define i32 @test(i1 %cond) {
entry:
  br i1 %cond, label %exit, label %exit
exit:
  %result = select i1 %cond, i32 123, i32 456
  ret i32 %result
}
```
In this test, after applying transformation of replacing select with Phis,
the result will be:

```
define i32 @test(i1 %cond) {
entry:
  br i1 %cond, label %exit, label %exit
exit:
  %result = i32 phi [123, %exit], [123, %exit]
  ret i32 %result
}
```
That is, select is transformed into an invalid Phi, which will then be
reduced to 123 and the second value will be lost. But it is worth
noting that this problem will arise only if select is in the InstCombine
worklist will be before the branch. Otherwise, InstCombine will replace
the branch condition with false and transformation will not be applied.

The fix is to check the target labels in the branch condition for equality.

Patch By: Kirill Polushin
Differential Revision: https://reviews.llvm.org/D84003
Reviewed By: mkazantsev

4 years agoRevert "[AMDGPU/MemOpsCluster] Implement new heuristic for computing max mem ops...
hsmahesha [Fri, 17 Jul 2020 06:10:10 +0000 (11:40 +0530)]
Revert "[AMDGPU/MemOpsCluster] Implement new heuristic for computing max mem ops cluster size"

This reverts commit cc9d69385659be32178506a38b4f2e112ed01ad4.

4 years ago[DebugInfo] Fix a misleading usage of DWARF forms with DIEExpr. NFCI.
Igor Kudrin [Fri, 17 Jul 2020 05:46:47 +0000 (12:46 +0700)]
[DebugInfo] Fix a misleading usage of DWARF forms with DIEExpr. NFCI.

For now, DIEExpr is used only in two places:

 1) in the debug info library unit test suite to emit
    a DW_AT_str_offsets_base attribute with the DW_FORM_sec_offset
    form, see dwarfgen::DIE::addStrOffsetsBaseAttribute();

 2) in DwarfCompileUnit::addLocationAttribute() to generate the location
    attribute for a TLS variable.

The later case used an incorrect DWARF form of DW_FORM_udata, which
implies storing an uleb128 value, not a 4/8 byte constant. The generated
result was as expected because DIEExpr::SizeOf() did not handle the used
form, but returned the size of the code pointer by default.

The patch fixes the issue by using more appropriate DWARF forms for
the problematic case and making DIEExpr::SizeOf() more straightforward.

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

4 years ago[lldb] Only set the executable module for a target once
Raphael Isemann [Fri, 17 Jul 2020 06:03:07 +0000 (08:03 +0200)]
[lldb] Only set the executable module for a target once

Summary:

When we try to find the executable module for our target we don't check
if we already have an executable module set. This causes that when debugging
a program that dlopens another executable, LLDB will take that other executable
as the new executable of the target (which causes that future launches of the
target will launch the dlopen'd executable instead of the original executable).

This just adds a check that we only set the executable when we haven't already
found one.

Fixes rdar://63443099

Reviewers: jasonmolenda, jingham, teemperor

Reviewed By: jasonmolenda, teemperor

Subscribers: jingham, JDevlieghere

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

4 years ago[X86] Change the scheduler model for 'pentium4' to SandyBridgeModel.
Craig Topper [Fri, 17 Jul 2020 05:04:24 +0000 (22:04 -0700)]
[X86] Change the scheduler model for 'pentium4' to SandyBridgeModel.

I meant to do this in D83913, but missed it while updating the
feature list.

Interestingly I think this is disabling the postRA scheduler. But
it does match our default 64-bit behavior.

Reviewed By: echristo

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

4 years ago[X86] Reorder how the subtarget map key is created.
Craig Topper [Fri, 17 Jul 2020 03:14:20 +0000 (20:14 -0700)]
[X86] Reorder how the subtarget map key is created.

We use a SmallString<512> and attempted to reserve enough space
for CPU plus Features, but that doesn't account for all the things
that get added to the string.

Reorder the string so the shortest things go first which shouldn't
exceed the small size. Finally add the feature string at the end
which might be long. This should ensure at most one heap allocation
without needing to use reserve.

I don't know if this matters much in practice, but I was looking
into something else that will require more code here and noticed
the odd reserve call.

4 years ago[llvm] Add RISCVTargetParser.def to the module map
Jonas Devlieghere [Fri, 17 Jul 2020 04:38:49 +0000 (21:38 -0700)]
[llvm] Add RISCVTargetParser.def to the module map

This fixes the modules build.

4 years ago[ValueTracking] Let isGuaranteedNotToBeUndefOrPoison consider noundef
Juneyoung Lee [Fri, 17 Jul 2020 03:53:08 +0000 (12:53 +0900)]
[ValueTracking] Let isGuaranteedNotToBeUndefOrPoison consider noundef

 This patch adds support for noundef arguments.

Reviewed By: nikic

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

4 years agoAdd a test for D83752
Juneyoung Lee [Fri, 17 Jul 2020 03:50:28 +0000 (12:50 +0900)]
Add a test for D83752

4 years ago[DWARFYAML] Merge forms that use same encodings. NFC.
Xing GUO [Fri, 17 Jul 2020 03:28:29 +0000 (11:28 +0800)]
[DWARFYAML] Merge forms that use same encodings. NFC.

4 years ago[polly][NFC] Add missing 'override's
Logan Smith [Fri, 17 Jul 2020 03:12:13 +0000 (20:12 -0700)]
[polly][NFC] Add missing 'override's