platform/upstream/llvm.git
2 years agoRevert "[SLP]Do not schedule instructions with constants/argument/phi operands and...
Alexey Bataev [Wed, 16 Mar 2022 20:53:36 +0000 (13:53 -0700)]
Revert "[SLP]Do not schedule instructions with constants/argument/phi operands and external users."

This reverts commit 1eeb2bfe727323332800e8d390f2f8c63c953779 to fix
a bug reported in https://reviews.llvm.org/D121121

2 years ago[clang-format] Reformat. NFC.
Marek Kurdej [Wed, 16 Mar 2022 20:53:52 +0000 (21:53 +0100)]
[clang-format] Reformat. NFC.

2 years ago[SCCP] update test to NPM, update_test_checks. NFC
Nick Desaulniers [Wed, 16 Mar 2022 20:49:58 +0000 (13:49 -0700)]
[SCCP] update test to NPM, update_test_checks. NFC

Pre-committing a test update to make changes in D121744 more visible.

2 years ago[flang] Include missing internal interfaces in .mod files
Emil Kieri [Tue, 15 Mar 2022 17:40:06 +0000 (18:40 +0100)]
[flang] Include missing internal interfaces in .mod files

Interfaces which are internal to a procedure need to be included in
module files if (and only if) they are referenced in the interface of
the procedure. That is, they are needed if they are the interfaces of
dummy or return value procedures.

Fixes #53420

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

2 years ago[WebAssembly] Fix names of SIMD instructions containing '_zero'
Thomas Lively [Wed, 16 Mar 2022 20:34:56 +0000 (13:34 -0700)]
[WebAssembly] Fix names of SIMD instructions containing '_zero'

Fix the instruction names to match the WebAssembly spec:

 - `i32x4.trunc_sat_zero_f64x2_{s,u}` => `i32x4.trunc_sat_f64x2_{s,u}_zero`
 - `f32x4.demote_zero_f64x2` => `f32x4.demote_f64x2_zero`

Also rename related things like intrinsics, builtins, and test functions to
match.

Reviewed By: aheejin

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

2 years ago[flang] Lower pack|unpack intrinsics
Valentin Clement [Wed, 16 Mar 2022 20:11:57 +0000 (21:11 +0100)]
[flang] Lower pack|unpack intrinsics

This patch adds lowering for the `pack` and `unpack`
intrinsics.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2 years ago[ConstraintElimination] Add missing dominance check.
Florian Hahn [Wed, 16 Mar 2022 20:01:24 +0000 (20:01 +0000)]
[ConstraintElimination] Add missing dominance check.

When dealing with an unconditional branch, the condition can only added
if BB properly dominates the successor.

2 years ago[AMDGPU] Define new feature HasFlatScratchSVSMode. NFC.
Jay Foad [Wed, 16 Mar 2022 14:10:49 +0000 (14:10 +0000)]
[AMDGPU] Define new feature HasFlatScratchSVSMode. NFC.

This is by analogy with HasFlatScratchSTMode and is slightly more
informative than using isGFX940Plus.

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

2 years ago[clang][dataflow] Add an API for dataflow "models" -- reusable analysis components.
Yitzhak Mandelbaum [Mon, 14 Mar 2022 21:16:18 +0000 (21:16 +0000)]
[clang][dataflow] Add an API for dataflow "models" -- reusable analysis components.

This patch introduces `DataflowModel`, an abstract base class for dataflow
"models": reusable analysis components that model a particular aspect of program
semantics.

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

2 years ago[libc++][NFC] Rename member variables to avoid shadowing conflict in future patch
Louis Dionne [Wed, 16 Mar 2022 19:45:02 +0000 (15:45 -0400)]
[libc++][NFC] Rename member variables to avoid shadowing conflict in future patch

2 years ago[flang] Lower numeric related instrinsics
Valentin Clement [Wed, 16 Mar 2022 19:40:13 +0000 (20:40 +0100)]
[flang] Lower numeric related instrinsics

This patch adds lowering for some numeric related
intrinsics:
- `exponent`
- `floor`
- `fraction`
- `mod`
- `modulo`
- `nint`
- `not`
- `product`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[libc] Remove references to the std threads library from __support/threads.
Siva Chandra Reddy [Wed, 16 Mar 2022 19:33:01 +0000 (19:33 +0000)]
[libc] Remove references to the std threads library from __support/threads.

2 years ago[flang] Exclude IO test for windows
Valentin Clement [Wed, 16 Mar 2022 19:33:29 +0000 (20:33 +0100)]
[flang] Exclude IO test for windows

This test is platform specific. It makes the windows
buildbot fails https://lab.llvm.org/buildbot/#/builders/172/builds/9708

2 years ago[BPF] fix a CO-RE bitfield relocation error with >8 record alignment
Yonghong Song [Mon, 14 Mar 2022 05:30:45 +0000 (22:30 -0700)]
[BPF] fix a CO-RE bitfield relocation error with >8 record alignment

Jussi Maki reported a fatal error like below for a bitfield
CO-RE relocation:
  fatal error: error in backend: Unsupported field expression for
  llvm.bpf.preserve.field.info, requiring too big alignment
The failure is related to kernel struct thread_struct. The following
is a simplied example.

Suppose we have below structure:
  struct t2 {
    int a[8];
  } __attribute__((aligned(64))) __attribute__((preserve_access_index));
  struct t1 {
    int f1:1;
    int f2:2;
    struct t2 f3;
  } __attribute__((preserve_access_index));

Note that struct t2 has aligned 64, which is used sometimes in the
kernel to enforce cache line alignment.

