platform/upstream/llvm.git
2 years ago[bolt] Include <atomic>
Fangrui Song [Fri, 15 Jul 2022 21:27:01 +0000 (14:27 -0700)]
[bolt] Include <atomic>

2 years ago[Libomptarget] Fix warnings on address space attributes
Joseph Huber [Fri, 15 Jul 2022 19:34:50 +0000 (15:34 -0400)]
[Libomptarget] Fix warnings on address space attributes

The device runtime uses the address space attribute to control the
placement of important constants on the GPU. The changes made in D126061
caused these to start emitting errors as they were not applied to the
type. This patch fixes the issues to make the warnings go away.

Reviewed By: ye-luo

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

2 years ago[PGO] Don't cross reference CSFDO profile and non-CSFDO profile
Rong Xu [Fri, 15 Jul 2022 20:57:23 +0000 (13:57 -0700)]
[PGO] Don't cross reference CSFDO profile and non-CSFDO profile

Don't cross reference CSFDO profile and non-CSFDO profile when
checking the function hash. Only return hash_mismatch when
CS bits match, and return unknown_function otherwise.

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

2 years ago[PGO] Improve hash-mismatch warning message
Rong Xu [Fri, 15 Jul 2022 20:44:55 +0000 (13:44 -0700)]
[PGO] Improve hash-mismatch warning message

This patch improves FDO hash-mismatch handling:
(1) filter out warnings to weak functions.
Weak functions definition will be overridden by a strong definition by linker.
The hash mismatch in profile use compilation is expected.
Make the profile hash mismatch warning under the existing option (default true).

(2) add an option to trace the hash of functions with the specific string.
Note that an empty string parameter will trace all functions.

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

2 years ago[mlir][sparse] Introduce new reduce op
Jim Kitchen [Fri, 15 Jul 2022 20:26:41 +0000 (15:26 -0500)]
[mlir][sparse] Introduce new reduce op

A new sparse_tensor operation allows for
custom reduction code to be injected during
linalg.generic lowering for sparse tensors.
An identity value is provided to indicate
the starting value of the reduction. A single
block region is required to contain the
custom reduce computation.

Reviewed by: aartbik

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

2 years ago[LSR] Allow already invariant operand for ICmpZero matching [try 2]
Philip Reames [Fri, 15 Jul 2022 20:23:10 +0000 (13:23 -0700)]
[LSR] Allow already invariant operand for ICmpZero matching [try 2]

Changes since initial commit:

* Wrapping a pointer in an SCEV unknown hides the base, and SCEV is only able to compute a subtraction when the bases are known to be equal. This results in a SCEVCouldNotCompute flowing forward and triggering asserts. Test case added in d767b392.
* isLoopInvariant returns true for instructions outside the loop, but not necessarily *above* the loop. Since this code is allowed to visit uses of an IV outside of a loop, we have to make sure the operands of the compare are both invariant and dominating the header. Test case added in 2aed3cdb.

Original commit message follows...

The ICmpZero matching is checking to see if the expression is loop invariant per SCEV and expandable. This allows expressions inside the loop which can be made loop invariant to be seamlessly expanded, but is overly conservative for expressions which already *are* loop invariant.

As a simple justification for why this is correct, consider a loop invariant urem as RHS vs an alternate function with that same urem wrapped inside a helper call. Why would it be legal to match the later, but not the former?

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

2 years ago[reland][lit][unit] makes sure to print stderr when no test failures are found
Yuanfang Chen [Fri, 15 Jul 2022 20:23:22 +0000 (13:23 -0700)]
[reland][lit][unit] makes sure to print stderr when no test failures are found

In some situations, like running tests with sanitizers, all test
passes but the shard could still fail due to memory issues.

Relands 65769429c0644c81d271e9d971f5b64191503

2 years agoRevert "[lit][unit] makes sure to print stderr when no test failures are found"
Yuanfang Chen [Fri, 15 Jul 2022 20:21:01 +0000 (13:21 -0700)]
Revert "[lit][unit] makes sure to print stderr when no test failures are found"

This reverts commit 65769429c0644c81d271e9d971f5b64191503f6e.

This patch is incomplete.

2 years ago[lldb] [llgs] Improve stdio forwarding in multiprocess+nonstop
Michał Górny [Thu, 30 Jun 2022 18:24:04 +0000 (20:24 +0200)]
[lldb] [llgs] Improve stdio forwarding in multiprocess+nonstop

Enable stdio forwarding when nonstop mode is enabled, and disable it
once it is disabled.  This makes it possible to cleanly handle stdio
forwarding while running multiple processes in non-stop mode.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128932

2 years ago[lldb] [test] Skip test_leave_nonstop on Windows
Michał Górny [Fri, 15 Jul 2022 19:47:37 +0000 (21:47 +0200)]
[lldb] [test] Skip test_leave_nonstop on Windows

2 years ago[mlir][Linalg] Extend Generic op dedup canonicalization to drop redundant result...
Mahesh Ravishankar [Fri, 15 Jul 2022 04:29:08 +0000 (04:29 +0000)]
[mlir][Linalg] Extend Generic op dedup canonicalization to drop redundant result values.

2 years ago[mlir][Linalg] NFC: Refactor canonicalization for deduping generic op operands.
Mahesh Ravishankar [Fri, 15 Jul 2022 03:56:48 +0000 (03:56 +0000)]
[mlir][Linalg] NFC: Refactor canonicalization for deduping generic op operands.

This is a NFC change to make it easier to update this canonicalization
for more use cases. The refactoring makes things easier to
understand/adapt.

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

2 years ago[lsan][nfc] Add missing newline to VReport
Leonard Grey [Fri, 15 Jul 2022 19:44:23 +0000 (15:44 -0400)]
[lsan][nfc] Add missing newline to VReport

