platform/upstream/llvm.git
13 months ago[GlobalISel] Introduce G_CONSTANT_FOLD_BARRIER and use it to prevent constant folding
Amara Emerson [Thu, 1 Jun 2023 22:11:24 +0000 (15:11 -0700)]
[GlobalISel] Introduce G_CONSTANT_FOLD_BARRIER and use it to prevent constant folding
hoisted constants.

The constant hoisting pass tries to hoist large constants into predecessors and also
generates remat instructions in terms of the hoisted constants. These aim to prevent
codegen from rematerializing expensive constants multiple times. So we can re-use
this optimization, we can preserve the no-op bitcasts that are used to anchor
constants to the predecessor blocks.

SelectionDAG achieves this by having the OpaqueConstant node, which is just a
normal constant with an opaque flag set. I've opted to avoid introducing a new
constant generic instruction here. Instead, we have a new G_CONSTANT_FOLD_BARRIER
operation that constitutes a folding barrier.

These are somewhat like the optimization hints, G_ASSERT_ZEXT in that they're
eliminated by the generic instruction selection code.

This change by itself has very minor improvements in -Os CTMark overall. What this
does allow is better optimizations when future combines are added that rely on having
expensive constants remain unfolded.

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

13 months ago[mlir] Add support for "promised" interfaces
River Riddle [Tue, 22 Feb 2022 22:51:37 +0000 (14:51 -0800)]
[mlir] Add support for "promised" interfaces

Promised interfaces allow for a dialect to "promise" the implementation of an interface, i.e.
declare that it supports an interface, but have the interface defined in an extension in a library
separate from the dialect itself. A promised interface is powerful in that it alerts the user when
the interface is attempted to be used (e.g. via cast/dyn_cast/etc.) and the implementation has
not yet been provided. This makes the system much more robust against misconfiguration,
and ensures that we do not lose the benefit we currently have of defining the interface in
the dialect library.

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

13 months ago[llvm-dlltool] Implement the --no-leading-underscore option
Martin Storsjö [Wed, 7 Jun 2023 11:11:30 +0000 (14:11 +0300)]
[llvm-dlltool] Implement the --no-leading-underscore option

This requires being able to opt out from adding the leading underscores
in COFFModuleDefinition. Normally it is added automatically for I386
type targets. We could either move the decision entirely to all
callers, letting the caller check the machine type and decide whether
underscores should be added, or keep the logic mostly as is, but allowing
opting out from the behaviour on I386.

I went with keeping the interface as is for now.

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

13 months ago[clang/test/CodeGen] Add test coverage for VarBypassDetector handling init statements...
Wang [Fri, 9 Jun 2023 18:05:51 +0000 (11:05 -0700)]
[clang/test/CodeGen] Add test coverage for VarBypassDetector handling init statements and condition variables in switch clauses

[VarBypassDetector.cpp](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/VarBypassDetector.cpp) lacks test coverage for handling init statements and condition variables in switch clauses, as is shown in:
https://lab.llvm.org/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/CodeGen/VarBypassDetector.cpp.html#L70
This patch adds test coverage for uncovered lines.

Reviewed By: vitalybuka

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

13 months ago[CodeGen] Fix a warning in release builds
Kazu Hirata [Fri, 9 Jun 2023 18:00:14 +0000 (11:00 -0700)]
[CodeGen] Fix a warning in release builds

This patch fixes:

  llvm/lib/CodeGen/MachineScheduler.cpp:4223:9: error: unused type
  alias 'IntervalTy' [-Werror,-Wunused-local-typedef]

13 months agoBrings back "[mlir][sparse] moving inbound check for slice driven loop into before...
Peiming Liu [Fri, 9 Jun 2023 17:22:56 +0000 (17:22 +0000)]
Brings back "[mlir][sparse] moving inbound check for slice driven loop into before block of the WhileOp"

This reverts commit 07b927902d410fefd2ebdec727957767dcd4fd2e.

Reviewed By: K-Wu

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

13 months agoRevert "[mlir][sparse] moving inbound check for slice driven loop into before block...
Peiming Liu [Fri, 9 Jun 2023 17:19:21 +0000 (17:19 +0000)]
Revert "[mlir][sparse] moving inbound check for slice driven loop into before block of the WhileOp"

This reverts commit 853d704fd0c4744731870df67ade7249d5440438.

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

13 months ago[mlir][sparse][gpu] unify dnmat and dnvec handle and ops
Kun Wu [Fri, 9 Jun 2023 16:58:44 +0000 (16:58 +0000)]
[mlir][sparse][gpu] unify dnmat and dnvec handle and ops

Reviewed By: aartbik

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

13 months ago[mlir][sparse] moving inbound check for slice driven loop into before block of the...
Peiming Liu [Wed, 7 Jun 2023 23:34:44 +0000 (23:34 +0000)]
[mlir][sparse] moving inbound check for slice driven loop into before block of the WhileOp

This patch changes the while loop generated for iterating over a fully reduced sparse level with affine index expression.
Before:
```
cont = true
while (cont) {
  if (inBound()) {
    ....
    cont = true;
  } else {
    cont = false;
  }
}
```
After:
```
while(inBound()) {
  ....
}
```

Reviewed By: K-Wu

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

13 months ago[RISCV] Cleanup vmv.v.x isel patterns to look more like other patterns. NFC
Craig Topper [Fri, 9 Jun 2023 16:59:27 +0000 (09:59 -0700)]
[RISCV] Cleanup vmv.v.x isel patterns to look more like other patterns. NFC

Add register classes to output registers. Use simm5 instead of XLenVT
for output immediate.

13 months ago[gn build] Fix per target runtime directory path
Arthur Eubanks [Fri, 9 Jun 2023 16:58:08 +0000 (09:58 -0700)]
[gn build] Fix per target runtime directory path

13 months ago[AppleAccelTable][NFC] Refactor iterator class
Felipe de Azevedo Piovezan [Sun, 4 Jun 2023 13:30:00 +0000 (09:30 -0400)]
[AppleAccelTable][NFC] Refactor iterator class

The current implementation of the AppleAcceleratorTable::Entry is problematic
for a few reasons:

1. It is heavyweight. Iterators should be cheap, but the current implementation
tracks 3 different integer values, one "Entry" object, and one pointer to the
actual accelerator table. Most of this information is redundant and can be
removed.