The above struct will be encoded into BTF and the following is what
C code looks like and the struct will appear in the file like vmlinux.h.
  struct t2 {
        int a[8];
        long: 64;
        long: 64;
        long: 64;
        long: 64;
  } __attribute__((preserve_access_index));
  struct t1 {
        int f1: 1;
        int f2: 2;
        long: 61;
        long: 64;
        long: 64;
        long: 64;
        long: 64;
        long: 64;
        long: 64;
        long: 64;
        struct t2 f3;
  } __attribute__((preserve_access_index));

Note that after
  origin_source -> BTF -> new_source
transition, the new source has the same memory layout as the old one
but the alignment interpretation inside the compiler could be different.
The bpf program will use the later explicitly padded structure as in
vmlinux.h.

In the above case, the compiler internal ABI alignment for new struct t1
is 16 while it is 4 for old struct t1. I didn't do a thorough investigation
why the ABI alignment is 16 and I suspect it is related to anonymous padding
in the above.

Current BPF bitfield CO-RE handling requires alignment <= 8 so proper
bitfield operatin can be performed. Therefore, alignment 16 will cause
a compiler fatal error.

To fix the ABI alignment >=16, let us check whether the bitfield
can be held within a 8-byte-aligned range. If this is the case,
we can use alignment 8. Otherwise, a fatal error will be reported.

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

2 years ago[libc][NFC] Keep the mutex with the base File data structure.
Siva Chandra Reddy [Wed, 16 Mar 2022 06:56:34 +0000 (06:56 +0000)]
[libc][NFC] Keep the mutex with the base File data structure.

This is now possible because we have a platform independent abstraction
for mutexes.

Reviewed By: lntue, michaelrj

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

2 years ago[AMDGPU] Correct gfx940 memory model documentation.
Stanislav Mekhanoshin [Thu, 10 Mar 2022 19:22:16 +0000 (11:22 -0800)]
[AMDGPU] Correct gfx940 memory model documentation.

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

2 years ago[libc][Obvious] Add missing licence headers and fix an include pattern.
Siva Chandra Reddy [Wed, 16 Mar 2022 18:50:58 +0000 (18:50 +0000)]
[libc][Obvious] Add missing licence headers and fix an include pattern.

2 years ago[RISCV] Ensure PseudoLA* can be hoisted
Jessica Clarke [Wed, 16 Mar 2022 18:45:34 +0000 (18:45 +0000)]
[RISCV] Ensure PseudoLA* can be hoisted

Since we mark the pseudos as mayLoad but do not provide any MMOs,
isSafeToMove conservatively returns false, stopping MachineLICM from
hoisting the instructions. PseudoLA_TLS_GD does not actually expand to a
load, so stop marking that as mayLoad to allow it to be hoisted, and for
the others make sure to add MMOs during lowering to indicate they're GOT
loads and thus can be freely moved.

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

Reviewed By: MaskRay, arichardson

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

2 years ago[NFC][RISCV] Pre-commit tests for hoisting of PseudoLLA/PseudoLA*
Jessica Clarke [Wed, 16 Mar 2022 18:45:19 +0000 (18:45 +0000)]
[NFC][RISCV] Pre-commit tests for hoisting of PseudoLLA/PseudoLA*

Only PseudoLLA is currently hoisted; this will be fixed in a subsequent
commit.

2 years ago[docs] Fix typo in tutorial
Bill Wendling [Wed, 16 Mar 2022 18:42:32 +0000 (11:42 -0700)]
[docs] Fix typo in tutorial

Use "operands" instead of "operators"

Closes #54397

2 years ago[flang] Keep ifdef macro for INT128
Valentin Clement [Wed, 16 Mar 2022 18:10:57 +0000 (19:10 +0100)]
[flang] Keep ifdef macro for INT128

This was wrongly removed in 9aeb7f035bdde83501e5eddd9e6ad175b8ed697f
and makes buildbot fail.

2 years ago[bazel] Add build rule for llvm-remark-size-diff
Jakub Kuderski [Wed, 16 Mar 2022 18:05:38 +0000 (14:05 -0400)]
[bazel] Add build rule for llvm-remark-size-diff

This binary is used in LIT tests.

Test: `bazel run --config=generic_clang -c opt @llvm-project//llvm:llvm-remark-size-diff -- --help`

Reviewed By: dblaikie

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

2 years ago[lldb] add missed handling for new BTFTagAttributed type
Yonghong Song [Wed, 16 Mar 2022 17:59:35 +0000 (10:59 -0700)]
[lldb] add missed handling for new BTFTagAttributed type

Commit 3251ba2d0fcf ("[Attr] Fix a btf_type_tag AST generation")
added a new type BTFTagAttributedType to the clang AST type
system. There are a few places in lldb needed to handle this type
similar to Attributed type to avoid compilation warning/error
when 'switch' is used to enumerate all types.

2 years ago[HWASan] add shortgranule tests to use-after-scope.
Florian Mayer [Tue, 15 Mar 2022 21:21:49 +0000 (14:21 -0700)]
[HWASan] add shortgranule tests to use-after-scope.

Reviewed By: hctim

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

2 years ago[x86] reduce indentation; NFC
Sanjay Patel [Wed, 16 Mar 2022 15:45:24 +0000 (11:45 -0400)]
[x86] reduce indentation; NFC

We may be able to refine the conditions for these transforms ( D120648 ).

2 years ago[ASan] Added .section statement to each function so they can be removed by --gc-sections.
Kirill Stoimenov [Wed, 16 Mar 2022 15:35:12 +0000 (15:35 +0000)]
[ASan] Added .section statement to each function so they can be removed by --gc-sections.