2 years ago[Flang] Set constructExit for Where and Forall constructs
Jonathon Penix [Fri, 15 Jul 2022 19:32:36 +0000 (12:32 -0700)]
[Flang] Set constructExit for Where and Forall constructs

Evaluations for the Where and Forall constructs previously did
not have their constructExit field fixed up. This could lead to
falling through to subsequent case blocks in select case
statements if either a Where or Forall construct was the final part
of one case block. Setting the constructExit field results in the
proper branching behavior.

Fixes issue: https://github.com/llvm/llvm-project/issues/56500

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

Change-Id: Ia868df12084520a935f087524e118bcdf47f6d7a

2 years ago[lit][unit] makes sure to print stderr when no test failures are found
Yuanfang Chen [Fri, 15 Jul 2022 19:16:18 +0000 (12:16 -0700)]
[lit][unit] makes sure to print stderr when no test failures are found

In some situations, like running tests with sanitizers, all test passes
but the shard could still fail due to memory issues.

2 years ago[lld-macho][nfc] Fix numeric substitutions in icf.s test
Jez Ng [Fri, 15 Jul 2022 19:28:14 +0000 (15:28 -0400)]
[lld-macho][nfc] Fix numeric substitutions in icf.s test

We were re-defining the various numeric variables when we actually
intended to check already-defined variables against the value on the
current CHECK line.

Reviewed By: #lld-macho, thakis

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

2 years ago[test] Reduced test for second distinct issue triggering revert of 9153515
Philip Reames [Fri, 15 Jul 2022 19:08:24 +0000 (12:08 -0700)]
[test] Reduced test for second distinct issue triggering revert of 9153515

2 years ago[mlir][sparse] Add 3-dimensional sparse tensor multiplication integration test
Rajas Vanjape [Fri, 15 Jul 2022 18:09:17 +0000 (11:09 -0700)]
[mlir][sparse] Add 3-dimensional sparse tensor multiplication integration test

This diff adds an integration test which does element wise multiplication for two sparse 3-d tensors of size 3x3x5

Reviewed By: aartbik

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

2 years ago[syntax] Some #includes cleanup, NFC.
Haojian Wu [Fri, 15 Jul 2022 18:49:12 +0000 (20:49 +0200)]
[syntax] Some #includes cleanup, NFC.

2 years ago[llvm-cov] Add error message for missing profdata on report and export subcommands.
Zequan Wu [Thu, 14 Jul 2022 18:29:10 +0000 (11:29 -0700)]
[llvm-cov] Add error message for missing profdata on report and export subcommands.

When profdata is missing on report and export commands, the error message is
indistinguishable from missing instrumented binary file. This adds the error
message for report and export commands.

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

2 years ago[Reassociate] Enable FP reassociation via 'reassoc' and 'nsz'
Warren Ristow [Fri, 15 Jul 2022 18:44:35 +0000 (11:44 -0700)]
[Reassociate] Enable FP reassociation via 'reassoc' and 'nsz'

Compiling with '-ffast-math' tuns on all the FastMathFlags (FMF), as
expected, and that enables FP reassociation. Only the two FMF flags
'reassoc' and 'nsz' are technically required to perform reassociation,
but disabling other unrelated FMF bits is needlessly suppressing the
optimization.

This patch fixes that needless suppression, and makes appropriate
adjustments to test-cases, fixing some outstanding TODOs in the process.

Fixes: #56483

Reviewed By: spatel

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

2 years ago[test] Reduced test which triggered revert of 9153515
Philip Reames [Fri, 15 Jul 2022 18:31:29 +0000 (11:31 -0700)]
[test] Reduced test which triggered revert of 9153515

2 years ago[lldb] [llgs] Fix disabling non-stop mode
Michał Górny [Thu, 30 Jun 2022 08:47:15 +0000 (10:47 +0200)]
[lldb] [llgs] Fix disabling non-stop mode

Stop all processes and clear notification queues when disabling non-stop
mode.  Ensure that no stop notifications are sent for processes stopped
due to the mode switch.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128893

2 years ago[lldb] [test] Skip test_stop_reason_while_running on Windows
Michał Górny [Fri, 15 Jul 2022 18:14:26 +0000 (20:14 +0200)]
[lldb] [test] Skip test_stop_reason_while_running on Windows

2 years ago[libc] add rounding modes to printf float conv
Michael Jones [Wed, 13 Jul 2022 18:47:03 +0000 (11:47 -0700)]
[libc] add rounding modes to printf float conv

This adds functionality for rounding towards negative inf, positive inf,
and zero to the float hex conversion (%a).

Reviewed By: lntue

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

2 years ago[AMDGPU] Add remarks to output some resource usage
Vang Thao [Fri, 11 Mar 2022 00:46:50 +0000 (00:46 +0000)]
[AMDGPU] Add remarks to output some resource usage

Add analyis remarks to output kernel name, register usage, occupancy,
scratch usage, spills, and LDS information.

Reviewed By: arsenm

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

2 years ago[mlir][linalg] Fix tensor tiling together with interchange
Lei Zhang [Fri, 15 Jul 2022 17:43:57 +0000 (13:43 -0400)]
[mlir][linalg] Fix tensor tiling together with interchange

In `linalg::tileConsumerAndFuseProducers`, there are two levels of
tiling and fusion; we partition the tile sizes and only use one
half for each of them. The partition is using the first non-parallel
dimension *after* interchange as the boundary. However, concrete
tiling happens *together with* loop interchange, so we still need
to provide the partial tile sizes *before* the interchange.
Otherwise, there will be inconsistency, which is what this patch
is to fix.

Reviewed By: ThomasRaoux

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