2. It performs "memory reads" outside of the dereference operation. This
violates the usual expectations of iterators, whereby we don't access anything
so long as we don't dereference  the iterator.

3. It doesn't commit to tracking _one_ thing only. It tries to track both an
"index" into a list of HashData entries and a pointer in a blob of data. For
this reason, it allows for multiple "invalid" states, keeps redundant
information around and is difficult to understand.

4. It couples the interpretation of the data with the iterator increment. As
such, if the *interpretation* fails, the iterator will keep on producing garbage
values without ever indicating so to consumers.

The problem this iterator is trying to solve is simple: we have a blob of data
containing many "HashData" entries and we want to iterate over them. As such,
this commit makes the iterator only track a pointer over that data, and it
decouples the iterator increments from the interpretation of this blob of data.

We maintain the already existing assumption that failures never happen, but now
make it explicit with an assert.

Depends on D152158

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

13 months ago[Driver] Mark many target-specific driver-only options as TargetSpecific
Fangrui Song [Fri, 9 Jun 2023 16:26:37 +0000 (09:26 -0700)]
[Driver] Mark many target-specific driver-only options as TargetSpecific

so that they get an error on other targets. This change uses let statements to
apply `Flags = [TargetSpecific]` to options (mostly -m*) without specifying `Flags`.
Follow-up to D151590.

For some options, e.g. -mdefault-build-attributes (D31813), -mbranch-likely
(D38168), -mfpu=/-mabi= (6890b9b71e525020ab58d436336664beede71575), a warning
seems desired in at least certain cases. This is not the best practice, but this
change works around them by not applying `Flags = [TargetSpecific]`.

(
For Intel CPU errata -malign-branch= family options, we also drop the unneeded
NotXarchOption flag. This flag reports an error if the option is used with
-Xarch_*. This error reporting does not seem very useful.
)

13 months ago[gn build] Port 6adb1ca555ec
LLVM GN Syncbot [Fri, 9 Jun 2023 15:44:13 +0000 (15:44 +0000)]
[gn build] Port 6adb1ca555ec

13 months ago[WebAssembly] Re-land 8392bf6000ad
Caleb Zulawski [Fri, 9 Jun 2023 15:42:26 +0000 (08:42 -0700)]
[WebAssembly] Re-land 8392bf6000ad

Correctly handle single-element vectors to fix an assertion failure. Add tests
that were missing from the original commit.

Differential Revision: D151782

13 months ago[libc++] Add concepts that ensure a given iterator meets the syntactic requirements
Nikolas Klauser [Fri, 9 Jun 2023 15:38:07 +0000 (08:38 -0700)]
[libc++] Add concepts that ensure a given iterator meets the syntactic requirements

These concepts are used to ensure valid iterators are passed to PSTL algorithms, but can also be used for other interfaces.

Reviewed By: ldionne, #libc

Spies: EricWF, libcxx-commits

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

13 months ago[GVN] Fix typo in freeze test case
Jay Foad [Fri, 9 Jun 2023 14:36:48 +0000 (15:36 +0100)]
[GVN] Fix typo in freeze test case

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

13 months ago[mlir][vector][transform] Expose tensor slice -> transfer folding patterns
Matthias Springer [Fri, 9 Jun 2023 14:22:41 +0000 (16:22 +0200)]
[mlir][vector][transform] Expose tensor slice -> transfer folding patterns

Add a new transform op to populate patterns: ApplyFoldTensorSliceIntoTransferPatternsOp.

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

13 months ago[libclang] Add CXBinaryOperatorKind and CXUnaryOperatorKind
MineGame159 [Fri, 9 Jun 2023 14:01:43 +0000 (10:01 -0400)]
[libclang] Add CXBinaryOperatorKind and CXUnaryOperatorKind

Adds 2 new functions to the C libclang api for retrieving operator
kinds for binary and unary operators from cursors. Also adds 2
functions for retrieving the spelling of the new enums.

Fixes https://github.com/llvm/llvm-project/issues/29138
Differential Revision: https://reviews.llvm.org/D150910

13 months ago[RDF] Remove `constexpr` from `hash
Krzysztof Parzyszek [Fri, 9 Jun 2023 13:52:39 +0000 (06:52 -0700)]
[RDF] Remove `constexpr` from `hash

13 months agoRemove unnecessary metadata check in test
Akira Hatanaka [Fri, 9 Jun 2023 13:41:22 +0000 (06:41 -0700)]
Remove unnecessary metadata check in test

13 months ago[SLP] Update X86/schedule_budget.ll test case to show budget impact
Bjorn Pettersson [Fri, 9 Jun 2023 12:52:43 +0000 (14:52 +0200)]
[SLP] Update X86/schedule_budget.ll test case to show budget impact

The comments and the checks in
  test/Transforms/SLPVectorizer/X86/schedule_budget.ll
did not match. After commit 352c46e70716061e99 the vectorization
has happened also with the reduced budget.

This patch is supposed to restore the original intention with the
test case (the one described in the comments). We want to see
that a restricted budget may reduce the amount of vectorization (i.e.
verifying that the -slp-schedule-budget option makes a difference),
while a higher budget still result in vectorization.

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

13 months ago[LoadStoreVectorizer] Only upgrade align for alloca
Bjorn Pettersson [Wed, 7 Jun 2023 15:44:37 +0000 (17:44 +0200)]
[LoadStoreVectorizer] Only upgrade align for alloca

In commit 2be0abb7fe72ed453 (D149893) the load store vectorized was
reimplemented. One thing that can happen with the new LSV is that
it can increase the align of alloca and global objects. However,
the code comments indicate that the intention only was to increase
alignment of alloca.
Now we will use stripPointerCasts to analyse if the load/store really
is accessing an alloca (same as getOrEnforceKnownAlignment is using).
And then we only try to change the align if we find an alloca
instruction. This way the code will match better with code comments,
and we won't change alignment of non-stack variables to use the
"StackAdjustedAlignment".

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

13 months ago[BOLT][NFCI] Use StringRef.split in launchPerfProcess
Amir Ayupov [Fri, 9 Jun 2023 13:23:46 +0000 (06:23 -0700)]
[BOLT][NFCI] Use StringRef.split in launchPerfProcess