Reviewed By: MaskRay

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

2 years ago[HWASan] Update use-after-scope test to use ARM64.
Florian Mayer [Thu, 10 Mar 2022 18:57:18 +0000 (10:57 -0800)]
[HWASan] Update use-after-scope test to use ARM64.

Reviewed By: hctim

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

2 years ago[flang][lowering] Add support for lowering of the `i{a}char` intrinsics
Andrzej Warzynski [Wed, 16 Mar 2022 11:30:07 +0000 (11:30 +0000)]
[flang][lowering] Add support for lowering of the `i{a}char` intrinsics

This patch adds support for lowering of the `i{a}char` intrinsics from
Fortran to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: zacharyselk <zrselk@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[memprof] Add a test to verify callstack order.
Snehasish Kumar [Tue, 15 Mar 2022 23:50:19 +0000 (16:50 -0700)]
[memprof] Add a test to verify callstack order.

We add to ensure that we are observing the correct callstack order in memprof
during symbolization. There was some confusion whether the order of
DIFrame objects were reversed but in reality the leaf function is at
index 0 so no code changes are required.

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

2 years agoRevert "[CMake][Fuchsia] Use correct architecture for iossim"
Petr Hosek [Wed, 16 Mar 2022 17:10:15 +0000 (10:10 -0700)]
Revert "[CMake][Fuchsia] Use correct architecture for iossim"

This reverts commit 1b6ff3f4f89e06af17575627fba3e6d90d1abbc5 since
it broke Fuchsia's macOS builders.

2 years ago[flang][lowering] Add support for lowering of the `ibclr` intrinsic
Andrzej Warzynski [Wed, 16 Mar 2022 10:56:38 +0000 (10:56 +0000)]
[flang][lowering] Add support for lowering of the `ibclr` intrinsic

This patch adds support for lowering of the `ibclr` intrinsic from Fortran
to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Differential Revision: https://reviews.llvm.org/D121789

2 years ago[ASan] Add read to large_func_test.cpp to prevent optimization.
Florian Hahn [Wed, 16 Mar 2022 17:00:32 +0000 (17:00 +0000)]
[ASan] Add read to large_func_test.cpp to prevent optimization.

After e5822ded562f, the call to LargeFunction can be optimized out, as x
is never accessed in main. This is causing the test to fail, because the
out-of-bounds access won't be executed.

Adding an extra read and returning the value should prevent the
optimizer from removing the call.

2 years ago[MLIR] [LangRef] Clarify parsing of dense<...>
Siddharth Bhat [Wed, 16 Mar 2022 16:55:46 +0000 (22:25 +0530)]
[MLIR] [LangRef] Clarify parsing of dense<...>

dense<...> expects ... to be a tensor-literal.
Define this in the grammar in BuiltinAttributes.td,
and reflect this in the reference grammar written in
AttributeParser.cpp.

Reviewed By: rriddle

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

2 years ago[clangd] Handle more than two conflicting semantic tokens in resolveConflict()
Nathan Ridge [Wed, 16 Mar 2022 08:01:43 +0000 (04:01 -0400)]
[clangd] Handle more than two conflicting semantic tokens in resolveConflict()

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

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

2 years ago[flang][lowering] Add support for lowering of the `ieor` intrinsic
Andrzej Warzynski [Wed, 16 Mar 2022 11:40:05 +0000 (11:40 +0000)]
[flang][lowering] Add support for lowering of the `ieor` intrinsic

This patch adds support for lowering of the `ieor` intrinsic from Fortran
to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Differential Revision: https://reviews.llvm.org/D121791

2 years ago[llvm-objcopy] --weaken-symbol/--weaken: weaken STB_GNU_UNIQUE symbols
Fangrui Song [Wed, 16 Mar 2022 16:48:19 +0000 (09:48 -0700)]
[llvm-objcopy] --weaken-symbol/--weaken: weaken STB_GNU_UNIQUE symbols

STB_GNU_UNIQUE is like STB_GLOBAL with extra semantics:

* gold and ld.lld: changed to STB_GLOBAL if --no-gnu-unique is specified
* glibc: unique even with dlopen `RTLD_LOCAL`, implies DF_1_NODELETE

Therefore, I think it makes sense for --weaken-symbol/--weaken-symbols/--weaken
to change STB_GNU_UNIQUE symbols.

binutils 2.39 will have the same behavior: https://sourceware.org/bugzilla/show_bug.cgi?id=28926

Reviewed By: jhenderson

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

2 years ago[SelectionDAG][NFC] Clean up SDCallSiteDbgInfo accessors
Marco Elver [Wed, 16 Mar 2022 16:35:10 +0000 (17:35 +0100)]
[SelectionDAG][NFC] Clean up SDCallSiteDbgInfo accessors

* Consistent naming: addCallSiteInfo vs. getCallSiteInfo;
* Use ternary operator to reduce verbosity;
* const'ify getters;
* Add comments;

NFCI.

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

2 years ago[Symbolize] Fix overflow warning on 32-bit hosts.
Daniel Thornburgh [Tue, 15 Mar 2022 23:18:42 +0000 (23:18 +0000)]
[Symbolize] Fix overflow warning on 32-bit hosts.

The inserted cast is a no-op.

Reviewed By: MaskRay

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

2 years ago[libc++][NFC] Add TEST_HAS_NO_INCOMPLETE_RANGES.
Mark de Wever [Sat, 12 Mar 2022 11:19:13 +0000 (12:19 +0100)]
[libc++][NFC] Add TEST_HAS_NO_INCOMPLETE_RANGES.

This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, ldionne

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