2 years agoRevert "[LSR] Allow already invariant operand for ICmpZero matching"
Philip Reames [Fri, 15 Jul 2022 17:47:32 +0000 (10:47 -0700)]
Revert "[LSR] Allow already invariant operand for ICmpZero matching"

This reverts commit 9153515a7bea9fb9dd4c76f70053a170bf825f35.  Builtbot crash was reported in the commit thread, reverting while investigating.

2 years ago[mlir] Enable perfect forwarding in RewritePatternSet::add
Laszlo Kindrat [Fri, 15 Jul 2022 17:43:41 +0000 (19:43 +0200)]
[mlir] Enable perfect forwarding in RewritePatternSet::add

This patch modifies the implementation of `RewritePatternSet::add` to perfectly forward its arguments to pattern constructors. Without this, code like the following compiles but, due to the limited lifetime of the temporary TypeConverter, can produce unexpected behavior:
```
RewritePatternSet patterns(context);
patterns.add<SomeOpConversion, OtherOpConversion>(TypeConverter(), context);

if (failed(applyPartialConversion(getOperation(), target, std::move(patterns))))
  return signalPassFailure();
```

The patch also changes the linalg fusion pattern implementation to correctly fill the test pattern set given the new behavior.

Author: Laszlo Kindrat <laszlokindrat@gmail.com>

Reviewed By: nicolasvasilache

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

2 years ago[sanitizer] Add "mainfile" prefix to sanitizer special case list
Fangrui Song [Fri, 15 Jul 2022 17:39:26 +0000 (10:39 -0700)]
[sanitizer] Add "mainfile" prefix to sanitizer special case list

When an issue exists in the main file (caller) instead of an included file
(callee), using a `src` pattern applying to the included file may be
inappropriate if it's the caller's responsibility. Add `mainfile` prefix to check
the main filename.

For the example below, the issue may reside in a.c (foo should not be called
with a misaligned pointer or foo should switch to an unaligned load), but with
`src` we can only apply to the innocent callee a.h. With this patch we can use
the more appropriate `mainfile:a.c`.
```
//--- a.h
// internal linkage
static inline int load(int *x) { return *x; }

//--- a.c, -fsanitize=alignment
#include "a.h"
int foo(void *x) { return load(x); }
```

See the updated clang/docs/SanitizerSpecialCaseList.rst for a caveat due
to C++ vague linkage functions.

Reviewed By: #sanitizers, kstoimenov, vitalybuka

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

2 years ago[LV] Use umax(VF * UF, MinProfTC) for scalable vectors.
Florian Hahn [Fri, 15 Jul 2022 17:07:39 +0000 (10:07 -0700)]
[LV] Use umax(VF * UF, MinProfTC) for scalable vectors.

For scalable vectors, it is not sufficient to only check
MinProfitableTripCount if it is >= VF.getKnownMinValue() * UF, because
this property may not holder for larger values of vscale. In those
cases, compute umax(VF * UF, MinProfTC) instead.

This should fix
https://lab.llvm.org/buildbot/#/builders/197/builds/2262

2 years ago[Libomptarget][NFC] Fix signed comparison warnings
Joseph Huber [Fri, 15 Jul 2022 17:22:00 +0000 (13:22 -0400)]
[Libomptarget][NFC] Fix signed comparison warnings

Summary:
Non-functional change, just fixing some sign comparison warnings by
making both match.

2 years agoRevert "[mlir] Enable perfect forwarding in RewritePatternSet::add"
lorenzo chelini [Fri, 15 Jul 2022 17:16:09 +0000 (19:16 +0200)]
Revert "[mlir] Enable perfect forwarding in RewritePatternSet::add"

Did not preserve author information.

This reverts commit b0afda78f007740371307bfacbe4a486a4b77a3e.

2 years agogithub: Add a helpful message for issues without milestones
Tom Stellard [Fri, 15 Jul 2022 17:10:27 +0000 (10:10 -0700)]
github: Add a helpful message for issues without milestones

The /branch and /cherry-pick commands only work when an isssue has
a milestone, so give the user a helpful error message when they
try these commands on issue without a milestone.

Reviewed By: thieta, kwk

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

2 years ago[libc][arm32] add string stdlib & math entrypoints
Michael Jones [Fri, 15 Jul 2022 00:02:43 +0000 (17:02 -0700)]
[libc][arm32] add string stdlib & math entrypoints

This patch adds all the string and stdlib entrypoints, as well as a few
math entrypoints to the arm32 build.

Reviewed By: sivachandra

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

2 years ago[mlir] Enable perfect forwarding in RewritePatternSet::add
lorenzo chelini [Fri, 15 Jul 2022 17:06:10 +0000 (19:06 +0200)]
[mlir] Enable perfect forwarding in RewritePatternSet::add

This patch modifies the implementation of `RewritePatternSet::add` to perfectly forward its arguments to pattern constructors. Without this, code like the following compiles but, due to the limited lifetime of the temporary TypeConverter, can produce unexpected behavior:
```
RewritePatternSet patterns(context);
patterns.add<SomeOpConversion, OtherOpConversion>(TypeConverter(), context);

if (failed(applyPartialConversion(getOperation(), target, std::move(patterns))))
  return signalPassFailure();
```

The patch also changes the linalg fusion pattern implementation to correctly fill the test pattern set given the new behavior.

Author: Laszlo Kindrat <laszlokindrat@gmail.com>

Reviewed By: nicolasvasilache

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

2 years ago[ELF][RISCV] Relax local-exec TLS model
Fangrui Song [Fri, 15 Jul 2022 17:08:08 +0000 (10:08 -0700)]
[ELF][RISCV] Relax local-exec TLS model