Use StringRef method instead of reimplementing the splitting.
Incidentally, it also fixes the duplicate printing of the command arguments:
```
PERF2BOLT: spawning perf job to read branch events
Launching perf: /usr/bin/perf script^@-F^@pid,ip,brstack -F^@pid,ip,brstack pid,ip,brstack -f -i
PERF2BOLT: spawning perf job to read mem events
Launching perf: /usr/bin/perf script^@-F^@pid,event,addr,ip -F^@pid,event,addr,ip pid,event,addr,ip -f -i
PERF2BOLT: spawning perf job to read process events
Launching perf: /usr/bin/perf script^@--show-mmap-events --show-mmap-events -f -i
PERF2BOLT: spawning perf job to read task events
Launching perf: /usr/bin/perf script^@--show-task-events --show-task-events -f -i
```

Fixes it to:
```
PERF2BOLT: spawning perf job to read branch events
Launching perf: /usr/bin/perf script -F pid,ip,brstack -f -i
PERF2BOLT: spawning perf job to read mem events
Launching perf: /usr/bin/perf script -F pid,event,addr,ip -f -i
PERF2BOLT: spawning perf job to read process events
Launching perf: /usr/bin/perf script --show-mmap-events -f -i
PERF2BOLT: spawning perf job to read task events
Launching perf: /usr/bin/perf script --show-task-events -f -i
```

Reviewed By: #bolt, rafauler

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

13 months ago[Metadata] Fix `addAnnotationMetadata` when appending a string tuple to an existing...
Zain Jaffal [Fri, 9 Jun 2023 13:20:17 +0000 (14:20 +0100)]
[Metadata] Fix `addAnnotationMetadata` when appending a string tuple to an existing MDTuple.

Currently if the MD_Annotation node containd a string node when we add a
string tuple node the string will not be preserved. This change fixes
that issue.

Reviewed By: fhahn

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

13 months ago[RDF] Allow RegisterRef to contain register unit
Krzysztof Parzyszek [Thu, 1 Jun 2023 19:00:47 +0000 (12:00 -0700)]
[RDF] Allow RegisterRef to contain register unit

13 months ago[gn build] Port aee34000f9fb
LLVM GN Syncbot [Fri, 9 Jun 2023 13:02:57 +0000 (13:02 +0000)]
[gn build] Port aee34000f9fb

13 months ago[MISched][rework] Introduce and use ResourceSegments.
Francesco Petrogalli [Fri, 9 Jun 2023 11:24:21 +0000 (13:24 +0200)]
[MISched][rework] Introduce and use ResourceSegments.

Re-landing the code that was reverted because of the buildbot failure
in https://lab.llvm.org/buildbot#builders/9/builds/27319.

Original commit message
======================

The class `ResourceSegments` is used to keep track of the intervals
that represent resource usage of a list of instructions that are
being scheduled by the machine scheduler.

The collection is made of intervals that are closed on the left and
open on the right (represented by the standard notation `[a, b)`).

These collections of intervals can be extended by `add`ing new
intervals accordingly while scheduling a basic block.

Unit tests are added to verify the possible configurations of
intervals, and the relative possibility of scheduling a new
instruction in these configurations. Specifically, the methods
`getFirstAvailableAtFromBottom` and `getFirstAvailableAtFromTop` are
tested to make sure that both bottom-up and top-down scheduling work
when tracking resource usage across the basic block with
`ResourceSegments`.

Note that the scheduler tracks resource usage with two methods:

1. counters (via `std::vector<unsigned> ReservedCycles;`);

2. intervals (via `std::map<unsigned, ResourceSegments> ReservedResourceSegments;`).

This patch can be considered a NFC test for existing scheduling models
because the tracking system that uses intervals is turned off by
default (field `bit EnableIntervals = false;` in the tablegen class
`SchedMachineModel`).

Reviewed By: andreadb

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

13 months ago[Scalarizer] Scalarize freeze instruction
Jay Foad [Fri, 9 Jun 2023 11:10:02 +0000 (12:10 +0100)]
[Scalarizer] Scalarize freeze instruction

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

13 months ago[Scalarizer] Precommit tests for freeze instruction
Jay Foad [Fri, 9 Jun 2023 11:08:47 +0000 (12:08 +0100)]
[Scalarizer] Precommit tests for freeze instruction

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

13 months ago[HIP] Instruct lld to go through all archives
Siu Chi Chan [Tue, 6 Jun 2023 19:48:26 +0000 (15:48 -0400)]
[HIP] Instruct lld to go through all archives

Add the --whole-archive flag when linking HIP programs to instruct lld
to go through every archive library to link in all the kernel functions
(entry pointers to the GPU program); otherwise, lld may skip some
library files if there are no more symbols that need to be resolved.

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

Change-Id: I084d3d606f9cee646f9adc65f4b648c9bcb252e6

13 months agoFix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
Marco Elver [Fri, 9 Jun 2023 12:30:02 +0000 (14:30 +0200)]
Fix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"

Build bots have been failing with:

/usr/bin/ld: read-only segment has dynamic relocations

Remove support for interceptor trampoline on s390, and revert new
implementation of __tls_get_offset.

13 months ago[GlobalIsel][X86] Update legalization of G_PTR_ADD
Simon Pilgrim [Fri, 9 Jun 2023 12:14:04 +0000 (13:14 +0100)]
[GlobalIsel][X86] Update legalization of G_PTR_ADD

Replace the legacy legalizer versions

Add test coverage for 32-bit targets and non-constant ptr offsets

13 months ago[MCP] Do not remove redundant copy for COPY from undef
pvanhout [Fri, 9 Jun 2023 07:28:17 +0000 (09:28 +0200)]
[MCP] Do not remove redundant copy for COPY from undef

I don't think we can safely remove the second COPY as redundant in such cases.
The first COPY (which has undef src) may be lowered to a KILL instruction instead, resulting in no COPY being emitted at all.

Testcase is X86 so it's in the same place as other testcases for this function, but this was initially spotted on AMDGPU with the following:
```
 renamable $vgpr24 = PRED_COPY undef renamable $vgpr25, implicit $exec
 renamable $vgpr24 = PRED_COPY killed renamable $vgpr25, implicit $exec
```
The second COPY waas removed as redundant, and the first one was lowered to a KILL (= removed too), causing $vgpr24 to not have $vgpr25's value.

Fixes SWDEV-401507

Reviewed By: arsenm

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

13 months agoReland [AMDGPU] New PAL metadata updates to ps_extra_lds_size and float_mode
David Stuttard [Thu, 11 May 2023 13:09:38 +0000 (14:09 +0100)]
Reland [AMDGPU] New PAL metadata updates to ps_extra_lds_size and float_mode