2 years ago[NFC][clang][SVE] Auto-generate SVE operator tests.
David Truby [Wed, 16 Mar 2022 16:39:27 +0000 (16:39 +0000)]
[NFC][clang][SVE] Auto-generate SVE operator tests.

2 years ago[BOLT] Strip redundant AdSize override prefix
Amir Ayupov [Wed, 16 Mar 2022 16:37:54 +0000 (09:37 -0700)]
[BOLT] Strip redundant AdSize override prefix

Since LLVM MC now preserves redundant AdSize override prefix (0x67), remove it
in BOLT explicitly (-x86-strip-redundant-adsize, on by default).

Test Plan:
`bin/llvm-lit -a bolt/test/X86/addr32.s`

Reviewed By: rafauler

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

2 years ago[libc++][tests] Use CMake provided paths for includes and libdir instead of hardcodin...
Louis Dionne [Tue, 15 Mar 2022 14:49:49 +0000 (10:49 -0400)]
[libc++][tests] Use CMake provided paths for includes and libdir instead of hardcoding them

In the new-style testing configurations, we were hardcoding paths to the
`include` and `lib` directories, which was incorrect but always went
unnoticed because the hardcoded values always happened to match the
actual value.

When using new-style configs with the bootstrapping build, this falls
appart -- and we never noticed this because the bootstrapping build was
still using old style configs.

This patch removes the %{install} substitution, which makes it too
tempting to hardcode installation paths, and it also switches the
bootstrapping build to actually using new-style configs like we
always intended to do.

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

2 years ago[VPlan] Avoid collecting scalars for SVE
Malhar Jajoo [Fri, 11 Mar 2022 09:35:31 +0000 (09:35 +0000)]
[VPlan] Avoid collecting scalars for SVE

This patch ensures scalars (except for uniforms) are no
longer collected (prior to LVP planning phase) for
scalable vectorization.

This is to avoid the chances of generating scalarized
instructions later (during LVP execute phase) as they
are not supported for scalable vectorization.

Relevant test has also been added.

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

2 years ago[lldb] Fix Minidump/no-process-id.yaml
Jonas Devlieghere [Wed, 16 Mar 2022 16:31:24 +0000 (09:31 -0700)]
[lldb] Fix Minidump/no-process-id.yaml

Update warning after 2fc38b2b7bf9896806749655124ea5f13cc6d383.

2 years ago[flang][lowering] Add lowering for the `size` intrinsic
Andrzej Warzynski [Wed, 16 Mar 2022 13:40:25 +0000 (13:40 +0000)]
[flang][lowering] Add lowering for the `size` intrinsic

This patch adds support for lowering of the `size` intrinsic from Fortran
to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
2 years agoRevert "[FuzzMutate] Don't insert instructions after musttail call"
Nikita Popov [Wed, 16 Mar 2022 16:28:17 +0000 (17:28 +0100)]
Revert "[FuzzMutate] Don't insert instructions after musttail call"

This reverts commit 6a23d2764467bd45c2e02828f6175a0b9f9a1005.

The newly added tests fail on the llvm-clang-x86_64-sie-win
buildbot. Not sure why a failure only occurs there, possibly
differen PRNG sequence?

2 years ago[flang] Lower shift intrinsics
Valentin Clement [Wed, 16 Mar 2022 16:14:20 +0000 (17:14 +0100)]
[flang] Lower shift intrinsics

This patch adds lowering for shift intrinsics:
- `ishft`
- `eoshift`
- `ishftc`
- `cshift`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
Co-authored-by: AlexisPerry <aperry@lanl.gov>
2 years ago[flang] Lower IO input with vector subscripts
Valentin Clement [Wed, 16 Mar 2022 16:10:31 +0000 (17:10 +0100)]
[flang] Lower IO input with vector subscripts

This patch adds lowering for IO input with vector subscripts.
It defines a VectorSubscriptBox class that allow representing and working
with a lowered Designator containing vector subscripts while ensuring
all the subscripts expression are only lowered once.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[FuzzMutate] Don't insert instructions after musttail call
Nikita Popov [Wed, 16 Mar 2022 15:10:24 +0000 (16:10 +0100)]
[FuzzMutate] Don't insert instructions after musttail call

2 years ago[Attr] Fix a btf_type_tag AST generation
Yonghong Song [Fri, 4 Mar 2022 06:34:39 +0000 (22:34 -0800)]
[Attr] Fix a btf_type_tag AST generation

Current ASTContext.getAttributedType() takes attribute kind,
ModifiedType and EquivType as the hash to decide whether an AST node
has been generated or note. But this is not enough for btf_type_tag
as the attribute might have the same ModifiedType and EquivType, but
still have different string associated with attribute.

For example, for a data structure like below,
  struct map_value {
        int __attribute__((btf_type_tag("tag1"))) __attribute__((btf_type_tag("tag3"))) *a;
        int __attribute__((btf_type_tag("tag2"))) __attribute__((btf_type_tag("tag4"))) *b;
  };
The current ASTContext.getAttributedType() will produce
an AST similar to below:
  struct map_value {
        int __attribute__((btf_type_tag("tag1"))) __attribute__((btf_type_tag("tag3"))) *a;
        int __attribute__((btf_type_tag("tag1"))) __attribute__((btf_type_tag("tag3"))) *b;
  };
and this is incorrect.

It is very difficult to use the current AttributedType as it is hard to
get the tag information. To fix the problem, this patch introduced
BTFTagAttributedType which is similar to AttributedType
in many ways but with an additional BTFTypeTagAttr. The tag itself can
be retrieved with BTFTypeTagAttr.
With the new BTFTagAttributed type, the debuginfo code can be greatly
simplified compared to previous TypeLoc based approach.

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