In -mrelax mode, GCC/Clang may generate a local-exec TLS code sequence like:
```
# R_RISCV_TPREL_HI20, R_RISCV_RELAX
lui rd, %tprel_hi(x)
# R_RISCV_TPREL_ADD, R_RISCV_RELAX
add rd, rd, tp, %tprel_add(x)
# (R_RISCV_TPREL_LO12_I || R_RISCV_TPREL_LO12_S), R_RISCV_RELAX
addi rd, rd, %tprel_lo(x) || sw rs, %tprel(x)(rd)
```

Note: st_value(x) for TLS should be in the range [0,p_memsz(PT_TLS)).
When st_value(x) < 2048 (i.e. hi20(x) == 0), the linker can relax the code
sequence to:
```
addi rd, tp, st_value(x) || sw rs, st_value(x)(rd)
```

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

2 years ago[analyzer] Add new function `clang_analyzer_value` to ExprInspectionChecker
Denys Petrov [Sat, 9 Jul 2022 18:21:10 +0000 (21:21 +0300)]
[analyzer] Add new function `clang_analyzer_value` to ExprInspectionChecker

Summary: Introduce a new function 'clang_analyzer_value'. It emits a report that in turn prints a RangeSet or APSInt associated with SVal. If there is no associated value, prints "n/a".

2 years ago[LV] Add scalable vector test showing incorrect min-trip count check.
Florian Hahn [Fri, 15 Jul 2022 16:56:52 +0000 (09:56 -0700)]
[LV] Add scalable vector test showing incorrect min-trip count check.

The test shows a case where the minimum trip count check incorrectly
only checks the minimum profitable trip count computed due to runtime
checks. This is incorrect for scalable VFs, because the VF * UF may
exceed the minimum profitable trip count for vscale > 1.

This is the likely reason for
https://lab.llvm.org/buildbot/#/builders/197/builds/2262 failing.

2 years ago[LSR] Allow already invariant operand for ICmpZero matching
Philip Reames [Fri, 15 Jul 2022 16:31:56 +0000 (09:31 -0700)]
[LSR] Allow already invariant operand for ICmpZero matching

The ICmpZero matching is checking to see if the expression is loop invariant per SCEV and expandable. This allows expressions inside the loop which can be made loop invariant to be seamlessly expanded, but is overly conservative for expressions which already *are* loop invariant.

As a simple justification for why this is correct, consider a loop invariant urem as RHS vs an alternate function with that same urem wrapped inside a helper call. Why would it be legal to match the later, but not the former?

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

2 years ago[gn build] Port 32d8d23cd0b2
LLVM GN Syncbot [Fri, 15 Jul 2022 16:46:00 +0000 (16:46 +0000)]
[gn build] Port 32d8d23cd0b2

2 years ago[X86] test-vs-bittest.ll - add test coverage for (and (srl (not x), c), 1) patterns
Simon Pilgrim [Fri, 15 Jul 2022 15:41:08 +0000 (16:41 +0100)]
[X86] test-vs-bittest.ll - add test coverage for (and (srl (not x), c), 1) patterns

These can appear as well as the more common (and (not (srl x, c)), 1) patterns

2 years agoRe-apply 5acd47169884, Add a shared-memory based orc::MemoryMapper, with fixes.
Anubhab Ghosh [Fri, 15 Jul 2022 16:34:53 +0000 (09:34 -0700)]
Re-apply 5acd47169884, Add a shared-memory based orc::MemoryMapper, with fixes.

The original commit was reverted in 3e9cc543f223 due to buildbot failures, which
should be fixed by the addition of dependencies on librt.

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

2 years ago[lldb] [llgs] Fix `?` packet response for running threads
Michał Górny [Thu, 30 Jun 2022 05:58:12 +0000 (07:58 +0200)]
[lldb] [llgs] Fix `?` packet response for running threads

Fix the response to `?` packet for threads that are running at the time
(in non-stop mode).  The previous code would wrongly send or queue
an empty response for them.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128879

2 years ago[lldb] [test] Skip TestNonStop → test_stdio on Windows
Michał Górny [Fri, 15 Jul 2022 16:32:59 +0000 (18:32 +0200)]
[lldb] [test] Skip TestNonStop → test_stdio on Windows

2 years ago[MLIR][Presburger] reintroduce int64_t versions of floorDiv, ceilDiv in mlir::presbur...
Arjun P [Fri, 15 Jul 2022 16:27:32 +0000 (17:27 +0100)]
[MLIR][Presburger] reintroduce int64_t versions of floorDiv, ceilDiv in mlir::presburger namespace

This is useful because MPInt.h defines identically-named functions that
operate on MPInts, which would otherwie become the only candidates of
overload resolution when calling e.g. ceilDiv from the mlir::presburger
namespace (iff MPInt.h is included). So to access the 64-bit overloads, an
explict call to mlir::ceilDiv would be required. This patch adds `using`
declarations allowing overload resolution to transparently call the right
function.

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] MPInt: add missing fastpath in ceilDiv
Arjun P [Fri, 15 Jul 2022 16:25:40 +0000 (17:25 +0100)]
[MLIR][Presburger] MPInt: add missing fastpath in ceilDiv

This is not a bug in functionality, just a missed optimization.

Reviewed By: Groverkss

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

2 years ago[analyzer][NFC] Tidy up handler-functions in SymbolicRangeInferrer
Denys Petrov [Tue, 12 Jul 2022 20:18:37 +0000 (23:18 +0300)]
[analyzer][NFC] Tidy up handler-functions in SymbolicRangeInferrer

Summary: Sorted some handler-functions into more appropriate visitor functions of the SymbolicRangeInferrer.
- Spread `getRangeForNegatedSub` body over several visitor functions: `VisitSymExpr`, `VisitSymIntExpr`, `VisitSymSymExpr`.
- Moved `getRangeForComparisonSymbol` from `infer` to `VisitSymSymExpr`.

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