New metadata format contains full calculation of field contents for
ps_extra_lds_size (vs old format where the value in RSRC register is used by PAL
to calculate the value required).

Also stop updating float_mode and rely on front end settings for this field.

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

13 months ago[gn build] Port f1d1ca3d7434
LLVM GN Syncbot [Fri, 9 Jun 2023 11:24:06 +0000 (11:24 +0000)]
[gn build] Port f1d1ca3d7434

13 months agoRevert "[MISched] Introduce and use ResourceSegments."
Francesco Petrogalli [Fri, 9 Jun 2023 11:21:52 +0000 (13:21 +0200)]
Revert "[MISched] Introduce and use ResourceSegments."

Reverted because it produces the following builbot failure at https://lab.llvm.org/buildbot#builders/9/builds/27319:

/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/CodeGen/SchedBoundary.cpp: In member function ‘virtual void ResourceSegments_getFirstAvailableAtFromBottom_empty_Test::TestBody()’:
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/CodeGen/SchedBoundary.cpp:395:31: error: call of overloaded ‘ResourceSegments(<brace-enclosed initializer list>)’ is ambiguous
 395 |   auto X = ResourceSegments({});
     |                               ^

This reverts commit dc312f0331309692e8d6e06e93b3492b6a40989f.

13 months ago[gn build] Port dc312f033130
LLVM GN Syncbot [Fri, 9 Jun 2023 11:17:35 +0000 (11:17 +0000)]
[gn build] Port dc312f033130

13 months agoFix "[compiler-rt] Introduce asm macros for interceptor trampolines"
Marco Elver [Fri, 9 Jun 2023 11:07:41 +0000 (13:07 +0200)]
Fix "[compiler-rt] Introduce asm macros for interceptor trampolines"

Add missing ASM_INTERCEPTOR_TRAMPOLINE(setjmp).

13 months ago[MISched] Introduce and use ResourceSegments.
Francesco Petrogalli [Fri, 9 Jun 2023 07:06:48 +0000 (09:06 +0200)]
[MISched] Introduce and use ResourceSegments.

The class `ResourceSegments` is used to keep track of the intervals
that represent resource usage of a list of instructions that are
being scheduled by the machine scheduler.

The collection is made of intervals that are closed on the left and
open on the right (represented by the standard notation `[a, b)`).

These collections of intervals can be extended by `add`ing new
intervals accordingly while scheduling a basic block.

Unit tests are added to verify the possible configurations of
intervals, and the relative possibility of scheduling a new
instruction in these configurations. Specifically, the methods
`getFirstAvailableAtFromBottom` and `getFirstAvailableAtFromTop` are
tested to make sure that both bottom-up and top-down scheduling work
when tracking resource usage across the basic block with
`ResourceSegments`.

Note that the scheduler tracks resource usage with two methods:

1. counters (via `std::vector<unsigned> ReservedCycles;`);

2. intervals (via `std::map<unsigned, ResourceSegments> ReservedResourceSegments;`).

This patch can be considered a NFC test for existing scheduling models
because the tracking system that uses intervals is turned off by
default (field `bit EnableIntervals = false;` in the tablegen class
`SchedMachineModel`).

Reviewed By: andreadb

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

13 months agoInherit SliceOptions constructor in BackwardSliceOptions.
Johannes Reifferscheid [Fri, 9 Jun 2023 10:55:08 +0000 (12:55 +0200)]
Inherit SliceOptions constructor in BackwardSliceOptions.

Reviewed By: csigg

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

13 months ago[mlir][tensor] Add pattern to rewrite tensor.generate as a constant
Matthias Springer [Fri, 9 Jun 2023 10:37:46 +0000 (12:37 +0200)]
[mlir][tensor] Add pattern to rewrite tensor.generate as a constant

Only ops with a static tensor type and a constant yield value are rewritten.

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

13 months ago[GlobalIsel][X86] Move intrinsics getActionDefinitionsBuilder defs above remaining...
Simon Pilgrim [Fri, 9 Jun 2023 10:28:08 +0000 (11:28 +0100)]
[GlobalIsel][X86] Move intrinsics getActionDefinitionsBuilder defs above remaining legacy handling

13 months agoAdd a conversion from TransitiveFilter to SliceOptions.
Johannes Reifferscheid [Fri, 9 Jun 2023 10:21:24 +0000 (12:21 +0200)]
Add a conversion from TransitiveFilter to SliceOptions.

The previous attempt at backwards compatibility was insufficient.

Reviewed By: akuegel

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

13 months ago[mlir][transform] add a check for nested consumption in ApplyEachOpTrait
Alex Zinenko [Fri, 9 Jun 2023 09:49:35 +0000 (09:49 +0000)]
[mlir][transform] add a check for nested consumption in ApplyEachOpTrait

ApplyEachOpTrait applies to payload ops associated with its operand
handle one-by-one in order. If a handle is consumed, this usually
indicates that the associated payload ops are erased or rewritten. Add a
check that we don't consume an ancestor payload operation before
consuming its descendant, as the latter is likely to be a dangling
pointer. Transform operations for which this is a legitimate behavior
(i.e., they consume the handle but don't actually erase or rewrite the
payload operation) should implement the interface directly and allow for
repeated handles.

Reviewed By: springerm

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

13 months ago[LV][AArch64] Allow (limited) interleaving for scalable vectors
Graham Hunter [Tue, 21 Mar 2023 11:48:49 +0000 (11:48 +0000)]
[LV][AArch64] Allow (limited) interleaving for scalable vectors

This patch uses the (de)interleaving intrinsics introduced in
D141924 to handle vectorization of interleaving groups with a
factor of 2 for scalable vectors.

Reviewed By: fhahn, reames

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

13 months ago[mlir][tensor] Add option to fold only tensor.empty with a single use
Matthias Springer [Fri, 9 Jun 2023 10:30:02 +0000 (12:30 +0200)]
[mlir][tensor] Add option to fold only tensor.empty with a single use

This is useful for transformations such as bufferization, which is looking for tensor.extract_slice/insert_slice pairs.

Also fix the documentation of the corresponding tranform op.

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

13 months ago[InstCombine] Replace phi operands in successors of unreachable block
Nikita Popov [Thu, 1 Jun 2023 14:14:27 +0000 (16:14 +0200)]
[InstCombine] Replace phi operands in successors of unreachable block