2 years ago[VE] Remove output to /dev/stdout
Jake Egan [Wed, 16 Mar 2022 15:41:41 +0000 (11:41 -0400)]
[VE] Remove output to /dev/stdout

Sending output to /dev/stdout on AIX gets an llc permission denied error, so this patch removes this from the tests.

Reviewed By: simoll, hubert.reinterpretcast

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

2 years ago[lldb] Report debugger diagnostics as events
Jonas Devlieghere [Wed, 16 Mar 2022 15:30:26 +0000 (08:30 -0700)]
[lldb] Report debugger diagnostics as events

Report warnings and errors through events instead of printing directly
the to the debugger's error stream. By using events, IDEs such as Xcode
can report these issues in the UI instead of having them show up in the
debugger console.

The new diagnostic events are handled by the default event loop. If a
diagnostic is reported while nobody is listening for the new event
types, it is printed directly to the debugger's error stream.

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

2 years ago[X86] Emit REX prefix immediately before the opcode
Amir Ayupov [Thu, 3 Mar 2022 07:20:15 +0000 (23:20 -0800)]
[X86] Emit REX prefix immediately before the opcode

Fix prefix emission order to emit REX immediately before the opcode (SDM vol2,
2.1, Figure 2-1). According to SDM vol2 2.2.1, "Other placements are ignored".

This fix has a side effect of outputting segment override prefix in a different
order than previously (benign).

Follow-up to https://reviews.llvm.org/D120592

Reviewed By: skan, craig.topper

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

2 years ago[X86] Preserve redundant Address-Size override prefix
Amir Ayupov [Fri, 25 Feb 2022 23:04:40 +0000 (15:04 -0800)]
[X86] Preserve redundant Address-Size override prefix

Print and emit redundant Address-Size override prefix if it's set on the
instruction.

Reviewed By: skan

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

2 years ago[pseudo] Cleanup the leftover header guards after the movement, NFC.
Haojian Wu [Wed, 16 Mar 2022 15:17:25 +0000 (16:17 +0100)]
[pseudo] Cleanup the leftover header guards after the movement, NFC.

2 years ago[gn build] Port c2f62ab84b5f
LLVM GN Syncbot [Wed, 16 Mar 2022 15:19:44 +0000 (15:19 +0000)]
[gn build] Port c2f62ab84b5f

2 years ago[BOLT][NFC] Move isMOVSX64rm32 out of MCPlusBuilder
Amir Ayupov [Wed, 16 Mar 2022 15:14:50 +0000 (08:14 -0700)]
[BOLT][NFC] Move isMOVSX64rm32 out of MCPlusBuilder

Reviewed By: rafauler

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

2 years ago[Clang][VE] Add the rest of intrinsics to clang
Kazushi (Jam) Marukawa [Sat, 12 Mar 2022 00:40:17 +0000 (09:40 +0900)]
[Clang][VE] Add the rest of intrinsics to clang

Add the rest of intrinsics to clang except intrinsics using vector mask
registers.

Reviewed By: simoll

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

2 years ago[flang][lowering] Add lowering for the `set_exponent` intrinsic
Andrzej Warzynski [Wed, 16 Mar 2022 14:16:54 +0000 (14:16 +0000)]
[flang][lowering] Add lowering for the `set_exponent` intrinsic

This patch adds support for lowering of the `set_exponent` intrinsic
from Fortran to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eun Jung Park <ejpark@lanl.gov>
2 years ago[AMDGPU] Calculate RegWidth in bits in AsmParser
Joe Nash [Tue, 15 Mar 2022 19:18:17 +0000 (15:18 -0400)]
[AMDGPU] Calculate RegWidth in bits in AsmParser

NFC. Switch from calculations based on dwords to bits, to be more
flexible.

Reviewed By: rampitec

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

2 years ago[flang] Relax fir.rebox verifier with characters
Jean Perier [Wed, 16 Mar 2022 15:08:05 +0000 (16:08 +0100)]
[flang] Relax fir.rebox verifier with characters

Allow fir.rebox input and output element type to differ for characters
if:
- Any of the character type is dynamic. Fortran allows making pointer
assignments between deferred and constant lengths entities, making this
case useful (if the input length is dynamic and the output length constant,
it is a user requirement that the length matches at runtime. There is no
option to check this at runtime, but it could be added as an option to
fir.rebox codegen later if desired).

- Or, there is a slice in the fir.rebox (the fir.rebox can implement a
substring view, hence the constant output and input lengths).

This is only a verifier constraint change, the fir.rebox codegen is not
impacted and already support those cases.

Add related FIR parsing, error, and codegen tests.

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

2 years ago[lldb] Change back LLDBLog::Commands->Types in a couple more places
Pavel Labath [Wed, 16 Mar 2022 14:38:05 +0000 (15:38 +0100)]
[lldb] Change back LLDBLog::Commands->Types in a couple more places

This was inadvertedly changed (bad search&replace) when I was removing
the LLDBLOG macros.

2 years ago[SROA] Handle over-large loads during presplitting
Nikita Popov [Wed, 16 Mar 2022 14:39:26 +0000 (15:39 +0100)]
[SROA] Handle over-large loads during presplitting

When a load extends past the extent of the alloca, SROA will
restrict the slice size to extend to the end of the alloca only.
However, presplitting was asserting that the load size and the
slice size match exactly, which does not hold in this case.
Relax the assertion to only require that the load size is greater
or equal than the slice size.