2 years ago[mlir][math] Added math::tan operation.
Slava Zakharin [Tue, 12 Jul 2022 04:01:04 +0000 (21:01 -0700)]
[mlir][math] Added math::tan operation.

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

2 years ago[Clang] Add a new clang option "-ftime-trace=<value>"
dongjunduo [Fri, 17 Jun 2022 11:10:02 +0000 (11:10 +0000)]
[Clang] Add a new clang option "-ftime-trace=<value>"

The time profiler traces the stages during the clang compile
process. Each compiling stage of a single source file
corresponds to a separately .json file which holds its
time tracing data. However, the .json files are stored in the
same path/directory as its corresponding stage's '-o' option.
For example, if we compile the "demo.cc" to "demo.o" with option
"-o /tmp/demo.o", the time trace data file path is "/tmp/demo.json".

A typical c++ project can contain multiple source files in different
path, but all the json files' paths can be a mess.

The option "-ftime-trace=<value>" allows you to specify where the json
files should be stored. This allows the users to place the time trace
data files of interest in the desired location for further data analysis.

Usage:
    - clang/clang++ -ftime-trace ...
    - clang/clang++ -ftime-trace=the-directory-you-want ...
    - clang/clang++ -ftime-trace=the-directory-you-want/ ...
    - clang/clang++ -ftime-trace=the-full-file-path-you-want ...

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

2 years ago[NFC][SCEV] Rename variable to correspond its current meaning
Max Kazantsev [Fri, 15 Jul 2022 15:33:32 +0000 (22:33 +0700)]
[NFC][SCEV] Rename variable to correspond its current meaning

2 years ago[lldb] [llgs] Send process output asynchronously in non-stop mode
Michał Górny [Wed, 29 Jun 2022 19:48:10 +0000 (21:48 +0200)]
[lldb] [llgs] Send process output asynchronously in non-stop mode

Introduce a new %Stdio notification category and use it to send process
output asynchronously when running in non-stop mode.  This is an LLDB
extension since GDB does not use the 'O' packet for process output,
just for replies to 'qRcmd' packets.

Using the async notification mechanism implies that only the first
output packet is sent immediately to the client.  The client needs
to request subsequent notifications (if any) using the new vStdio packet
(that works pretty much like vStopped for the Stop notification queue).

The packet handler in lldb-server tests is updated to handle the async
stdio packets in addition to the regular O packets.  However, due
to the implications noted above, it can only handle the first output
packet sent by the server.  Subsequent packets need to be explicitly
requested via vStdio.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128849

2 years ago[mlir][mbr] Improve diagnostics on error with `raise from`.
Ingo Müller [Thu, 14 Jul 2022 12:17:29 +0000 (12:17 +0000)]
[mlir][mbr] Improve diagnostics on error with `raise from`.

This commit extends the `raise` statements on errors in user-provided
code with `from e` clauses that attach the original exception to the one
being raised. This allows to debug the root cause of the error more
easily.

Reviewed By: SaurabhJha

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

2 years agoRe-run update_test_checks for some tests
Nicolai Hähnle [Fri, 15 Jul 2022 15:10:12 +0000 (17:10 +0200)]
Re-run update_test_checks for some tests

Motivation is to simplify the test diff for an upcoming real change.

2 years ago[SCEV] List all binops in getOperandsToCreate()
Nikita Popov [Fri, 15 Jul 2022 15:06:07 +0000 (17:06 +0200)]
[SCEV] List all binops in getOperandsToCreate()

Explicitly list all binops rather than having a default case. There
were two bugs here:
1. U->getOpcode() was used instead of BO->Opcode, which means we
   used the logic for the wrong opcode in some cases.
2. SCEV construction does not support LShr. We should return
   unknown for it rather than recursing into the operands.

2 years agoClarify the behavior of the llvm.vector.insert/extract intrinsics when the index
David Kreitzer [Wed, 6 Jul 2022 18:15:16 +0000 (11:15 -0700)]
Clarify the behavior of the llvm.vector.insert/extract intrinsics when the index
is out of range. Both intrinsics return a poison value.

Consequently, mark the intrinsics speculatable.
Differential Revision: https://reviews.llvm.org/D129656

2 years ago[MLIR][Presburger] SlowMPInt: gcd: assert that operands are non-negative
Arjun P [Fri, 15 Jul 2022 14:32:15 +0000 (15:32 +0100)]
[MLIR][Presburger] SlowMPInt: gcd: assert that operands are non-negative

2 years ago[docs] Note about how to handle 'llvm-mt: error: no libxml2'
Hans Wennborg [Thu, 14 Jul 2022 13:31:53 +0000 (15:31 +0200)]
[docs] Note about how to handle 'llvm-mt: error: no libxml2'

See https://github.com/llvm/llvm-project/issues/55817 and
https://discourse.llvm.org/t/cannot-cmake-self-hosted-clang-on-windows-for-lack-of-libxml2/58793

Not sure where is the best place to put this, but hopefully this will be
found by those searching for the error message.

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

2 years ago[lldb] [test] Skip new NonStop tests on Windows
Michał Górny [Fri, 15 Jul 2022 14:02:36 +0000 (16:02 +0200)]
[lldb] [test] Skip new NonStop tests on Windows

2 years ago[lldb][AArch64] Enable int128 test
David Spickett [Fri, 15 Jul 2022 13:35:48 +0000 (13:35 +0000)]
[lldb][AArch64] Enable int128 test

Other 128 bit tests run on AArch64 fine, it's
Arm (as in 32 bit Arm) that needs to be skipped.

2 years agoReland "[lldb] [llgs] Fix multi-resume bugs with nonstop mode"
Michał Górny [Tue, 28 Jun 2022 04:00:46 +0000 (06:00 +0200)]
Reland "[lldb] [llgs] Fix multi-resume bugs with nonstop mode"