Set these operands to poison, which might allow folding the phi node,
or reduce the use count of an instruction.

13 months agoFix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
Marco Elver [Fri, 9 Jun 2023 10:12:30 +0000 (12:12 +0200)]
Fix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"

Fix inline asm trampoline type. Some architectures will complain:

<inline asm>:8:41: error: expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '%<type>' or "<type>"
    8 | .type  __interceptor_trampoline_malloc, @function

Just use %function instead, which is what is also used in
sanitizer_asm.h

13 months ago[bazel] format bazel files NFC
Mikhail Goncharov [Fri, 9 Jun 2023 10:12:43 +0000 (12:12 +0200)]
[bazel] format bazel files NFC

13 months ago[mlir][transform] Simplify TrackingListener test case
Matthias Springer [Fri, 9 Jun 2023 09:57:47 +0000 (11:57 +0200)]
[mlir][transform] Simplify TrackingListener test case

Use the default TrackingListener. No need to set up a derived listener just for the test case. This revision is in preparation of a future change that adds a TrackingRewriter infrastructure.

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

13 months ago[JITLink][AArch64] Implement R_AARCH64_ADR_PREL_LO21
Job Noorman [Fri, 9 Jun 2023 09:57:49 +0000 (11:57 +0200)]
[JITLink][AArch64] Implement R_AARCH64_ADR_PREL_LO21

This relocation is used for the 21-bit immediate in ADR instructions.

Reviewed By: lhames

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

13 months ago[mlir][transform][NFC] Move TrackingListener to TransformInterfaces.h
Matthias Springer [Fri, 9 Jun 2023 09:41:55 +0000 (11:41 +0200)]
[mlir][transform][NFC] Move TrackingListener to TransformInterfaces.h

A TransformRewriter (with attached TrackingListener) will be added to an interface method in a subsequent revision.

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

13 months ago[SCEV] Remove -verify-scev-maps flag
Nikita Popov [Fri, 9 Jun 2023 09:49:09 +0000 (11:49 +0200)]
[SCEV] Remove -verify-scev-maps flag

This is now checked as part of the usual SCEV verification. There
is little value in checking this on each lookup.

These two maps are strictly synchronized nowadays, which was not
the case historically.

13 months agoAdd a temporary alias for TransitiveFilter.
Johannes Reifferscheid [Fri, 9 Jun 2023 09:43:04 +0000 (11:43 +0200)]
Add a temporary alias for TransitiveFilter.

This type was removed in D151520, but downstream dependencies use it. By
introducing a temporary allias, we can give these dependencies a chance to
update their uses of the type and give them a chance to migrate without
breakages.

Reviewed By: csigg

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

13 months ago[mlir][transform] TrackingListener: Distinguish between failure and "should be dropped"
Matthias Springer [Fri, 9 Jun 2023 09:34:32 +0000 (11:34 +0200)]
[mlir][transform] TrackingListener: Distinguish between failure and "should be dropped"

When looking for replacement ops (`findReplacementOp`) distinguish between "no replacement could be found" and "this op should be dropped from the mapping". The latter case will be utilized in a subsequent revision when a payload op is mapped to a consumed handle.

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

13 months ago[GlobalIsel][X86] Add 32-bit test coverage to zero count tests
Simon Pilgrim [Fri, 9 Jun 2023 09:36:22 +0000 (10:36 +0100)]
[GlobalIsel][X86] Add 32-bit test coverage to zero count tests

This shows a current problem with G_CTTZ_ZERO_UNDEF result legalizations

13 months ago[GlobalIsel][X86] legalize-select.mir - add x86-64 test coverage
Simon Pilgrim [Fri, 9 Jun 2023 09:30:09 +0000 (10:30 +0100)]
[GlobalIsel][X86] legalize-select.mir - add x86-64 test coverage

13 months ago[GlobalIsel][X86] Update legalization of G_FPEXT/G_FPTRUNC
Simon Pilgrim [Thu, 8 Jun 2023 13:01:12 +0000 (14:01 +0100)]
[GlobalIsel][X86] Update legalization of G_FPEXT/G_FPTRUNC

Replace the legacy legalizer versions

13 months ago[libc][NFC] Simplify LibcTest and trim down string allocations
Guillaume Chatelet [Fri, 9 Jun 2023 09:27:36 +0000 (09:27 +0000)]
[libc][NFC] Simplify LibcTest and trim down string allocations

This is a bit of cleanup before working on logging via stream operator (i.e., `EXPECT_XXX() << ...`).

Reviewed By: sivachandra

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

13 months ago[InstCombine] Add tests for phi nodes with dead edges (NFC)
Nikita Popov [Fri, 9 Jun 2023 09:34:11 +0000 (11:34 +0200)]
[InstCombine] Add tests for phi nodes with dead edges (NFC)

13 months ago[mlir][transform] Extract getConsumedHandleOpOperands helper function
Matthias Springer [Fri, 9 Jun 2023 09:25:44 +0000 (11:25 +0200)]
[mlir][transform] Extract getConsumedHandleOpOperands helper function

This function is extracted from `TransformState::applyTransform`.

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

13 months ago[compiler-rt] Allow 3 simultaneous interceptors on Linux
Marco Elver [Tue, 30 May 2023 17:27:59 +0000 (19:27 +0200)]
[compiler-rt] Allow 3 simultaneous interceptors on Linux

Rework Linux (and *BSD) interceptors to allow for up to 3 (2 for *BSD)
simultaneous interceptors. See code comments for details.

The main motivation is to support new sampling sanitizers (in the spirit
of GWP-ASan), that have to intercept few functions. Unfortunately, the
reality is that there are user interceptors that exist in the wild.

To support foreign user interceptors, foreign dynamic analysis
interceptors, and compiler-rt interceptors all at the same time,
including any combination of them, this change enables up to 3
interceptors on Linux (2 on *BSD).

v2:
* Revert to to the simpler "weak wrapper -(alias)-> __interceptor"
  scheme on architectures that cannot implement a trampoline efficiently
  due to complexities of resolving a preemptible symbol (PowerPC64
  ELFv2 global entry, and i386 PIC).
* Avoid duplicate intercepted functions in gen_dynamic_list.py, due to
  matching __interceptor_X and ___interceptor_X.
* Fix s390 __tls_get_offset.

Reviewed By: dvyukov, MaskRay, vitalybuka

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