2 years ago[LLDB] Change enumaration to enumeration
Will Hawkins [Wed, 16 Mar 2022 14:03:42 +0000 (15:03 +0100)]
[LLDB] Change enumaration to enumeration

Change enumaration to enumeration in code handling LLDB help output.

Reviewed By: labath

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

2 years ago[LLDB] Fix typos in LLDB help output.
Will Hawkins [Wed, 16 Mar 2022 14:03:16 +0000 (15:03 +0100)]
[LLDB] Fix typos in LLDB help output.

Correct a few spelling errors and typos in the LLDB help output.

Reviewed By: labath

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

2 years ago[mlir][bufferize] Update documentation with allow-return-allocs
Matthias Springer [Wed, 16 Mar 2022 14:29:08 +0000 (23:29 +0900)]
[mlir][bufferize] Update documentation with allow-return-allocs

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

2 years ago[mlir][bufferize] Allow non-equivalent yields from scf.for loops
Matthias Springer [Wed, 16 Mar 2022 13:27:55 +0000 (22:27 +0900)]
[mlir][bufferize] Allow non-equivalent yields from scf.for loops

This removes a restriction wrt. scf.for loops during One-Shot Bufferization. Such IR was previously rejected. It is still rejected by default because the bufferized IR could be slow. But such IR can now be bufferized with `allow-return-allocs`.

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

2 years ago[NFC][CodeGen] Remove redundant if clause in TargetPassConfig::addPass
Shengchen Kan [Wed, 16 Mar 2022 13:53:14 +0000 (21:53 +0800)]
[NFC][CodeGen] Remove redundant if clause in TargetPassConfig::addPass

2 years ago[ConstraintElimination] Support BBs with single successor in CanAdd.
Florian Hahn [Wed, 16 Mar 2022 14:13:00 +0000 (14:13 +0000)]
[ConstraintElimination] Support BBs with single successor in CanAdd.

If BB has a single successor, conditions can be added safely.

2 years ago[mlir][bufferize] Deallocate returned buffers with `BufferDeallocation`
Matthias Springer [Wed, 16 Mar 2022 13:26:56 +0000 (22:26 +0900)]
[mlir][bufferize] Deallocate returned buffers with `BufferDeallocation`

New buffer allocations can now be returned/yielded from blocks with `allow-return-allocs`. One-Shot Bufferize deallocates all buffers at the end of the block. If this is not possible (because the buffer escapes the block), this is now done by the existing BufferDeallocation pass.

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

2 years agolet EST_Uninstantiated in FunctionProtoType::canThrow return
Zhouyi Zhou [Wed, 16 Mar 2022 13:52:41 +0000 (06:52 -0700)]
let EST_Uninstantiated in FunctionProtoType::canThrow return
CT_Dependent

When compile following code without -std=c++17, clang will abort by
llvm_unreachable:

class A {
  public:

  static const char X;

};
const char A::X = 0;

template<typename U> void func() noexcept(U::X);

template<class... B, char x>
void foo(void(B...) noexcept(x)) {}

void bar()
{

  foo(func<A>);

}

So, my solution is to let EST_Uninstantiated in
FunctionProtoType::canThrow return CT_Dependent

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

2 years ago[libc] Let exhaustive tests indicate each interval PASSED/FAILED.
Tue Ly [Mon, 14 Mar 2022 03:42:27 +0000 (23:42 -0400)]
[libc] Let exhaustive tests indicate each interval PASSED/FAILED.

Let exhaustive tests indicate each interval PASSED/FAILED.

Reviewed By: sivachandra

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

2 years ago[mlir][linalg] Implement RegionBranchOpInterface and fix memory effects
Matthias Springer [Wed, 16 Mar 2022 13:26:26 +0000 (22:26 +0900)]
[mlir][linalg] Implement RegionBranchOpInterface and fix memory effects

* Implement RegionBranchOpInterface: The op has a region, but it is conceptually not entered. The region just describes the semantics of the (monolithic) op.
* Linalg structured ops do not allocate memory.

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

2 years ago[flang] Lower count intrinsic
Valentin Clement [Wed, 16 Mar 2022 13:38:32 +0000 (14:38 +0100)]
[flang] Lower count intrinsic

This patch adds lowering for the count intrinsic.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years ago[mlir][bufferize] Support layout maps in bufferization.clone lowering
Matthias Springer [Wed, 16 Mar 2022 13:27:26 +0000 (22:27 +0900)]
[mlir][bufferize] Support layout maps in bufferization.clone lowering

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

2 years ago[SLP]Do not schedule instructions with constants/argument/phi operands and external...
Alexey Bataev [Tue, 1 Mar 2022 19:32:32 +0000 (11:32 -0800)]
[SLP]Do not schedule instructions with constants/argument/phi operands and external users.

No need to schedule entry nodes where all instructions are not memory
read/write instructions and their operands are either constants, or
arguments, or phis, or instructions from others blocks, or their users
are phis or from the other blocks.
The resulting vector instructions can be placed at
the beginning of the basic block without scheduling (if operands does
not need to be scheduled) or at the end of the block (if users are
outside of the block).
It may save some compile time and scheduling resources.

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

2 years ago[AMDGPU][MC][NFC] Refactored custom operands handling
Dmitry Preobrazhensky [Wed, 16 Mar 2022 12:52:37 +0000 (15:52 +0300)]
[AMDGPU][MC][NFC] Refactored custom operands handling

The original design of custom operands support assumed that most GPUs
have the same or very similar operand names end encodings. This is
no longer the case. As a result the support code becomes over-complicated
and difficult to maintain.

This change implements a different design with the following benefits:

- support of aliases;
- support of operands with overlapped encodings;
- identification of defined but unsupported operands.

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

2 years ago[libc++] Fix incorrect availability markup for bad_optional_access & friends
Louis Dionne [Tue, 15 Mar 2022 20:21:47 +0000 (16:21 -0400)]
[libc++] Fix incorrect availability markup for bad_optional_access & friends

In 7fb40e1569d, I changed the availability for bad_optional_access and
friends from macOS 10.14 to 10.13 after conducting an investigation on
old dylibs. It turns out that macOS 10.13 did have bad_optional_access,
however the dylib on iOS didn't match the dylib on macOS, so those
exception classes were only introduced in iOS 12.

Thanks to Aditya Kumar for noticing this.

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

2 years ago[BOLT] LongJmp: Fix hot text section alignment
Vladislav Khmelevsky [Tue, 15 Mar 2022 19:17:51 +0000 (22:17 +0300)]
[BOLT] LongJmp: Fix hot text section alignment

The BinaryEmitter uses opts::AlignText value to align the hot text
section. Also check that the opts::AlignText is at least
equal opts::AlignFunctions for the same reason, as described in D121392.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

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

2 years ago[libc++] Do not install the C++ ABI library's headers as part of libc++'s build
Louis Dionne [Tue, 15 Mar 2022 15:17:08 +0000 (11:17 -0400)]
[libc++] Do not install the C++ ABI library's headers as part of libc++'s build

It's the role of the C++ ABI library to install its own headers, not libc++.
This fixes an existing issue causing spurious CI failures where both libc++
and libc++abi would try to install <cxxabi.h> & friends in the same location,
leading to failures during the installation step.

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

2 years ago[clang][deps] NFC: Align path separator conversion in tests
Jan Svoboda [Wed, 16 Mar 2022 12:40:09 +0000 (13:40 +0100)]
[clang][deps] NFC: Align path separator conversion in tests

This is the only test in the ClangScanDeps suite that doesn't convert (double) backslashes to forward slashes.

2 years ago[clang][deps] Attempt to fix test on Windows
Jan Svoboda [Wed, 16 Mar 2022 12:36:14 +0000 (13:36 +0100)]
[clang][deps] Attempt to fix test on Windows

This test fails on Windows due to path separators

2 years ago[NFC][CodeGen] Rename some functions in MachineInstr.h and remove duplicated comments
Shengchen Kan [Wed, 16 Mar 2022 12:21:25 +0000 (20:21 +0800)]
[NFC][CodeGen] Rename some functions in MachineInstr.h and remove duplicated comments

2 years ago[gn build] (manually) port e4cab4e24d17
Nico Weber [Wed, 16 Mar 2022 11:52:50 +0000 (07:52 -0400)]
[gn build] (manually) port e4cab4e24d17

2 years ago[clang][deps] Fix traversal of precompiled dependencies
Jan Svoboda [Wed, 16 Mar 2022 10:48:34 +0000 (11:48 +0100)]
[clang][deps] Fix traversal of precompiled dependencies

The code for traversing precompiled dependencies is somewhat complicated and contains a dangling iterator bug.

This patch simplifies the code and fixes the bug.

Reviewed By: dexonsmith

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

2 years ago[clang][deps] Don't prune search paths used by dependencies
Jan Svoboda [Wed, 16 Mar 2022 10:45:46 +0000 (11:45 +0100)]
[clang][deps] Don't prune search paths used by dependencies

When pruning header search paths (to reduce the number of modules we need to build explicitly), we can't prune the search paths used in (transitive) dependencies of a module. Otherwise, we could end up with either of the following dependency graphs:

```
X:<hash1> -> Y:<hash2>
X:<hash1> -> Y:<hash3>
```

depending on the search paths of the translation unit we discovered `X` and `Y` from.

This patch fixes that.

Depends on D121295.

Reviewed By: dexonsmith

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

2 years ago[clang][deps] NFC: Use range-based for loop instead of iterators
Jan Svoboda [Wed, 16 Mar 2022 10:44:55 +0000 (11:44 +0100)]
[clang][deps] NFC: Use range-based for loop instead of iterators

The iterator is not needed after the loop body anymore, meaning we can use more terse range-based for loop.

Depends on D121295.

Reviewed By: dexonsmith

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

2 years ago[clang][deps] Modules don't contribute to search path usage
Jan Svoboda [Wed, 16 Mar 2022 10:44:07 +0000 (11:44 +0100)]
[clang][deps] Modules don't contribute to search path usage

To reduce the number of modules we build in explicit builds (which use strict context hash), we prune unused header search paths. This essentially merges parts of the dependency graph.

Determining whether a search path was used to discover a module (through implicit module maps) proved to be somewhat complicated. Initial support landed in D102923, while D113676 attempts to fix some bugs.

However, now that we don't use implicit module maps in explicit builds (since D120465), we don't need to consider such search paths as used anymore. Modules are no longer discovered through the header search mechanism, so we can drop such search paths (provided they are not needed for other reasons).

This patch removes whatever support for detecting such usage we had, since it's buggy and not required anymore.

Depends on D120465.

Reviewed By: dexonsmith

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

2 years ago[X86] computeKnownBitsForTargetNode - add X86ISD::AND KnownBits handling
Simon Pilgrim [Wed, 16 Mar 2022 11:05:26 +0000 (11:05 +0000)]
[X86] computeKnownBitsForTargetNode - add X86ISD::AND KnownBits handling

Fixes #54171

2 years ago[X86] Add PR54171 test case
Simon Pilgrim [Wed, 16 Mar 2022 11:00:50 +0000 (11:00 +0000)]
[X86] Add PR54171 test case