Improve handling of multiple successive continue packets in non-stop
mode.  More specifically:

1. Explicitly send error response (instead of crashing on assertion)
   if the user attempts to resume the same process twice.  Since we
   do not support thread-level non-stop mode, one needs to always stop
   the process explicitly before resuming another thread set.

2. Actually stop the process if "vCont;t" is delivered to a running
   process.  Similarly, we only support stopping all the running threads
   simultaneously (via -1) and return an error in any other case.

With this patch, running multiple processes simultaneously is still
unsupported.  The patch also employs a hack to avoid enabling stdio
forwarding on "vCont;t" packet.  Both of these issues are addressed
by followup patches.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128710

2 years ago[pseudo] Share the underly payload when stripping comments for a token stream
Haojian Wu [Fri, 15 Jul 2022 13:12:46 +0000 (15:12 +0200)]
[pseudo] Share the underly payload when stripping comments for a token stream

`stripComments(cook(...))` is a common pattern being written.
Without this patch, this has a use-after-free issue (cook returns a temporary
TokenStream object which has its own payload, but the payload is not
shared with the one returned by stripComments).

Reviewed By: sammccall

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

2 years ago[MLIR][Presburger] MPInt: gcd: assert that operands are non-negative
Arjun P [Fri, 15 Jul 2022 13:02:06 +0000 (14:02 +0100)]
[MLIR][Presburger] MPInt: gcd: assert that operands are non-negative

2 years ago[pseudo] Generate an enum type for identifying grammar rules.
Haojian Wu [Fri, 8 Jul 2022 10:16:16 +0000 (12:16 +0200)]
[pseudo] Generate an enum type for identifying grammar rules.

The Rule enum type enables us to identify a grammar rule within C++'s
type system.

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

2 years ago[ARM] Regenerate pr36577.ll test checks
Simon Pilgrim [Fri, 15 Jul 2022 12:50:52 +0000 (13:50 +0100)]
[ARM] Regenerate pr36577.ll test checks

2 years ago[AArch64] Regenerate optimize-imm.ll test checks
Simon Pilgrim [Fri, 15 Jul 2022 12:49:44 +0000 (13:49 +0100)]
[AArch64] Regenerate optimize-imm.ll test checks

2 years agoRemove an unsued-variable warning, NFC.
Haojian Wu [Fri, 15 Jul 2022 11:25:02 +0000 (13:25 +0200)]
Remove an unsued-variable warning, NFC.

2 years ago[libcxx] Temporarily skip Arm configs
Adhemerval Zanella [Fri, 15 Jul 2022 11:38:51 +0000 (08:38 -0300)]
[libcxx] Temporarily skip Arm configs

The machine hosting these agents will be down for maintenance July 15th.

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

2 years ago[DAG] Move "xor (X logical_shift ShiftC), XorC --> (not X) logical_shift ShiftC"...
Simon Pilgrim [Fri, 15 Jul 2022 11:16:22 +0000 (12:16 +0100)]
[DAG] Move "xor (X logical_shift ShiftC), XorC --> (not X) logical_shift ShiftC" fold into SimplifyDemandedBits

SimplifyDemandedBits is called slightly later which allows the not(sext(x)) -> sext(not(x)) fold to occur via foldLogicOfShifts

As mentioned on D127115, we should be able to further generalise this based off the demanded bits.

2 years ago[InstCombine] Precommit test
Piotr Sobczak [Fri, 15 Jul 2022 11:29:22 +0000 (13:29 +0200)]
[InstCombine] Precommit test

2 years agoRevert "[lldb] [llgs] Fix multi-resume bugs with nonstop mode"
Michał Górny [Fri, 15 Jul 2022 11:43:34 +0000 (13:43 +0200)]
Revert "[lldb] [llgs] Fix multi-resume bugs with nonstop mode"

This reverts commit f8605da8758fbae16410e4ed5493a39429fd73ec.
This is causing buildbot failures and now I see that I have not updated
the tests to use "stop" instead of "trap".

2 years ago[stackmaps] Legalise patchpoint arguments.
Edd Barrett [Fri, 15 Jul 2022 11:00:14 +0000 (12:00 +0100)]
[stackmaps] Legalise patchpoint arguments.

This is similar to D125680, but for llvm.experimental.patchpoint
(instead of llvm.experimental.stackmap).

Differential review: https://reviews.llvm.org/D129268

2 years ago[lldb] [llgs] Fix multi-resume bugs with nonstop mode
Michał Górny [Tue, 28 Jun 2022 04:00:46 +0000 (06:00 +0200)]
[lldb] [llgs] Fix multi-resume bugs with nonstop mode

Improve handling of multiple successive continue packets in non-stop
mode.  More specifically:

1. Explicitly send error response (instead of crashing on assertion)
   if the user attempts to resume the same process twice.  Since we
   do not support thread-level non-stop mode, one needs to always stop
   the process explicitly before resuming another thread set.

2. Actually stop the process if "vCont;t" is delivered to a running
   process.  Similarly, we only support stopping all the running threads
   simultaneously (via -1) and return an error in any other case.

With this patch, running multiple processes simultaneously is still
unsupported.  The patch also employs a hack to avoid enabling stdio
forwarding on "vCont;t" packet.  Both of these issues are addressed
by followup patches.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128710

2 years agoReland "[lldb] Add support for using integral const static data members in the expres...
Andy Yankovsky [Fri, 15 Jul 2022 10:43:48 +0000 (10:43 +0000)]
Reland "[lldb] Add support for using integral const static data members in the expression evaluator"

Reland 486787210d which broke tests on Arm and Windows.