13 months ago[Clang][CUDA] Disable diagnostics for neon attrs for GPU-side CUDA compilation
Alexander Shaposhnikov [Fri, 9 Jun 2023 09:26:33 +0000 (09:26 +0000)]
[Clang][CUDA] Disable diagnostics for neon attrs for GPU-side CUDA compilation

Disable diagnostics for neon attributes for GPU-side CUDA compilation.

Test plan: ninja check-all

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

13 months ago[NFC] remove duplciated unittests for modules
Chuanqi Xu [Fri, 9 Jun 2023 09:18:35 +0000 (17:18 +0800)]
[NFC] remove duplciated unittests for modules

There was an overlook to duplicate the unittests for modules. This patch
removes one of this duplication.

13 months ago[compiler-rt] Reformat interception macros
Marco Elver [Fri, 9 Jun 2023 08:41:53 +0000 (10:41 +0200)]
[compiler-rt] Reformat interception macros

Reformat interception macros to be more readable.

NFC.

13 months ago[clang] set python3 as required build dependency
Petr Hosek [Fri, 9 Jun 2023 07:51:40 +0000 (07:51 +0000)]
[clang] set python3 as required build dependency

The required HTMLLogger include file needs python3 to run
resource_bundle.py to bundle all the html/css/js resources. However, if
user sets -DLLVM_INCLUDE_TESTS=OFF, CMake will not find python3 and the
resource bundler will never be executed. This patch set the python3 as a
required build dependency to fix this problem.

Patch By: Avimitin

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

13 months ago[Clang] Remove typed pointer consistency assertions (NFC)
Nikita Popov [Fri, 9 Jun 2023 07:32:27 +0000 (09:32 +0200)]
[Clang] Remove typed pointer consistency assertions (NFC)

These are no-ops with opaque pointers.

13 months ago[TypePromotion] Don't treat bitcast as a Source
David Green [Fri, 9 Jun 2023 07:32:26 +0000 (08:32 +0100)]
[TypePromotion] Don't treat bitcast as a Source

This removes BitCasts from isSource in Type Promotion, as I don't believe they
need to be treated as Sources. They will usually be from floats or hoisted
constants, where constants will be handled already.

This fixes #62513, but didn't otherwise cause any differences in the tests I
ran.

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

13 months ago[AMDGPU] Port no-hsa-graphic-shaders.ll to code object V4
pvanhout [Thu, 8 Jun 2023 10:35:21 +0000 (12:35 +0200)]
[AMDGPU] Port no-hsa-graphic-shaders.ll to code object V4

Split from D146023

Reviewed By: arsenm

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

13 months ago[SelectionDAG] Do not salvage with vector node
Phoebe Wang [Fri, 9 Jun 2023 06:33:30 +0000 (14:33 +0800)]
[SelectionDAG] Do not salvage with vector node

rG2eb7cbf987f21 added this code, which results in crash for vector
nodes. This patch solves it by skipping for the vector nodes.

Thanks Steve for helping reducing the test case.

Co-authored-by: Steve Merritt <steve.merritt@intel.com>
Reviewed By: goldstein.w.n

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

13 months ago[SimpleLoopUnswitch] Verify LoopInfo in turnGuardIntoBranch under a flag
Dmitry Makogon [Fri, 9 Jun 2023 06:26:24 +0000 (13:26 +0700)]
[SimpleLoopUnswitch] Verify LoopInfo in turnGuardIntoBranch under a flag

A follow-up for 64397d8. Only do verification if VerifyLoopInfo is
set.

13 months ago[mlir] mark test requiring asserts as such
Alex Zinenko [Fri, 9 Jun 2023 06:29:39 +0000 (06:29 +0000)]
[mlir] mark test requiring asserts as such

13 months ago[AMDGPU] Iterative scan implementation for atomic optimizer.
Pravin Jagtap [Fri, 9 Jun 2023 05:08:44 +0000 (01:08 -0400)]
[AMDGPU] Iterative scan implementation for atomic optimizer.

This patch provides an alternative implementation to DPP for Scan Computations.

An alternative implementation iterates over all active lanes of Wavefront
using llvm.cttz and performs the following steps:
    1.  Read the value that needs to be atomically incremented using
        llvm.amdgcn.readlane intrinsic
    2.  Accumulate the result.
    3.  Update the scan result using llvm.amdgcn.writelane intrinsic
        if intermediate scan results are needed later in the kernel.

Reviewed By: arsenm, cdevadas

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

13 months ago[RISCV] Use computeVLMax and getVScale to simplify code. NFC
Craig Topper [Fri, 9 Jun 2023 05:05:20 +0000 (22:05 -0700)]
[RISCV] Use computeVLMax and getVScale to simplify code. NFC

13 months ago[GlobalISel] Implement some binary reassociations, G_ADD for now
Amara Emerson [Sat, 3 Jun 2023 23:12:48 +0000 (16:12 -0700)]
[GlobalISel] Implement some binary reassociations, G_ADD for now

- (op (op X, C1), C2) -> (op X, (op C1, C2))
- (op (op X, C1), Y) -> (op (op X, Y), C1)

Some code duplication with the G_PTR_ADD reassociations unfortunately but no
easy way to avoid it that I can see.

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

13 months ago[gn build] Port 60eb1da31555
LLVM GN Syncbot [Fri, 9 Jun 2023 03:44:33 +0000 (03:44 +0000)]
[gn build] Port 60eb1da31555

13 months ago[Modules] [Sema] Don't try to getAcceptableDecls during the iteration of noload_lookups
Chuanqi Xu [Fri, 9 Jun 2023 03:21:29 +0000 (11:21 +0800)]
[Modules] [Sema] Don't try to getAcceptableDecls during the iteration of noload_lookups

I found this during the support of modules for clangd. The reason for
the issue is that the iterator returned by noload_lookups is fast-fail
after the lookup table changes by the design of llvm::DenseMap. And
originally the lookup will try to use getAcceptableDecl to filter the
invisible decls. The key point here is that the function
"getAcceptableDecl" wouldn't stop after it find the specific decl is
invisble. It will continue to visit its redecls to find a visible one.
However, such process involves loading decls from external sources,
which results the invalidation.

Note that the use of "noload_lookups" is rare. It is only used in tools
like FixTypos and CodeCompletions. So it is completely fine for the
tranditional compiler. This is the reason why I can't reproduce it by a
lit test.

