platform/upstream/llvm.git
19 months ago[clang][dataflow] Convert nonnull pointer parameter to a reference.
Yitzhak Mandelbaum [Fri, 10 Feb 2023 15:02:44 +0000 (15:02 +0000)]
[clang][dataflow] Convert nonnull pointer parameter to a reference.

The parameter in question belongs to a function that is only called once. This patch updates the API to use a reference and changes the caller accordingly.

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

19 months agoRevert "[mlgo] Fix test after D143624"
Mircea Trofin [Fri, 10 Feb 2023 15:46:47 +0000 (07:46 -0800)]
Revert "[mlgo] Fix test after D143624"

This reverts commit dc4c3cfd78c01bef427fca0431fe66a6c6de7c35.

Reverting because D143624 has been reverted.

19 months ago[libc] Move likely/unlikely to the optimization header
Guillaume Chatelet [Fri, 10 Feb 2023 15:15:10 +0000 (15:15 +0000)]
[libc] Move likely/unlikely to the optimization header

19 months ago[InstCombine] propagate FMF in exp2->ldexp fold
Sanjay Patel [Fri, 10 Feb 2023 14:59:33 +0000 (09:59 -0500)]
[InstCombine] propagate FMF in exp2->ldexp fold

19 months ago[InstCombine] copy tail markings in exp2->ldexp fold
Sanjay Patel [Fri, 10 Feb 2023 14:54:22 +0000 (09:54 -0500)]
[InstCombine] copy tail markings in exp2->ldexp fold

19 months ago[InstCombine] add 'tail' to exp2 call in test; NFC
Sanjay Patel [Fri, 10 Feb 2023 14:51:27 +0000 (09:51 -0500)]
[InstCombine] add 'tail' to exp2 call in test; NFC

Tail markings are not propagated if the transform succeeds.

19 months agoRevert "Inlining: Run the legacy AlwaysInliner before the regular inliner."
David Green [Fri, 10 Feb 2023 15:01:49 +0000 (15:01 +0000)]
Revert "Inlining: Run the legacy AlwaysInliner before the regular inliner."

This seems to cause large regressions in existing code, as much as 75% slower
(4x the time taken). Small always inline functions seem to be used a lot in the
cmsis-dsp library.

I would add a phase ordering test to show the problems, but one already exists!
The llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll was just changed by
removing alwaysinline to hide the problems that existed.

This reverts commit cae033dcf227aeecf58fca5af6fc7fde1fd2fb4f.
This reverts commit 8e33c41e72ad42e4c27f8cbc3ad2e02b169637a1.