* Windows -- on Windows const static data members with no out-of-class
  definition do have valid addresses, in constract to other platforms
  (Linux, macos) where they don't. Adjusted the test to expect success
  on Windows and failure on other platforms.

* Arm -- `int128` is not available on 32-bit ARM, so disable the test
  for this architecture.

2 years ago[ARM] Regenerate hoist-and-by-const-from-shl-in-eqcmp-zero.ll
Simon Pilgrim [Fri, 15 Jul 2022 10:28:33 +0000 (11:28 +0100)]
[ARM] Regenerate hoist-and-by-const-from-shl-in-eqcmp-zero.ll

cleanup some common prefixes

2 years ago[AMDGPU][MC][NFC] Remove unnecessary code
Dmitry Preobrazhensky [Fri, 15 Jul 2022 10:17:36 +0000 (13:17 +0300)]
[AMDGPU][MC][NFC] Remove unnecessary code

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

2 years ago[AMDGPU][MC][GFX11] Correct disassembly of *_e64_dpp opcodes which support op_sel
Dmitry Preobrazhensky [Fri, 15 Jul 2022 10:11:59 +0000 (13:11 +0300)]
[AMDGPU][MC][GFX11] Correct disassembly of *_e64_dpp opcodes which support op_sel

These opcodes cannot be disassembled because op_sel operand is missing - it must be added manually.
See https://github.com/llvm/llvm-project/issues/56512 for detailed issue analysis.

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

2 years ago[syntax] Add virtual destructor in TokenManager.
Haojian Wu [Fri, 15 Jul 2022 09:51:13 +0000 (11:51 +0200)]
[syntax] Add virtual destructor in TokenManager.

Fix `-Wnon-virtual-dtor` warning.

2 years ago[clang-format] distinguish multiplication after brace-init from pointer
Krasimir Georgiev [Fri, 15 Jul 2022 09:36:08 +0000 (11:36 +0200)]
[clang-format] distinguish multiplication after brace-init from pointer

After https://github.com/llvm/llvm-project/commit/b646f0955574c6ad4c156c9db522e46f597cfda9,
the added regression test started being formatted as-if the
multiplication `*` was a pointer. This adapts the heuristic to
distinguish between these two cases.

Reviewed By: jackhong12, curdeius, HazardyKnusperkeks, owenpan

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

2 years ago[InstCombine] Ensure constant folding in binop of select fold
Nikita Popov [Fri, 15 Jul 2022 08:59:33 +0000 (10:59 +0200)]
[InstCombine] Ensure constant folding in binop of select fold

When folding a binop into a select, we need to ensure that one
of the select arms actually does constant fold, otherwise we'll
create two binop instructions and perform the reverse transform.

Ensure this by performing an explicit constant folding attempt,
and failing the transform if neither side simplifies.

A simple alternative here would have been to limit the fold to
ImmConstants, but given the current representation of scalable
vector splats, this wouldn't be ideal.

2 years ago[LV][NFC] Fix the condition for printing debug messages
Mel Chen [Fri, 15 Jul 2022 08:45:22 +0000 (01:45 -0700)]
[LV][NFC] Fix the condition for printing debug messages

Reviewed By: fhahn

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

2 years ago[gn build] Port 263dcf452fa0
LLVM GN Syncbot [Fri, 15 Jul 2022 08:36:57 +0000 (08:36 +0000)]
[gn build] Port 263dcf452fa0

2 years ago[syntax] Introduce a TokenManager interface.
Haojian Wu [Thu, 7 Jul 2022 12:44:27 +0000 (14:44 +0200)]
[syntax] Introduce a TokenManager interface.

TokenManager defines Token interfaces for the clang syntax-tree. This is the level
of abstraction that the syntax-tree should use to operate on Tokens.

It decouples the syntax-tree from a particular token implementation (TokenBuffer
previously).  This enables us to use a different underlying token implementation
for the syntax Leaf node -- in clang pseudoparser, we want to produce a
syntax-tree with its own pseudo::Token rather than syntax::Token.

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

2 years ago[ELF] Reword --no-allow-shlib-undefined diagnostic
Fangrui Song [Fri, 15 Jul 2022 08:29:58 +0000 (01:29 -0700)]
[ELF] Reword --no-allow-shlib-undefined diagnostic

Use a format more similar to unresolved references from regular object
files. It's probably easier to read for people who are less familiar
with the linker diagnostics.

Reviewed By: ikudrin

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

2 years ago[LV] Pre-commit test case for D128523, NFC
Mel Chen [Fri, 15 Jul 2022 07:20:20 +0000 (00:20 -0700)]
[LV] Pre-commit test case for D128523, NFC

2 years agoModernize Optional::{getValueOr,hasValue}
Fangrui Song [Fri, 15 Jul 2022 08:20:38 +0000 (01:20 -0700)]
Modernize Optional::{getValueOr,hasValue}

2 years ago[IR] Don't use blockaddresses as callbr arguments
Nikita Popov [Thu, 7 Jul 2022 10:27:43 +0000 (12:27 +0200)]
[IR] Don't use blockaddresses as callbr arguments

Following some recent discussions, this changes the representation
of callbrs in IR. The current blockaddress arguments are replaced
with `!` label constraints that refer directly to callbr indirect
destinations:

    ; Before:
    %res = callbr i8* asm "", "=r,r,i"(i8* %x, i8* blockaddress(@test8, %foo))
    to label %asm.fallthrough [label %foo]
    ; After:
    %res = callbr i8* asm "", "=r,r,!i"(i8* %x)
    to label %asm.fallthrough [label %foo]

The benefit of this is that we can easily update the successors of
a callbr, without having to worry about also updating blockaddress
references. This should allow us to remove some limitations:

* Allow unrolling/peeling/rotation of callbr, or any other
  clone-based optimizations
  (https://github.com/llvm/llvm-project/issues/41834)
* Allow duplicate successors
  (https://github.com/llvm/llvm-project/issues/45248)

This is just the IR representation change though, I will follow up
with patches to remove limtations in various transformation passes
that are no longer needed.

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

2 years ago[compiler-rt][CMake] Set unwinder for MSan unittests
Petr Hosek [Fri, 15 Jul 2022 08:10:52 +0000 (08:10 +0000)]
[compiler-rt][CMake] Set unwinder for MSan unittests

This addresses an issue introduced by 6699f554880087106a02be1675395bf2cc6f46c8.

2 years ago[C++20] [Modules] Handle reachability for enum class
Chuanqi Xu [Fri, 15 Jul 2022 07:54:45 +0000 (15:54 +0800)]
[C++20] [Modules] Handle reachability for enum class

In previous reachability patch, we missed the case for enum class.
Trying to handle it in this patch and add the corresponding tests.

2 years ago[LSR] Create SCEVExpander earlier, use member isSafeToExpand() (NFC)
Nikita Popov [Thu, 14 Jul 2022 13:20:13 +0000 (15:20 +0200)]
[LSR] Create SCEVExpander earlier, use member isSafeToExpand() (NFC)

This is a followup to D129630, which switches LSR to the member
isSafeToExpand() variant, and removes the freestanding function.

This is done by creating the SCEVExpander early (already during the
analysis phase). Because the SCEVExpander is now available for the
whole lifetime of LSRInstance, I've also made it into a member
variable, rather than passing it around in even more places.

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

2 years ago[llvm] A macro of if should be wrapped in do ... while (false)
owenca [Fri, 15 Jul 2022 07:25:01 +0000 (00:25 -0700)]
[llvm] A macro of if should be wrapped in do ... while (false)

2 years ago[compiler-rt][CMake] Set --unwindlib=none when using LLVM libunwind
Petr Hosek [Mon, 11 Jul 2022 08:08:37 +0000 (08:08 +0000)]
[compiler-rt][CMake] Set --unwindlib=none when using LLVM libunwind

We already link libunwind explicitly so avoid trying to link toolchain's
default libunwind which may be missing. This matches what we already do
for libcxx and libcxxabi.

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

2 years ago[mlir][benchmark] Fix import in sparse benchmark.
Ingo Müller [Thu, 14 Jul 2022 08:04:21 +0000 (08:04 +0000)]
[mlir][benchmark] Fix import in sparse benchmark.

The benchmark currently fails to run because it cannot find the `func`
symbol when using a `FuncOp`. I suppose that the breakage was introduced
by the extraction of the func dialect from the builtin dialect that
wasn't reflected in the benchmark yet.

Reviewed By: aartbik

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

2 years ago[RISCV] Add cost model for vector.reverse mask operation
Lian Wang [Wed, 29 Jun 2022 06:28:26 +0000 (06:28 +0000)]
[RISCV] Add cost model for vector.reverse mask operation

Reviewed By: craig.topper

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

2 years ago[Orc] Honor hasJIT in JITTargetMachineBuilder::createTargetMachine
Rainer Orth [Fri, 15 Jul 2022 06:20:57 +0000 (08:20 +0200)]
[Orc] Honor hasJIT in JITTargetMachineBuilder::createTargetMachine

Even with D129349 <https://reviews.llvm.org/D129349>, various SPARC JIT
tests still `FAIL`.  They are guarded by `host-supports-jit`.  This is set
from `clang-repl --host-supports-jit` which still returns `true`.  It turns
out the `JITTargetMachineBuilder` doesn't consider `hasJIT` at all.

This patch corrects this, turning the affected tests `UNSUPPORTED`.

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

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

2 years ago[Sparc] Don't claim JIT support on SPARC for now
Rainer Orth [Fri, 15 Jul 2022 06:18:40 +0000 (08:18 +0200)]
[Sparc] Don't claim JIT support on SPARC for now

Until D118450 <https://reviews.llvm.org/D118450> lands, there's no JIT
support on SPARC, but the backend claims otherwise, leading to various
testsuite failures.

This patch corrects this.

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

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

2 years ago[gn build] Port 7ced9fff9547
LLVM GN Syncbot [Fri, 15 Jul 2022 04:37:28 +0000 (04:37 +0000)]
[gn build] Port 7ced9fff9547

2 years ago[lldb] Print the enum values and their description in the help output
Jonas Devlieghere [Fri, 15 Jul 2022 03:23:07 +0000 (20:23 -0700)]
[lldb] Print the enum values and their description in the help output

Print the enum values and their description in the help output for
argument values. Until now, there was no way to get these values and
their description.

Example output:

(lldb) help <description-verbosity>
  <description-verbosity> -- How verbose the output of 'po' should be.

     compact : Only show the description string
     full    : Show the full output, including persistent variable's
               name and type

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

2 years ago[lldb] Refactor command option enum values (NFC)
Jonas Devlieghere [Thu, 14 Jul 2022 03:11:37 +0000 (20:11 -0700)]
[lldb] Refactor command option enum values (NFC)

Refactor the command option enum values and the command argument table
to connect the two. This has two benefits:

 - We guarantee that two options that use the same argument type have
   the same accepted values.
 - We can print the enum values and their description in the help
   output. (D129707)

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

2 years agoRevert "[clang] Implement ElaboratedType sugaring for types written bare"
Jonas Devlieghere [Fri, 15 Jul 2022 04:13:57 +0000 (21:13 -0700)]
Revert "[clang] Implement ElaboratedType sugaring for types written bare"

This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it
stills breaks the LLDB tests. This was  re-landed without addressing the
issue or even agreement on how to address the issue. More details and
discussion in https://reviews.llvm.org/D112374.