13 months ago[RISCV][NFC] Remove classes/multiclasses for SEW-aware instructions
wangpc [Fri, 9 Jun 2023 03:01:39 +0000 (11:01 +0800)]
[RISCV][NFC] Remove classes/multiclasses for SEW-aware instructions

Instead, we add an argument `isSEWAware` to indicate that the
instruction is SEW-aware. Actually, the only difference is the
name of pseudo instructions.

And we remove postfix `_E` for all classes/multiclasses and remove
argument `sew` since it can be calculated from `log2sew`.

Reviewed By: craig.topper

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

13 months ago[RISCV][NFC] Replace log2 with !logtwo
wangpc [Fri, 9 Jun 2023 02:55:59 +0000 (10:55 +0800)]
[RISCV][NFC] Replace log2 with !logtwo

`!logtwo` was added in D134068.

Reviewed By: craig.topper

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

13 months ago[NFC][COFF] Split WinCOFFObjectWriter to WinCOFFWriter
Haohai Wen [Fri, 9 Jun 2023 01:36:25 +0000 (09:36 +0800)]
[NFC][COFF] Split WinCOFFObjectWriter to WinCOFFWriter

We'd like to support -gsplit-dwarf for Windows COFF. It requires to
write Dwo and NonDwo sections to different output streams.The original
implementation is not designed to do that and there can be only one
MCObjectWriter. This patch split WinCOFFObjectWriter to WinCOFFWriter so
that:
  1. WinCOFFObjectWriter can create multiple WinCOFFWriter.
  2. Each WinCOFFWriter can separately collect sections it is interested.
  3. Each WinCOFFWriter can write to it's own output stream.

Reviewed By: skan

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

13 months ago[X86][BF16] Split vNbf16 vectors according to vNf16
Phoebe Wang [Fri, 9 Jun 2023 01:03:58 +0000 (09:03 +0800)]
[X86][BF16] Split vNbf16 vectors according to vNf16

Fixes #63017

Reviewed By: RKSimon

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

13 months ago[X86][BF16] Share FP16 vector ABI with BF16
Phoebe Wang [Fri, 9 Jun 2023 01:03:54 +0000 (09:03 +0800)]
[X86][BF16] Share FP16 vector ABI with BF16

The ABI of BF16 is identical to FP16 rather than i16.

Fixes #62997

Reviewed By: RKSimon

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

13 months ago[InstrProf][compiler-rt] Fix counter section alignment issue
Ellis Hoag [Thu, 8 Jun 2023 22:31:07 +0000 (15:31 -0700)]
[InstrProf][compiler-rt] Fix counter section alignment issue

I recently discovered that `.profraw` headers are expected to be 8 byte
aligned.
https://github.com/llvm/llvm-project/blob/643ba926c1f618401c86dc37e659df795db2e1a0/llvm/lib/ProfileData/InstrProfReader.cpp#L503-L506

When function entry coverage mode is used, function counters are single
bytes, so it is likely that the size of the counters section is not 8
byte aligned. We can add padding after the counters section to guarantee
this.

Reviewed By: kyulee, gulfem

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

13 months ago[WebAssembly] Error out on invalid personality functions
Heejin Ahn [Sat, 3 Jun 2023 09:28:25 +0000 (02:28 -0700)]
[WebAssembly] Error out on invalid personality functions

Without explicitly checking and erroring out, an invalid personality
function, which is not `__gxx_wasm_personality_v0`, caused
a segmentation fault down the line because `WasmEHFuncInfo` was not
created. This explicitly checks the validity of personality functions in
functions with EH pads and errors out explicitly with a helpful error
message. This also adds some more assertions to ensure `WasmEHFuncInfo`
is correctly created and non-null.

Invalid personality functions wouldn't be generated by our Clang, but
can be present in handwritten ll files, and more often, in files
transformed by passes like `metarenamer`, which is often used with
`bugpoint` to simplify names in `bugpoint`-reduced files.

Reviewed By: dschuff

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

13 months ago[WebAssembly] Undef invalid DBG_VALUEs after RegColoring
Heejin Ahn [Sat, 20 May 2023 00:55:57 +0000 (17:55 -0700)]
[WebAssembly] Undef invalid DBG_VALUEs after RegColoring

After register coalescing, some `DBG_VALUE`s can have incorrect info.
For example, if a `DBG_VALUE` has a register operand `%0`, but it
resides in a live range of `%1`, it has incorrect info after `%0` and
`%1` are coalesced. See the comments for more details.

This does not have meaningful changes on our variable debug info
coverage or compilation time, which is good news.

Reviewed By: dschuff

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

13 months ago[libc][NFC] fix constants not marked constexpr
Michael Jones [Thu, 8 Jun 2023 23:36:12 +0000 (16:36 -0700)]
[libc][NFC] fix constants not marked constexpr

The constants in the ryu constant tables were not marked constexpr,
only static const. This caused problems when compiling with GCC.

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

13 months ago[libc][NFC] land long double table for printf
Michael Jones [Thu, 8 Jun 2023 21:25:22 +0000 (14:25 -0700)]
[libc][NFC] land long double table for printf

The Mega Table that printf uses for long doubles with some flags is too
large for the linters, and so has been split out from the main patch.
The main patch: https://reviews.llvm.org/D150399

Reviewed By: sivachandra

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

13 months ago[C API] Add getters and setters for NUW, NSW, and Exact
Justin Bogner [Thu, 8 Jun 2023 22:59:38 +0000 (15:59 -0700)]
[C API] Add getters and setters for NUW, NSW, and Exact

This partially addresses Bug 42692; see discussion there.

Adds C API getters and setters for the NUW, NSW, and Exact flags on various
instructions.

Patch by Craig Disselkoen. Thanks!

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

13 months agoRevert "[Sanitizers][Darwin] In DlAddrSymbolizer, return only the module file name...
usama hameed [Thu, 8 Jun 2023 23:02:54 +0000 (16:02 -0700)]
Revert "[Sanitizers][Darwin] In DlAddrSymbolizer, return only the module file name instead of the comlpete module path during symbolication."

The commit broke asan_symbolize.py script on Darwin which depended on
using the complete module path to symolize crash traces offline.

This reverts commit f6ea869f7c043c70722b8db6be94d9ad4cc9eb92.

rdar://110487521

13 months ago[libc] Disable uint test on NVPTX GPUs
Joseph Huber [Thu, 8 Jun 2023 22:53:11 +0000 (17:53 -0500)]
[libc] Disable uint test on NVPTX GPUs