19 months ago[AMDGPU][MC] Generate relative relocations for allocatable (more particularly, eh_fra...
Juan Manuel MARTINEZ CAAMAÑO [Fri, 10 Feb 2023 14:05:05 +0000 (15:05 +0100)]
[AMDGPU][MC] Generate relative relocations for allocatable (more particularly, eh_frame) sections

Reviewed By: scott.linder

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

19 months ago[DebugInfo] Handle missed DW_FORM_addrx3 and DW_FORM_strx3 cases
Benjamin Maxwell [Tue, 7 Feb 2023 10:36:34 +0000 (10:36 +0000)]
[DebugInfo] Handle missed DW_FORM_addrx3 and DW_FORM_strx3 cases

This fixes a few places where the addrx3 and strx3 forms were missed.
Previously this meant if one of these forms appeared somewhere various
errors could occur. This now also adds an extra test case for the addrx3
form (which previously failed).

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

19 months ago[clangd] Move function body to out-of-line: unnamed class method incorrect moving
Denis Fatkulin [Fri, 10 Feb 2023 14:19:11 +0000 (17:19 +0300)]
[clangd] Move function body to out-of-line: unnamed class method incorrect moving

The refactoring !!Move function body to out-of-line!! produces incorrect code for methods of unnamed classes.
For this simple example
  // foo.h
  struct Foo {
    struct {
      void f^oo() {}
    } Bar;
  };

the refactoring generates code:
  // foo.cpp
  void Foo::(unnamed struct at D:\test\foo.h:2:3)foo() {}

Outplace definition for methods of unnamed classes is meaningless. The patch disables it.

Reviewed By: kadircet

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

19 months ago[mlir][llvm] Store memory op metadata using op attributes.
Tobias Gysi [Fri, 10 Feb 2023 14:22:54 +0000 (15:22 +0100)]
[mlir][llvm] Store memory op metadata using op attributes.

The revision introduces operation attributes to store tbaa metadata on
load and store operations rather than relying using dialect attributes.
At the same time, the change also ensures the provided getters and
setters instead are used instead of a string based lookup. The latter
is done for the tbaa, access groups, and alias scope attributes.

The goal of this change is to ensure the metadata attributes are only
placed on operations that have the corresponding operation attributes.
This is imported since only these operations later on translate these
attributes to LLVM IR. Dialect attributes placed on other operations
are lost during the translation.

Reviewed By: vzakhari, Dinistro

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

19 months ago[amdgpu-arch] Fix build of amdgpu-arch with CLANG_LINK_CLANG_DYLIB
Joseph Huber [Fri, 10 Feb 2023 14:22:05 +0000 (08:22 -0600)]
[amdgpu-arch] Fix build of amdgpu-arch with CLANG_LINK_CLANG_DYLIB

The function clang_target_link_libraries must only be used with real
Clang libraries; with CLANG_LINK_CLANG_DYLIB, it will instead link in
clang-cpp. We must use the standard CMake target_link_libraries for
the HSA library.

19 months ago[clangd] fix wrong CalleeArgInfo in the hover
v1nh1shungry [Wed, 18 Jan 2023 14:15:28 +0000 (22:15 +0800)]
[clangd] fix wrong CalleeArgInfo in the hover

```
void foobar(int);
int main() {
  foobar(1 + 2);
           ^
}
```

Currently the CalleeArgInfo will be "Passed by reference", which should
be "Passed by value".

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

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

19 months ago[gn build] Port 6470706bc0ed
LLVM GN Syncbot [Fri, 10 Feb 2023 14:07:17 +0000 (14:07 +0000)]
[gn build] Port 6470706bc0ed

19 months ago[X86] combineConcatVectorOps - concatenate AVX512 vselect nodes. NFC.
Simon Pilgrim [Fri, 10 Feb 2023 13:14:38 +0000 (13:14 +0000)]
[X86] combineConcatVectorOps - concatenate AVX512 vselect nodes. NFC.

This also requires us to constant fold vXi1 concat_vector nodes

19 months ago[libc] Fix exp2f and prevent misuse of likely/unlikely
Guillaume Chatelet [Fri, 10 Feb 2023 13:49:03 +0000 (13:49 +0000)]
[libc] Fix exp2f and prevent misuse of likely/unlikely

Let's make sure that we only accept boolean expressions when using likely/unlikely.

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

19 months ago[gn] port 6470706bc0e
Nico Weber [Fri, 10 Feb 2023 13:58:51 +0000 (08:58 -0500)]
[gn] port 6470706bc0e

19 months ago[Assignment Tracking] Fix fragment index error in getDerefOffsetInBytes
OCHyams [Fri, 10 Feb 2023 12:33:16 +0000 (12:33 +0000)]
[Assignment Tracking] Fix fragment index error in getDerefOffsetInBytes

Without this patch `getDerefOffsetInBytes` incorrectly always returns
`std::nullopt` for expressions with fragments due to an off-by-one error with
fragment element indices.

Reviewed By: StephenTozer

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

19 months ago[mlir][llvm] Adapt loop metadata to match llvm
Christian Ulmann [Fri, 10 Feb 2023 13:33:41 +0000 (14:33 +0100)]
[mlir][llvm] Adapt loop metadata to match llvm

This commit adds support for the "llvm.loop.isvectorized" metadata and
ensures that the unroll followups match llvm's naming.

Reviewed By: gysit

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

19 months ago[NFC][compiler-rt] Shorten comment
Tobias Hieta [Fri, 10 Feb 2023 13:42:48 +0000 (14:42 +0100)]
[NFC][compiler-rt] Shorten comment

19 months ago[Workflow] Add Release Repo sync script
Tobias Hieta [Fri, 27 Jan 2023 15:46:19 +0000 (16:46 +0100)]
[Workflow] Add Release Repo sync script

Adds a bash script that syncs llvm/llvm-project and llvm/llvm-project-release-prs.
This should run on pushes to any of the repositories release branches.

I will follow this up with a change to the github actions to run this
script.

This breaks out the sync script from: https://reviews.llvm.org/D133476
so we can keep them separate.

Reviewed By: kwk

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

19 months ago[CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig
Tobias Hieta [Wed, 8 Feb 2023 08:26:49 +0000 (09:26 +0100)]
[CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig

clang-cl doesn't support -dumpmachine directly, so we need to
preface it with /clang: in order to get this probing function
to work.

This is needed in order to run cmake directly on the runtimes
directory.

Reviewed By: hans

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

19 months ago[RISCV] Add tests for .attribute stack_align
Job Noorman [Fri, 10 Feb 2023 11:50:26 +0000 (19:50 +0800)]
[RISCV] Add tests for .attribute stack_align

As suggested by @asb [here](https://reviews.llvm.org/D143570#4112877), we need tests for `.attribute stack_align`. This patch simply verifies a stack alignment of 16 is emitted for any combination of currently supported base ISA and extensions.

Reviewed By: asb, kito-cheng

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

19 months ago[InstCombine] avoid crashing in pow->ldexp
Sanjay Patel [Fri, 10 Feb 2023 13:01:04 +0000 (08:01 -0500)]
[InstCombine] avoid crashing in pow->ldexp

Similar to 62a0a1b9eea7788c1f9dbae -

We have pow math intrinsics in IR, but no ldexp intrinsics
to handle vector types.

A patch for that was proposed in D14327, but it was not completed.

Issue #60605

19 months ago[clang] Update Clang version from 16 to 17 in scan-build.1.
Frederic Cambus [Fri, 10 Feb 2023 12:50:04 +0000 (13:50 +0100)]
[clang] Update Clang version from 16 to 17 in scan-build.1.

Similar to D110763.

19 months ago[InstCombine] avoid crashing in exp2->ldexp
Sanjay Patel [Fri, 10 Feb 2023 12:03:56 +0000 (07:03 -0500)]
[InstCombine] avoid crashing in exp2->ldexp

We have exp2 math intrinsics in IR, but no ldexp intrinsics
to handle vector types.

A patch for that was proposed in D14327, but it was not completed.

Issue #60605

19 months ago[InstCombine] add test for exp2->ldexp; NFC
Sanjay Patel [Fri, 10 Feb 2023 11:55:59 +0000 (06:55 -0500)]
[InstCombine] add test for exp2->ldexp; NFC

19 months ago[InstCombine] auto-generate check lines in test file; NFC
Sanjay Patel [Fri, 10 Feb 2023 11:51:57 +0000 (06:51 -0500)]
[InstCombine] auto-generate check lines in test file; NFC

19 months agoARM: skip debug instructions when matching jump-table patterns.
Tim Northover [Fri, 10 Feb 2023 11:40:20 +0000 (11:40 +0000)]
ARM: skip debug instructions when matching jump-table patterns.

When working out whether we can see a compressible jump-table pattern during
ConstantIslands, we were stopping when we saw a debug instruction. Instead it's
better to keep iterating backwards to the first real instruction.

https://reviews.llvm.org/D142019

19 months ago[mlir][bufferization] Restrict function boundary buffer. to func.call.
Ingo Müller [Fri, 10 Feb 2023 11:31:35 +0000 (11:31 +0000)]
[mlir][bufferization] Restrict function boundary buffer. to func.call.

The current bufferization on function boundaries works on `func.func`
and any call op implementing `CallOpInterface`. Then, an error is thrown
if there is a `CallOpInterface` op that is not `func.call`. This is
unnecessary and breaks the pass whenever such an op occurs (such as
`llvm.call`). This PR simply restricts the handling of call ops to
`func.call`.

Reviewed By: springerm

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

19 months ago[bazel] Fix build and make all target respect layering_check
Guillaume Chatelet [Fri, 10 Feb 2023 11:40:14 +0000 (11:40 +0000)]
[bazel] Fix build and make all target respect layering_check

Tested with `bazelisk-linux-amd64 query //... + @llvm-project//... | xargs bazelisk-linux-amd64 test --config=ci --features=layering_check`

19 months ago[RISCV] Add precommit tests for D143646
LiaoChunyu [Fri, 10 Feb 2023 11:34:37 +0000 (19:34 +0800)]
[RISCV] Add precommit tests for D143646

19 months ago[AMDGPU][AsmParser] Fix matching immediate literals.
Ivan Kosarev [Fri, 10 Feb 2023 11:07:17 +0000 (11:07 +0000)]
[AMDGPU][AsmParser] Fix matching immediate literals.

Prevents potential matching of literal offsets to non-literal operands.

Reviewed By: dp

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

19 months ago[InstCombine][NFC] regenerate tests for simple_phi_condition.ll
Yingchi Long [Fri, 10 Feb 2023 11:26:14 +0000 (19:26 +0800)]
[InstCombine][NFC] regenerate tests for simple_phi_condition.ll

19 months ago[Test] Add complementary tests for OR analogous for those for AND
Max Kazantsev [Fri, 10 Feb 2023 10:55:01 +0000 (17:55 +0700)]
[Test] Add complementary tests for OR analogous for those for AND

19 months ago[Test] Add test showing an opportunity to transform checks and hoist invariants
Max Kazantsev [Fri, 10 Feb 2023 10:41:03 +0000 (17:41 +0700)]
[Test] Add test showing an opportunity to transform checks and hoist invariants

19 months ago[SanitizerBinaryMetadata] Fix ignorelist test under Windows
Marco Elver [Fri, 10 Feb 2023 10:22:17 +0000 (11:22 +0100)]
[SanitizerBinaryMetadata] Fix ignorelist test under Windows

Windows paths confuse the regular expression. Just use the test source
name directly.

Fixes: 421215b919d0 ("[SanitizerBinaryMetadata] Support ignore list")

19 months agoMove SIMD alignment calculation to LLVM Frontend
Dominik Adamski [Tue, 17 Jan 2023 09:51:48 +0000 (03:51 -0600)]
Move SIMD alignment calculation to LLVM Frontend

Currently default simd alignment is defined by Clang specific TargetInfo class.
This class cannot be reused for LLVM Flang. That's why default simd alignment
calculation has been moved to OMPIRBuilder which is common for Flang and Clang.

Previous attempt: https://reviews.llvm.org/D138496 was wrong because
the default alignment depended on the number of built LLVM targets.

If we wanted to calculate the default alignment for PPC and we hadn't specified
PPC LLVM target to build, then we would get 0 as the alignment because
OMPIRBuilder couldn't create PPCTargetMachine object and it returned 0 as
the default value.

If PPC LLVM target had been built earlier, then OMPIRBuilder could have created
PPCTargetMachine object and it would have returned 128.

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

Reviewed By: jdoerfert

19 months ago[LVI] Don't traverse uses when calculating range at use
Dmitry Makogon [Fri, 10 Feb 2023 09:00:16 +0000 (16:00 +0700)]
[LVI] Don't traverse uses when calculating range at use

This effectively reverts 5c38c6a and 4f772b0.

A recently introduced LazyValueInfo::getConstantRangeAtUse returns incorrect
ranges for values in certain cases. One such example is described in PR60629.
The issue has something to do with traversing PHI uses of a value transitively.
As nikic pointed out, we're effectively reasoning about values from different
loop iterations.

In the faulting test case, CVP made a miscompilation because the calculated
range for a shift argument was incorrect. It returned empty-set, however it is
clearly not a dead code. CVP then erased the shift instruction because
of empty range.

19 months ago[LVI][CVP] Add test for miscompilation by CVP due to incorrect range returned by LVI
Dmitry Makogon [Fri, 10 Feb 2023 09:30:47 +0000 (16:30 +0700)]
[LVI][CVP] Add test for miscompilation by CVP due to incorrect range returned by LVI

This adds a test case from PR60629 which shows a miscompilation by CVP.

19 months ago[NFC][TargetParser] Replace uses of llvm/Support/Host.h
Archibald Elliott [Fri, 10 Feb 2023 09:59:46 +0000 (09:59 +0000)]
[NFC][TargetParser] Replace uses of llvm/Support/Host.h

The forwarding header is left in place because of its use in
`polly/lib/External/isl/interface/extract_interface.cc`, but I have
added a GCC warning about the fact it is deprecated, because it is used
in `isl` from where it is included by Polly.

19 months ago[Assignment Tracking][mem2reg] Remove overly defensive assert
OCHyams [Fri, 10 Feb 2023 09:27:37 +0000 (09:27 +0000)]
[Assignment Tracking][mem2reg] Remove overly defensive assert

The assert fires if a store to an alloca with no linked dbg.assigns has linked
dbg.assigns. This can happen in the wild due to optimisations dropping the
alloca's debug info so we shouldn't assert against it.

Reviewed By: jryans

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

19 months ago[Assignment Tracking][SROA] Delete dbg.assigns linked to rewritten stores
OCHyams [Fri, 10 Feb 2023 09:26:26 +0000 (09:26 +0000)]
[Assignment Tracking][SROA] Delete dbg.assigns linked to rewritten stores

AggLoadStoreRewriter splits aggregate loads and stores into scalars (before the
alloca is split up). The new stores and debug intrinsics are already wired up
correctly - we just need to also delete the dbg.assign that is linked to the
split to-be-deleted store too.

Reviewed By: jmorse

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

19 months agoRevert "[C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file...
Chuanqi Xu [Fri, 10 Feb 2023 09:46:18 +0000 (17:46 +0800)]
Revert "[C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file within P1689 format (4/4)"

This reverts commit e1354763b6e641e45cc2371270883fcd26edf705.

There is a build failure in m68k-linux testing bot
(https://lab.llvm.org/buildbot/#/builders/192/builds/267), which is
weird. Revert this for now and look at the reasons.

19 months ago[WebAssembly] Additional patterns for pmin/pax
Samuel Parker [Wed, 8 Feb 2023 14:09:06 +0000 (14:09 +0000)]
[WebAssembly] Additional patterns for pmin/pax

Each operation was missing their inverted condition using olt or ogt.
Also, as we don't need to discern +/-0, I think we should also be
able to use ole and oge.

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

19 months ago[flang][NFC] Clean up polymorphic-temp.f90
Valentin Clement [Fri, 10 Feb 2023 09:25:01 +0000 (10:25 +0100)]
[flang][NFC] Clean up polymorphic-temp.f90

19 months ago[SanitizerBinaryMetadata] Support ignore list
Marco Elver [Fri, 10 Feb 2023 08:34:08 +0000 (09:34 +0100)]
[SanitizerBinaryMetadata] Support ignore list

For large projects it will be required to opt out entire subdirectories.
In the absence of fine-grained control over the flags passed via the
build system, introduce -fexperimental-sanitize-metadata-ignorelist=.

The format is identical to other sanitizer ignore lists, and its effect
will be to simply not instrument either functions or entire modules
based on the rules in the ignore list file.

Reviewed By: dvyukov

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

19 months ago[NFC][Assignment Tracking] Remove lifetime intrinsics from some tests
OCHyams [Fri, 10 Feb 2023 09:20:53 +0000 (09:20 +0000)]
[NFC][Assignment Tracking] Remove lifetime intrinsics from some tests

The intrinsics don't add anything to the tests and the tests are easier to
debug without the additional noise.

Some SSA value names have changed as a result of no longer visiting the
intrinsics.

Reviewed By: jryans

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

19 months ago[Test][SCEV] Add tests where multiple assumes can be used to improve trip multiple
Max Kazantsev [Fri, 10 Feb 2023 09:05:16 +0000 (16:05 +0700)]
[Test][SCEV] Add tests where multiple assumes can be used to improve trip multiple

Add tests combining assume on trip count divisibility (TV % VF) and minimum/maximum
values (TC > N, TC < M).

Patch by Alon Kom!

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

19 months ago[bazel] Add missing dependency after 687f78210d0
Benjamin Kramer [Fri, 10 Feb 2023 09:22:18 +0000 (10:22 +0100)]
[bazel] Add missing dependency after 687f78210d0

19 months ago[NFC] convert compiler-rt/lib/dfsan/scripts/build-libc-list.py to python3 syntax
Tobias Hieta [Fri, 10 Feb 2023 07:33:32 +0000 (08:33 +0100)]
[NFC] convert compiler-rt/lib/dfsan/scripts/build-libc-list.py to python3 syntax

I found a few Python files not using Python 3 syntax in the tree
when trying to apply reformatting to them. This was converted with
2to3 and the changes seemed sane.

Reviewed By: MaskRay, browneee

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

19 months ago[libc][Obvious] Include MPFRWrapper and testutils only if tests are enabled.
Siva Chandra Reddy [Fri, 10 Feb 2023 09:03:05 +0000 (09:03 +0000)]
[libc][Obvious] Include MPFRWrapper and testutils only if tests are enabled.

19 months ago[bazel] fix build for 6470706bc0ed
Mikhail Goncharov [Fri, 10 Feb 2023 09:03:37 +0000 (10:03 +0100)]
[bazel] fix build for 6470706bc0ed

19 months ago[Reland][LSR] Hoist IVInc to loop header if its all uses are in the loop header
chenglin.bi [Fri, 10 Feb 2023 08:49:56 +0000 (16:49 +0800)]
[Reland][LSR] Hoist IVInc to loop header if its all uses are in the loop header

Original code will cause crash when the load/store memory type is structure because isIndexedLoadLegal/isIndexedStore doesn't support struct type.
So we limit the load/store memory type to integer.

Origin commit message:
When the latch block is different from header block, IVInc will be expanded in the latch loop. We can't generate the post index load/store this case.
But if the IVInc only used in the loop, actually we still can use the post index load/store because when exit loop we don't care the last IVInc value.
So, trying to hoist IVInc to help backend to generate more post index load/store.

Fix #53625

Reviewed By: eopXD

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

19 months ago[libc] Run libc tests unconditionally, even if there are no source changes.
Siva Chandra Reddy [Thu, 9 Feb 2023 05:42:12 +0000 (05:42 +0000)]
[libc] Run libc tests unconditionally, even if there are no source changes.

Before this change, the test binaries were executed only if the deps
changed. This change makes the test binaries run unconditionally. This
is more in line with the rest of LLVM. Future patches will print test
statistics etc., much like the rest of LLVM.

Reviewed By: gchatelet

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

19 months ago[mlir][bufferization] Support multiple leaves in EmptyTensorElimination
Matthias Springer [Fri, 10 Feb 2023 08:30:21 +0000 (09:30 +0100)]
[mlir][bufferization] Support multiple leaves in EmptyTensorElimination

Support cases where a source tensor can be traced back to multiple possible tensor.empty ops.

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

19 months ago[OPENMP][NFC] added loop bind to the support page
Sandeep Kosuri [Fri, 10 Feb 2023 08:32:50 +0000 (02:32 -0600)]
[OPENMP][NFC] added loop bind to the support page

19 months ago[SimplifyIndVar][NFC] Refactor Binary Operator's flag strengthening
Max Kazantsev [Fri, 10 Feb 2023 08:20:03 +0000 (15:20 +0700)]
[SimplifyIndVar][NFC] Refactor Binary Operator's flag strengthening

Extract complex logic of Binary Operator's flag strengthening to a separate
method in order to reuse it.

Patch by Aleksandr Popov!

Differential Revision: https://reviews.llvm.org/D143562
Reviewed By: mkazantsev

19 months ago[NFC] Add test to show that preprocess an import decl won't require to load it actually
Chuanqi Xu [Fri, 10 Feb 2023 08:13:46 +0000 (16:13 +0800)]
[NFC] Add test to show that preprocess an import decl won't require to load it actually

Close https://github.com/llvm/llvm-project/issues/59287

This is addressed in D137526 but I forgot to add a test for it.

19 months ago[MLIR] Fold away divs and mods in affine ops with operand info
Uday Bondhugula [Fri, 10 Feb 2023 08:05:04 +0000 (13:35 +0530)]
[MLIR] Fold away divs and mods in affine ops with operand info

Fold away divs and mods in affine maps exploiting operand info during
canonicalization. This simplifies affine map applications such as the ones
below:

```
// Simple ones.
affine.for %i = 0 to 32 {
  affine.load %A[%i floordiv 32]
  affine.load %A[%i mod 32]
  affine.load %A[2 * %i floordiv 64]
  affine.load %A[(%i mod 16) floordiv 16]
  ...
}

// Others.
 affine.for %i = -8 to 32 {
   // Will be simplified %A[0].
   affine.store %cst, %A[2 + (%i - 96) floordiv 64] : memref<64xf32>
}
```

Reviewed By: springerm

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

19 months ago[NFC] Remove the unused parameter introduced in e135476
Chuanqi Xu [Fri, 10 Feb 2023 08:02:31 +0000 (16:02 +0800)]
[NFC] Remove the unused parameter introduced in e135476

I introduced an unused parameter due to an oversight during rebasing.
Now the patch removes the parameter.

19 months ago[flang][hlfir] Ramp-up support of implicit interface mismatches
Jean Perier [Fri, 10 Feb 2023 07:56:53 +0000 (08:56 +0100)]
[flang][hlfir] Ramp-up support of implicit interface mismatches

There is a lot of Fortran code that takes advantage of F77 implicit
interface to pass arguments with a different type than those from
the subprogram definition (which is well defined if the storage
and passing convention are the same or compatible).

When the definition and calls are in different files, there is nothing
special to do: the actual arguments are already used to compute the
call interface.

The trouble for lowering comes when the definition is in the same
compilation unit (Semantics raises warning). Then, lowering will
be provided with the interface from the definition to prepare the
argument, and this leads to many ad-hoc handling (see
builder.convertWithSemantics) in the current lowering to cope
with the dummy/actual mismatches on a case by case basis. The
current lowering to FIR is not even complete for all mismatch cases that
can be found in the wild (see https://github.com/llvm/llvm-project/issues/60550),
it is crashing or hitting asserts for many of the added tests.

For HLFIR, instead of coping on a case by case basis, the call
interface will be recomputed according to the actual arguments when
calling an external procedure that can be called with an explicit
interface.

One extra case still has to be handled manually because it may happen
in calls with explicit interfaces: passing a character procedure
designator to a non character procedure dummy (and vice-versa) is widely
accepted even with explicit interfaces (and flang semantic accepts it).
Yet, this "mismatch" cannot be dealt with a simple fir.convert because
character dummy procedure are passed with a different passing
convention: an extra argument is hoisted for the result length (in FIR,
there is no extra argument yet, but the MLIR func argument is a
tuple<fir.boxproc, len>).

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

19 months ago[mlir][llvm] Fix TBAA verfication crash
Christian Ulmann [Fri, 10 Feb 2023 07:21:46 +0000 (08:21 +0100)]
[mlir][llvm] Fix TBAA verfication crash

This commit fixes a crash of the TBAA verification that happened due to
accessing memory through invalid pointers. A DenseMap does not guarantee
that pointers to its elements remain valid after additional elements
are inserted.

A testcase that caused this crash had more than 100 TBAA metadata
operations and thus no test is added. Instead, there is now an assertion
that ensures that the graph class is used correctly.

Reviewed By: vzakhari

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

19 months ago[RFC][GISel] Add a way to ignore COPY instructions in InstructionSelector
Pierre van Houtryve [Wed, 25 Jan 2023 13:06:09 +0000 (14:06 +0100)]
[RFC][GISel] Add a way to ignore COPY instructions in InstructionSelector

RFC to add a way to ignore COPY instructions when pattern-matching MIR in GISel.
    - Add a new "GISelFlags" class to TableGen. Both `Pattern`  and `PatFrags` defs can use it to alter matching behaviour.
    - Flags start at zero and are scoped: the setter returns a `SaveAndRestore` object so that when the current scope ends, the flags are restored to their previous values. This allows child patterns to modify the flags without affecting the parent pattern.
    - Child patterns always reuse the parent's pattern, but they can override its values. For more examples, see `GlobalISelEmitterFlags.td` tests.
    - [AMDGPU] Use the IgnoreCopies flag in BFI patterns, which are known to be bothered by cross-regbank copies.

Reviewed By: arsenm

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

19 months ago[AMDGPU] Run unmerge combines post regbankselect
Pierre van Houtryve [Tue, 24 Jan 2023 09:33:29 +0000 (10:33 +0100)]
[AMDGPU] Run unmerge combines post regbankselect

RegBankSelect can insert G_UNMERGE_VALUES in a lot of places which
left us with a lot of unmerge/merge pairs that could be simplified.
These often got in the way of pattern matching and made codegen
worse.

This patch:
  - Makes the necessary changes to the merge/unmerge combines so they can run post RegBankSelect
  - Adds relevant unmerge combines to the list of RegBankSelect combines for AMDGPU
  - Updates some tablegen patterns that were missing explicit cross-regbank copies (V_BFI patterns were causing constant bus violations with this change).

This seems to be mostly beneficial for code quality.

Reviewed By: arsenm

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

19 months ago[Test] Add tests where we can replace IV check with invariant check basing on predica...
Max Kazantsev [Fri, 10 Feb 2023 06:56:33 +0000 (13:56 +0700)]
[Test] Add tests where we can replace IV check with invariant check basing on predicated backedge cond

19 months ago[LoongArch] Convert test to opaque pointer. NFC
wanglei [Fri, 10 Feb 2023 06:35:18 +0000 (14:35 +0800)]
[LoongArch] Convert test to opaque pointer. NFC

19 months ago[SVE] Add intrinsics for logical/bitwise operations that explicitly undefine the...
lizhijin [Fri, 10 Feb 2023 06:42:33 +0000 (14:42 +0800)]
[SVE] Add intrinsics for logical/bitwise operations that explicitly undefine the result for inactive lanes

This patch adds new intrinsics for logical/bitwise operations and
changes the lowering for the following builtins to emit calls to
the new aarch64.sve.###.u intrinsics.
  svand_x
  svand_n_x
  svorr_x
  svorr_n_x
  sveor_x
  sveor_n_x
  svbic_x
  svbic_n_x

Reviewed By: paulwalker-arm

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

19 months ago[LoongArch] Implement the convertSelectOfConstantsToMath hook
gonglingqin [Fri, 10 Feb 2023 05:57:55 +0000 (13:57 +0800)]
[LoongArch] Implement the convertSelectOfConstantsToMath hook

Normally, the ISD::SELECT is lowered to maskeqz + masknez. This is
inefficient when operands are constants that can be computed easily.
To avoid that, override TargetLowering::convertSelectOfConstantsToMath.

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

19 months agoInliner: Address missed review comments for D143624
Amara Emerson [Fri, 10 Feb 2023 05:56:02 +0000 (21:56 -0800)]
Inliner: Address missed review comments for D143624

19 months ago[SimpleLoopUnswitch] Inject loop-invariant conditions and unswitch them when it's...
Max Kazantsev [Fri, 10 Feb 2023 04:56:08 +0000 (11:56 +0700)]
[SimpleLoopUnswitch] Inject loop-invariant conditions and unswitch them when it's profitable

Based on https://discourse.llvm.org/t/rfc-inject-invariant-conditions-to-loops-to-enable-unswitching-and-constraint-elimination

This transform attempts to handle the following loop:
```
for (...) {
  x = <some variant>
  if (x <u C1) {} else break;
  if (x <u C2) {} else break;
}
```
Here `x` is some loop-variant value, and `C1` and `C2` are loop invariants.
As we see, this loop has no invariant checks we can unswitch on. However, there is an
invariant condition that can make the second check redundant. Specifically, it is `C1 <=u C2`.
We can modify this code in the following way:
```
for (...) {
  x = <some variant>
  if (x <u C1) {} else break;
  if (C1 <=u C2) {
  /* no check is required */
  }
  else {
    // do the check normally
    if (x <u C2) {} else break;
  }
}
```
Now we have an invariant condition `C1 <=u C2` and can unswitch on it.

This patch introduces the basic version of this transform, with some limitations,
all of them seem liftable (but needs more work & testing):
- All checks are `ult` condition;
- All branches in question stay in loop if the said condition is true and leave it otherwise;
- All in-loop branches are hot enough;

There is also a room for improvement cost model. So far we evalutate the cost of
unswitching this newly injected invariant branch the same as if we would unswitch
on 2nd condition, which is not exactly precise (but also not grossly wrong).

Differential Revision: https://reviews.llvm.org/D136233
Reviewed By: skatkov

19 months ago[lldb] Hoist code to create StructuredData into DiagnosticEventData (NFC)
Jonas Devlieghere [Fri, 10 Feb 2023 01:24:10 +0000 (17:24 -0800)]
[lldb] Hoist code to create StructuredData into DiagnosticEventData (NFC)

Hoist the code that creates a StructuredData dictionary from a
diagnostic event into the DiagnosticEventData. This addresses Ismail's
code review feedback from D143687.

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

19 months ago[mlgo] Fix test after D143624
Mircea Trofin [Fri, 10 Feb 2023 05:13:41 +0000 (21:13 -0800)]
[mlgo] Fix test after D143624

19 months ago[CMake] Fix -DBUILD_SHARED_LIBS=on builds after D137534
Kai Luo [Fri, 10 Feb 2023 04:52:31 +0000 (04:52 +0000)]
[CMake] Fix -DBUILD_SHARED_LIBS=on builds after D137534

19 months ago[InstCombine] combine intersection for inequality icmps
Yingchi Long [Tue, 24 Jan 2023 13:25:50 +0000 (21:25 +0800)]
[InstCombine] combine intersection for inequality icmps

```
define i1 @src(i32 %A) {
  %mask1 = and i32 %A, 15 ; 0x0f
  %tst1 = icmp eq i32 %mask1, 3 ; 0x03
  %mask2 = and i32 %A, 255 ; 0xff
  %tst2 = icmp eq i32 %mask2, 243; 0xf3
  %res = or i1 %tst1, %tst2
  ret i1 %res
}
```

->

```
define i1 @tgt(i32 %A) {
  %1 = and i32 %A, 15
  %res = icmp eq i32 %1, 3
  ret i1 %res
}
```

Proof: https://alive2.llvm.org/ce/z/4AyvcE

Assume that `(B & D) & (C ^ E) == 0`, and `(B & D) == D || (B & D) == B`,
transforms:

```
(icmp ne (A & B), C) & (icmp ne (A & D), E)
-> (icmp ne (A & (B&D)), (C&E))
```

Fixes: https://github.com/llvm/llvm-project/issues/59680

Reviewed By: spatel, bcl5980

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

19 months ago[InstCombine] precommit tests for D140666
Yingchi Long [Thu, 19 Jan 2023 09:14:15 +0000 (17:14 +0800)]
[InstCombine] precommit tests for D140666

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

19 months ago[lldb] Remove unused CommandObjectRegexCommand::m_max_matches (NFC)
Dave Lee [Sat, 4 Feb 2023 05:44:07 +0000 (21:44 -0800)]
[lldb] Remove unused CommandObjectRegexCommand::m_max_matches (NFC)

19 months agoRevert "[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during...
Michael Buch [Fri, 10 Feb 2023 03:28:28 +0000 (03:28 +0000)]
Revert "[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during expression evaluation"

This reverts commit 1ba6ec0ba906472661506ef7bd2f0bf4efe4657e.

Fails on linux buildbots.

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

19 months agoRevert "[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table"
Michael Buch [Fri, 10 Feb 2023 03:24:52 +0000 (03:24 +0000)]
Revert "[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table"

This reverts commit ccee9b7839a182fc692a65f563abf76f81dd436c.

This started failing on Linux buildbots. The executable wasn't generated
correctly.

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

19 months ago[C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file within...
Chuanqi Xu [Fri, 10 Feb 2023 03:22:33 +0000 (11:22 +0800)]
[C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file within P1689 format (4/4)

Required in https://reviews.llvm.org/D137534.

The build systems needs the information to know that "header X changed,
scanning may have changed, so please rerun scanning". Although it is
possible to get the information by running clang-scan-deps for the
second time with make format, it is not user friendly clearly.

Reviewed By: jansvoboda11

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

19 months ago[DwarfGenerator] Emit dwarf address section when dwarf version is not less than 4
Kai Luo [Fri, 10 Feb 2023 03:17:39 +0000 (03:17 +0000)]
[DwarfGenerator] Emit dwarf address section when dwarf version is not less than 4

Some targets (like AIX) might not feature dwarf address section due to low dwarf version. Check before emitting one.

Fixed DebugInfo unit test failures in https://lab.llvm.org/buildbot/#/builders/214/builds/5739.

Reviewed By: qiucf

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

19 months agoRemove empty MLIRMemRefUtils library (NFC)
Mehdi Amini [Fri, 10 Feb 2023 03:13:48 +0000 (19:13 -0800)]
Remove empty MLIRMemRefUtils library (NFC)

19 months ago[X86][MC][NFC] Refine code in X86MCCodeEmitter.cpp about opcode prefix
Shengchen Kan [Tue, 7 Feb 2023 08:04:05 +0000 (16:04 +0800)]
[X86][MC][NFC] Refine code in X86MCCodeEmitter.cpp about opcode prefix

1. Make code clearer by separating the logic of setting bits from the
   logic of how a prefix is encoded
2. Extract common code into functions to avoid code duplication
3. Return a enum rather a boolean to ehance scalability and uniform
   the behavior of functions

Reviewed By: pengfei, craig.topper

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

19 months ago[YAML] Trim trailing whitespace from plain scalars
rkayaith [Tue, 25 Oct 2022 19:17:14 +0000 (15:17 -0400)]
[YAML] Trim trailing whitespace from plain scalars

In some cases plain scalars are currently parsed with a trailing
newline. In particular this shows up often when parsing JSON files, e.g.
note the `\n` after `456` below:
```
$ cat test.yaml
{
  "foo": 123,
  "bar": 456
}
$ yaml-bench test.yaml -canonical
%YAML 1.2
---
!!map {
  ? !!str "foo"
  : !!str "123",
  ? !!str "bar"
  : !!str "456\n",
}
...
```
The trailing whitespace ends up causing the conversion of the scalar to
int/bool/etc. to fail, causing the issue seen here:
https://github.com/llvm/llvm-project/issues/15877

From reading the YAML spec (https://yaml.org/spec/1.2.2/#733-plain-style)
it seems like plain scalars should never end with whitespace, so this
change trims all trailing whitespace characters from the
value (specifically `b-line-feed`, `b-carriage-return`, `s-space`, and
`s-tab`).

Reviewed By: scott.linder

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

19 months ago[Modules][Test][NFC] Fix -Wsign-compare in clang/unittests/Lex/ModuleDeclStateTest.cpp
Jie Fu [Fri, 10 Feb 2023 02:47:18 +0000 (10:47 +0800)]
[Modules][Test][NFC] Fix -Wsign-compare in clang/unittests/Lex/ModuleDeclStateTest.cpp

In file included from /data/jiefu/llvm-project/clang/unittests/Lex/ModuleDeclStateTest.cpp:22:
/data/jiefu/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11: error: comparison of integers of different signs: 'const unsigned long' and 'const int' [-Werror,-Wsign-compare]
  if (lhs == rhs) {
      ~~~ ^  ~~~
/data/jiefu/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1553:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<unsigned long, int>' requested here
    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
           ^
/data/jiefu/llvm-project/clang/unittests/Lex/ModuleDeclStateTest.cpp:124:3: note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<unsigned long, int, nullptr>' requested here
  EXPECT_EQ(Callback->importNamedModuleNum(), 0);
  ^
/data/jiefu/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2027:54: note: expanded from macro 'EXPECT_EQ'
  EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
                                                     ^
1 error generated.

19 months ago[C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified compilat...
Chuanqi Xu [Fri, 10 Feb 2023 02:40:17 +0000 (10:40 +0800)]
[C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified compilation database in P1689 (3/4)

In a private chat with @ben.boeckel , we get in consensus it would be
great for cmake if the invocation of clang-scan-deps can get rid of
compilation database. Due to the compilation database can't do very well
for the files which are not existed yet. @ben.boeckel may have more
context to add here.

This patch should be innocent for others usages.

Reviewed By: jansvoboda11

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

19 months ago[InstCombine] Look through truncate to fold icmp with intrinsics
chenglin.bi [Fri, 10 Feb 2023 02:31:44 +0000 (10:31 +0800)]
[InstCombine] Look through truncate to fold icmp with intrinsics

The output of intrinsic functions like ctpop, cttz, ctlz have limited range from 0 to bitwidth. So if the truncate destination type can hold the source bitwidth size, we can just ignore the truncate and use the truncate src to do combination.

Alive2 proofs:
https://alive2.llvm.org/ce/z/9D_-qP

Reviewed By: spatel

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

19 months ago[C++20] [Modules] [ClangScanDeps] Add ClangScanDeps support for C++20 Named Modules...
Chuanqi Xu [Fri, 10 Feb 2023 02:26:35 +0000 (10:26 +0800)]
[C++20] [Modules] [ClangScanDeps] Add ClangScanDeps support for C++20 Named Modules in P1689 format (2/4)

Close https://github.com/llvm/llvm-project/issues/51792
Close https://github.com/llvm/llvm-project/issues/56770

This patch adds ClangScanDeps support for C++20 Named Modules in P1689
format. We can find the P1689 format at:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1689r5.html.
After we land the patch, we're able to compile C++20 Named
Modules with CMake! And although P1689 is written by kitware people,
other build systems should be able to use the format to compile C++20
Named Modules too.

TODO: Support header units in P1689 Format.
TODO2: Support C++20 Modules in the full dependency format of
ClangScanDeps. We also want to support C++20 Modules and clang modules
together according to
https://discourse.llvm.org/t/how-should-we-support-dependency-scanner-for-c-20-modules/66027.
But P1689 format cares about C++20 Modules only for now. So let's focus
on C++ Modules and P1689 format. And look at the full dependency format
later.

I'll add the ReleaseNotes and Documentations after the patch get landed.

Reviewed By: jansvoboda11

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

19 months ago[C++20] [Modules] [NFC] Add Preprocessor methods for named modules - for ClangScanDep...
Chuanqi Xu [Fri, 10 Feb 2023 02:11:33 +0000 (10:11 +0800)]
[C++20] [Modules] [NFC] Add Preprocessor methods for named modules - for ClangScanDeps (1/4)

This patch prepares the necessary interfaces in the preprocessor part
for D137527 since we need to recognize if we're in a module unit, the
module kinds and the module declaration and the module we're importing
in the preprocessor.

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

19 months ago[lldb][Test] Check compiler in data forammter compiler version checks
Michael Buch [Thu, 9 Feb 2023 16:00:04 +0000 (16:00 +0000)]
[lldb][Test] Check compiler in data forammter compiler version checks

**Summary**

The compiler version check wouldn't make sense for non-GCC
compilers, so check for the compiler too.

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

19 months ago[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during expression...
Michael Buch [Mon, 6 Feb 2023 13:54:32 +0000 (13:54 +0000)]
[lldb][DWARFASTParserClang] Correctly resolve imported namespaces during expression evaluation

**Summary**

This patch makes the expression evaluator understand
namespace aliases.

This will become important once `std::ranges` become
more widespread since `std::views` is defined as:

```
namespace std {
namespace ranges::views {}

namespace views = ranges::views;
}
```

**Testing**

* Added API test

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

19 months ago[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table
Michael Buch [Mon, 6 Feb 2023 14:42:41 +0000 (14:42 +0000)]
[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table

**Summary**

After this patch, `dsymutil` will preserve `DW_TAG_imported_declarations`
entries in accelerator tables.

This allows consumers to resolve imported declarations even on
executables processsed through dsymutil.

This helps consumers, particularly LLDB's expression evaluator,
to resolve imported declarations (i.e., useful for namespace aliases
in C++) more efficiently.

**Testing**

* Added unit-test

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

19 months ago[llvm][DebugInfo] Add DW_TAG_imported_declaration to accelerator tables
Michael Buch [Mon, 6 Feb 2023 13:53:08 +0000 (13:53 +0000)]
[llvm][DebugInfo] Add DW_TAG_imported_declaration to accelerator tables

**Summary**

After this patch, `DW_TAG_imported_declaration`s will be emitted into
the DWARF accelerator tables (under `.apple_namespaces`)

**Motivation**

Currently LLDB expression evaluation doesn't see through namespace
aliases. This is because LLDB only considers namespaces that are
part of `.apple_namespaces` when building a nested namespace
identifier for C++, which currently doesn't include import
declarations. The alternative to putting imports into accelerator
tables is to do a linear scan of a `DW_TAG_namespace` and look
for import declarations that look like they would satisfy the lookup
request, which is prohibitively expensive.

**Testing**

* Added unit-test

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

19 months ago[-Wunsafe-buffer-usage] Emit Fix-Its only for C++20 and later standards
Jan Korous [Fri, 10 Feb 2023 01:01:30 +0000 (17:01 -0800)]
[-Wunsafe-buffer-usage] Emit Fix-Its only for C++20 and later standards

The transformation strategy we are bringing up heavily relies on std::span which was introduced as part of C++20.

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

19 months ago[mlir][tensor] Add shape inference methods to tensor::PackOp.
Hanhan Wang [Fri, 10 Feb 2023 01:24:26 +0000 (17:24 -0800)]
[mlir][tensor] Add shape inference methods to tensor::PackOp.

Reviewed By: mravishankar

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

19 months ago[libc++] Guard the fix to CityHash behind ABI v2
Louis Dionne [Thu, 9 Feb 2023 23:20:20 +0000 (15:20 -0800)]
[libc++] Guard the fix to CityHash behind ABI v2

As explained in a comment in https://reviews.llvm.org/D134124, we tried
landing this unconditionally but this actually bit some users who were
sharing std::unordered_map across an ABI boundary. This shows that the
ABI break is not benign and it should be guarded behind ABI v2.

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

19 months agoInlining: Run the legacy AlwaysInliner before the regular inliner.
Amara Emerson [Thu, 9 Feb 2023 03:52:00 +0000 (19:52 -0800)]
Inlining: Run the legacy AlwaysInliner before the regular inliner.

We have several situations where it's beneficial for code size to ensure that every
call to always-inline functions are inlined before normal inlining decisions are
made. While the normal inliner runs in a "MandatoryOnly" mode to try to do this,
it only does it on a per-SCC basis, rather than the whole module. Ensuring that
all mandatory inlinings are done before any heuristic based decisions are made
just makes sense.

Despite being referred to the "legacy" AlwaysInliner pass, it's already necessary
for -O0 because the CGSCC inliner is too expensive in compile time to run at -O0.

This also fixes an exponential compile time blow up in
https://github.com/llvm/llvm-project/issues/59126

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

19 months ago[MLIR] Fix non-deterministic generation from buffer-deallocation pass
Uday Bondhugula [Thu, 9 Feb 2023 22:38:39 +0000 (04:08 +0530)]
[MLIR] Fix non-deterministic generation from buffer-deallocation pass

The buffer-deallocation pass generates a different output on each run
due to an unstable iteration order.

Fixes: https://github.com/llvm/llvm-project/issues/59118

Reviewed By: mehdi_amini

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

19 months ago[ValueTracking] Replace an always false condition with an assert. NFC
Craig Topper [Thu, 9 Feb 2023 23:19:18 +0000 (15:19 -0800)]
[ValueTracking] Replace an always false condition with an assert. NFC

The one caller of this function already checked that V isn't a
Constant.

Alternatively, we could remove the check from the caller if reviewers
prefer.

Reviewed By: spatel

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

19 months agoAdd missing cases to clang switch after D141863
Krzysztof Drewniak [Thu, 9 Feb 2023 22:56:25 +0000 (22:56 +0000)]
Add missing cases to clang switch after D141863

Turns out there's a switch on APFloat semantics in clang I wasn't
aware of, fix the build error here.

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