2 years ago[mlir][SCF] Implement RegionBranchOpInterface on ExecuteRegionOp
Matthias Springer [Wed, 16 Mar 2022 09:18:09 +0000 (18:18 +0900)]
[mlir][SCF] Implement RegionBranchOpInterface on ExecuteRegionOp

This is needed for the BufferDeallocation pass.

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

2 years ago[mlir][bufferize][NFC] Rename allow-return-memref to allow-return-allocs
Matthias Springer [Wed, 16 Mar 2022 10:45:06 +0000 (19:45 +0900)]
[mlir][bufferize][NFC] Rename allow-return-memref to allow-return-allocs

Also clean up/split test cases.

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

2 years ago[flang][driver] Add support for `-mllvm`
Andrzej Warzynski [Wed, 2 Mar 2022 15:40:16 +0000 (15:40 +0000)]
[flang][driver] Add support for `-mllvm`

This option is added in both `flang-new` (the compiler driver) and
`flang-new -fc1` (the frontend driver). The semantics are consistent
with `clang` and `clang -cc1`.

As Flang does not run any LLVM passes when invoked with `-emit-llvm`
(i.e. `flang-new -S -emit-llvm <file>`), the tests use
`-S`/`-c`/`-emit-obj` instead. These options require an LLVM backend to
be run by the driver to generate the output (this makese `-mllvm`
relevant here).

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

2 years ago[flang] Lower adjustl and adjustr intrinsics
Valentin Clement [Wed, 16 Mar 2022 10:34:33 +0000 (11:34 +0100)]
[flang] Lower adjustl and adjustr intrinsics

This patch adds lowering for the `adjustl` and `adjustr`
intrinsics.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[flang] Lower transfer instrinsic
Valentin Clement [Wed, 16 Mar 2022 10:28:12 +0000 (11:28 +0100)]
[flang] Lower transfer instrinsic

This patch adds lowering for the `transfer` intrinsic.
The calls are lowered to runtime function calls.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years ago[flang][lowering] Add support for lowering of the `ibset` intrinsic
Andrzej Warzynski [Tue, 15 Mar 2022 17:07:07 +0000 (17:07 +0000)]
[flang][lowering] Add support for lowering of the `ibset` intrinsic

This patch adds support for lowering of the `ibset` intrinsic from Fortran
to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Differential Revision: https://reviews.llvm.org/D121717

2 years ago[VE] v512|256 f32|64 fneg isel and tests
Simon Moll [Wed, 16 Mar 2022 10:31:19 +0000 (11:31 +0100)]
[VE] v512|256 f32|64 fneg isel and tests

fneg instruction isel and tests. We do this also in preparation of fused
negatate-multiple-add fp operations.

Reviewed By: kaz7

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

2 years ago[FunctionAttrs] Infer argmemonly .
Florian Hahn [Wed, 16 Mar 2022 10:24:33 +0000 (10:24 +0000)]
[FunctionAttrs] Infer argmemonly .

This patch adds initial argmemonly inference, by checking the underlying
objects of locations returned by MemoryLocation.

I think this should cover most cases, except function calls to other
argmemonly functions.

I'm not sure if there's a reason why we don't infer those yet.

Additional argmemonly can improve codegen in some cases. It also makes
it easier to come up with a C reproducer for 7662d1687b09 (already fixed,
but I'm trying to see if C/C++ fuzzing could help to uncover similar
issues.)

Compile-time impact:
NewPM-O3: +0.01%
NewPM-ReleaseThinLTO: +0.03%
NewPM-ReleaseLTO+g: +0.05%

https://llvm-compile-time-tracker.com/compare.php?from=067c035012fc061ad6378458774ac2df117283c6&to=fe209d4aab5b593bd62d18c0876732ddcca1614d&stat=instructions

Reviewed By: nikic

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

2 years ago[Clang] Allow "ext_vector_type" applied to Booleans
Simon Moll [Wed, 16 Mar 2022 10:10:11 +0000 (11:10 +0100)]
[Clang] Allow "ext_vector_type" applied to Booleans

This is the `ext_vector_type` alternative to D81083.

This patch extends Clang to allow 'bool' as a valid vector element type
(attribute ext_vector_type) in C/C++.

This is intended as the canonical type for SIMD masks and facilitates
clean vector intrinsic declarations.  Vectors of i1 are supported on IR
level and below down to many SIMD ISAs, such as AVX512, ARM SVE (fixed
vector length) and the VE target (NEC SX-Aurora TSUBASA).

The RFC on cfe-dev: https://lists.llvm.org/pipermail/cfe-dev/2020-May/065434.html

Reviewed By: erichkeane

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

2 years ago[mlir][bufferize] Do not deallocate allocs that are returned from a block
Matthias Springer [Wed, 16 Mar 2022 08:01:17 +0000 (17:01 +0900)]
[mlir][bufferize] Do not deallocate allocs that are returned from a block

Such IR is rejected by default, but can be allowed with `allow-return-memref`. In preparation of future refactorings, do not deallocate such buffers.

One-Shot Analysis now gathers information about yielded tensors, so that we know during the actual bufferization whether a newly allocated buffer should be deallocated again. (Otherwise, it will leak. This will be addressed in a subsequent commit that also makes `allow-return-memref` a non-experimental flag.)

As a cleanup, `allow-return-memref` is now part of OneShotBufferizationOptions. (It was previously ignored by AlwaysCopyBufferizationState.) Moreover, AlwaysCopyBufferizationState now asserts that `create-deallocs` is deactivated to prevent surprising behavior.

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