This test started failing on Nvidia, we need to disable it to keep the
bot green until we can investigate the root cause.

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

13 months ago[lldb][NFCI] Remove use of ConstString from OptionValueProperties
Alex Langford [Mon, 5 Jun 2023 23:50:24 +0000 (16:50 -0700)]
[lldb][NFCI] Remove use of ConstString from OptionValueProperties

In the interest of keeping the ConstString StringPool small, this patch
aims to remove the use of ConstString from OptionValueProperties.

We can maintain quick lookups by using an llvm::StringMap to find the
correct index by name.

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

13 months ago[lldb][NFCI] Refactor TypeSystemClang::GetBasicTypeEnumeration
Alex Langford [Tue, 6 Jun 2023 22:38:52 +0000 (15:38 -0700)]
[lldb][NFCI] Refactor TypeSystemClang::GetBasicTypeEnumeration

`TypeSystemClang::GetBasicTypeEnumeration(ConstString)` builds up a
giant `UniqueCStringMap<lldb::BasicType>` which is effectively a vector whose elements
are (ConstString, lldb::BasicType). Once sorted, we get to have fairly
quick lookups (O(log n) on average). This is fine, but we can do better
on average with an llvm::StringMap.

This also allows us to simplify the initialization code for the lookup,
no more `once_flag`!

Additionally, I removed unused declarations of related functions from
CompilerType and TypeSystemClang

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

13 months ago[lldb][NFCI] Remove use of ConstString from OptionValueLanguage
Alex Langford [Tue, 6 Jun 2023 21:38:08 +0000 (14:38 -0700)]
[lldb][NFCI] Remove use of ConstString from OptionValueLanguage

ConstString is simply not needed here.

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

13 months ago[BOLT] stale profile matching [part 2 out of 2]
spupyrev [Wed, 22 Mar 2023 21:18:03 +0000 (14:18 -0700)]
[BOLT] stale profile matching [part 2 out of 2]

This is a first "serious" version of stale profile matching in BOLT. This diff
extends the hash computation for basic blocks so that we can apply a fuzzy
hash-based matching. The idea is to compute several "versions" of a hash value
for a basic block. A loose version of a hash (computed by ignoring instruction
operands) allows to match blocks in functions whose content has been changed,
while stricter hash values (considering instruction opcodes with operands and
even based on hashes of block's successors/predecessors) allow to resolve
collisions. In order to save space and build time, individual hash components
are blended into a single uint64_t.
There are likely numerous ways of improving hash computation but already this
simple variant provides significant perf benefits.

**Perf testing** on the clang binary: collecting data on clang-10 and using it
to optimize clang-11 (with ~1 year of commits in between). Next, we compare
- //stale_clang// (clang-11 optimized with profile collected on clang-10 with **infer-stale-profile=0**)
- //opt_clang// (clang-11 optimized with profile collected on clang-11)
- //infer_clang// (clang-11 optimized with profile collected on clang-10 with **infer-stale-profile=1**)

`LTO-only` mode:
//stale_clang// vs //opt_clang//: task-clock [delta(%): 9.4252 ± 1.6582, p-value: 0.000002]
(That is, there is a ~9.5% perf regression)
//infer_clang// vs //opt_clang//: task-clock [delta(%): 2.1834 ± 1.8158, p-value: 0.040702]
(That is, the regression is reduced to ~2%)
Related BOLT logs:
```
BOLT-INFO: identified 2114 (18.61%) stale functions responsible for 30.96% samples
BOLT-INFO: inferred profile for 2101 (18.52% of all profiled) functions responsible for 30.95% samples
```

`LTO+AutoFDO` mode:
//stale_clang// vs //opt_clang//: task-clock [delta(%): 19.1293 ± 1.4131, p-value: 0.000002]
//infer_clang// vs //opt_clang//: task-clock [delta(%): 7.4364 ± 1.3343, p-value: 0.000002]
Related BOLT logs:
```
BOLT-INFO: identified 5452 (50.27%) stale functions responsible for 85.34% samples
BOLT-INFO: inferred profile for 5442 (50.23% of all profiled) functions responsible for 85.33% samples
```

Reviewed By: Amir

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

13 months agoRevert "Improve WebAssembly vector bitmask, mask reduction, and extending"
Thomas Lively [Thu, 8 Jun 2023 21:36:29 +0000 (14:36 -0700)]
Revert "Improve WebAssembly vector bitmask, mask reduction, and extending"

This reverts commit 8392bf6000ad039bd0e55383d40a05ddf7b4af13.

The commit missed some edge cases that led to crashes. Reverting to resolve
downstream breakage while a fix is pending.

13 months ago[libc] disable printf Lf tests for float128 plats
Michael Jones [Thu, 8 Jun 2023 21:33:57 +0000 (14:33 -0700)]
[libc] disable printf Lf tests for float128 plats

The results for the %Lf tests were calculated on 80 bit long double
systems, meaning the results are not necessarily accurate for float128
systems. In future these will be fixed, but for the moment I'm just
turning them off.

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

13 months ago[libc] add options to printf decimal floats
Michael Jones [Tue, 28 Mar 2023 18:18:08 +0000 (11:18 -0700)]
[libc] add options to printf decimal floats

This patch adds three options for printf decimal long doubles, and these
can also apply to doubles.

1. Use a giant table which is fast and accurate, but takes up ~5MB).
2. Use dyadic floats for approximations, which only gives ~50 digits of
   accuracy but is very fast.
3. Use large integers for approximations, which is accurate but very
   slow.

Reviewed By: sivachandra, lntue

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

13 months ago[Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range
Shafik Yaghmour [Thu, 8 Jun 2023 20:50:42 +0000 (13:50 -0700)]
[Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

If we provide too large a value for the alignment attribute
APInt::getZExtValue() will assert. This PR adjusts existing check to catch
this case and provide a diagnostic.

This fixes: https://github.com/llvm/llvm-project/issues/50534

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

13 months agoAMDGPU: Fix regressions in integer mad matching
Matt Arsenault [Mon, 5 Jun 2023 13:25:25 +0000 (09:25 -0400)]
AMDGPU: Fix regressions in integer mad matching

Undo the canonicalize done in
0cfc6510323fbb5a56a5de23cbc65f7cc30fd34c. Restores some regressed
matching of integer mad. The selection patterns fo the actual mads
don't seem to be properly commuting, so some of the commuted cases are
still missed.

Fixes: SWDEV-363009