platform/upstream/llvm.git
2 years agoAvoid nullptr dereferencing of 'Constraint'; NFC
Sindhu Chittireddy [Tue, 24 Aug 2021 11:08:18 +0000 (07:08 -0400)]
Avoid nullptr dereferencing of 'Constraint'; NFC

Klocwork static code analysis exposed this bug:
Pointer 'Constraint' returned from call to function
'cast_or_null<clang::ConceptSpecializationExpr,clang::Expr>' may
be NULL and will be dereferenced in the statement following it

Replace 'cast_or_null' with 'cast' so that the latter can assert
when it encounters a NULL.

This also removes an 'assert' that is covered by the previous
call to 'cast<>'.

2 years ago[mlir][tensor] Insert explicit tensor.cast ops for insert_slice src
Matthias Springer [Tue, 24 Aug 2021 10:41:16 +0000 (19:41 +0900)]
[mlir][tensor] Insert explicit tensor.cast ops for insert_slice src

If additional static type information can be deduced from a insert_slice's size operands, insert an explicit cast of the op's source operand.

This enables other canonicalization patterns that are matching for tensor_cast ops such as `ForOpTensorCastFolder` in SCF.

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

2 years ago[mlir][SCF] Use symbols in loop peeling rewrite
Matthias Springer [Tue, 24 Aug 2021 10:33:58 +0000 (19:33 +0900)]
[mlir][SCF] Use symbols in loop peeling rewrite

Use symbols in the affine map instead of dims. Dims should not be divided.

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

2 years ago[clang-format] keep TypeScript argument decorators in line
Krasimir Georgiev [Tue, 24 Aug 2021 10:36:53 +0000 (12:36 +0200)]
[clang-format] keep TypeScript argument decorators in line

As a follow-up from https://reviews.llvm.org/D108538, ensure TypeScript
argument decorators are kept in line with the argument.

Reviewed By: MyDeveloperDay

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

2 years ago[NFC][LoopIdiom] Add reproducer of wrong memmove transformation
Dawid Jurczak [Mon, 23 Aug 2021 10:24:12 +0000 (12:24 +0200)]
[NFC][LoopIdiom] Add reproducer of wrong memmove transformation

That's precommit test for D107964.

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

2 years ago[M68k][AsmParser] Support parsing register masks & fix printing them
Ricky Taylor [Mon, 23 Aug 2021 22:49:52 +0000 (23:49 +0100)]
[M68k][AsmParser] Support parsing register masks & fix printing them

Fixes PR51580.

Register masks will now be printed as 'movem.l (%sp), %a0-%a5/%d5'
for example and can now be parsed in the same format.

Previously the printed syntax was 'movem.l (%sp), %a0-%a5,%d', which
didn't match prior art and was too ambiguous to easily parse.

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

2 years ago[DebugInfo][InstrRef] Fix over-droppage of locations in X86FloatingPoint
Jeremy Morse [Tue, 24 Aug 2021 09:14:37 +0000 (10:14 +0100)]
[DebugInfo][InstrRef] Fix over-droppage of locations in X86FloatingPoint

Over in D105657, we started dropping instruction numbers (that become
variable locations) from call instructions, as we can't correctly represent
the x87 FP stack. Unfortunately, it turns out that the "special FP
instructions" that this pass transforms includes "every call instruction"
[0]. Thus, we've ended up dropping all return values from all calls. Ouch.

This patch adds a filter: only drop instruction numbers from calls if they
return something on the FP stack. Seeing how LLVM only allows a single
return value, this should drop instruction numbers on anything that returns
a float, and nothing else.

Rather than writing a new test, I've modified the original one to have a
positive and negative case: drop instruction number on a call with an
FP-stack modification, keep it on a plain call.

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

2 years ago[GlobalISel] Avoid creating COPY in LegalizationArtifactCombiner
Petar Avramovic [Tue, 24 Aug 2021 09:09:37 +0000 (11:09 +0200)]
[GlobalISel] Avoid creating COPY in LegalizationArtifactCombiner

When Src and Dst used in buildAnyExtOrTrunc or buildSExtOrTrunc
have the same type (creates COPY) use Src register directly or
use replaceRegOrBuildCopy instead.

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

2 years ago[GVN] Execute performLoopLoadPRE ahead of PerformLoadPRE
Jingu Kang [Tue, 17 Aug 2021 12:14:42 +0000 (13:14 +0100)]
[GVN] Execute performLoopLoadPRE ahead of PerformLoadPRE

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

2 years ago[AArch64][SME] Fix v8.6a bf16 NEON instruction predication
Cullen Rhodes [Tue, 24 Aug 2021 08:13:57 +0000 (08:13 +0000)]
[AArch64][SME] Fix v8.6a bf16 NEON instruction predication

In streaming mode on SME targets only the scalar BFCVT armv8.6-a
instruction is legal, predicate the illegal instructions on NEON to
disable them in streaming mode (see D107902). BFCVT is predicated on
HasNEONorStreamingSVE.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06/SIMD-FP-Instructions

Reviewed By: paulwalker-arm

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

2 years ago[Polly] Don't redundantly link libPolly into unittests.
Michael Kruse [Tue, 24 Aug 2021 07:49:06 +0000 (02:49 -0500)]
[Polly] Don't redundantly link libPolly into unittests.

With LLVM_LINK_LLVM_DYLIB and LLVM_POLLY_LINK_INTO_TOOLS, Polly is
already linked into libLLVM.so, linking libPolly.a as well into
unittests results in duplicate command line registration errors.

2 years ago[ARM] Allow using ';' as asm statement separator in MSVC mode
Martin Storsjö [Mon, 2 Aug 2021 08:16:42 +0000 (11:16 +0300)]
[ARM] Allow using ';' as asm statement separator in MSVC mode

This does the same as D96259, but for ARM, just like AArch64,
using the same comment char as for ELF and MinGW mode.

As the assembly input/output of LLVM is GAS style, trying to
match what MS armasm.exe does isn't needed (because the comment
char used is the least concern when it comes to that; all
directives differ too). If a separate armasm compatible mode
is implemented, it can use its own comment style (just like
llvm-ml implements MS ml.exe compatible assembly parsing).

This fixes building compiler-rt assembly files for ARM in MSVC
mode.

The updated testcase literals-comments.s was only intended to
make sure that '#' isn't interpreted as a comment char.

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

2 years ago[AMDGPU][Libomptarget] Delete g_atl_machine global
Pushpinder Singh [Wed, 11 Aug 2021 06:35:56 +0000 (06:35 +0000)]
[AMDGPU][Libomptarget] Delete g_atl_machine global

With uses of g_atl_machine gone, a significant portion of dead
code has been removed.

This patch depends on D104691 and D104695.

Reviewed By: JonChesterfield

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

2 years ago[clang] NFC: remove superfluous braces
Zhouyi Zhou [Tue, 24 Aug 2021 07:23:20 +0000 (15:23 +0800)]
[clang] NFC: remove superfluous braces

In commit 9bb33f572f7609d469d3a505c9987b83eac5b78c, a pair of superfluous braces are introduced to the function Sema::BuildDeclarationNameExpr.
This patch tries to remove the superfluous braces. Also use clang-format to further beautify the above function.

Reviewed By: rjmccall

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

2 years ago[AggressiveInstCombine] Add arithmetic shift right instr to `TruncInstCombine` DAG
Anton Afanasyev [Thu, 19 Aug 2021 16:36:54 +0000 (19:36 +0300)]
[AggressiveInstCombine] Add arithmetic shift right instr to `TruncInstCombine` DAG

Add `ashr` instruction to the DAG post-dominated by `trunc`, allowing
`TruncInstCombine` to reduce bitwidth of expressions containing
these instructions.

We should be shifting by less than the target bitwidth.
Also it is sufficient to require that all truncated bits
of the value-to-be-shifted are sign bits (all zeros or ones) and
one sign bit is left untruncated: https://alive2.llvm.org/ce/z/Ajo2__

Part of https://reviews.llvm.org/D107766

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

2 years ago[ORC-RT] Add non-const WrapperFunctionResult data access, simplify allocate.
Lang Hames [Tue, 24 Aug 2021 07:16:20 +0000 (17:16 +1000)]
[ORC-RT] Add non-const WrapperFunctionResult data access, simplify allocate.

WrapperFunctionResult no longer supports wrapping constant data, so this patch
provides direct non-const access to the wrapped data. Since wrapped data can now
be written, the WrapperFunctionResult::allocate method can be simplified to
return a WrapperFunctionResult.

This is essentially the same change (and with the same motivation) as LLVM
commit 8b117830b1b, but applied to the ORC runtime's WrapperFunctionResult code.

2 years ago[Test][AggressiveInstCombine] Modify shift tests
Anton Afanasyev [Fri, 20 Aug 2021 13:16:54 +0000 (16:16 +0300)]
[Test][AggressiveInstCombine] Modify shift tests

Add `sext` for `ashr`, remove unrelated tests

2 years ago[ORC] Add non-const WrapperFunctionResult::data method, simplify allocate.
Lang Hames [Tue, 24 Aug 2021 05:13:54 +0000 (15:13 +1000)]
[ORC] Add non-const WrapperFunctionResult::data method, simplify allocate.

WrapperFunctionResult no longer supports wrapping constant data, so this patch
adds a non-const data method. Since data can now be written through the data
method, the allocate method can be simplified to return a WrapperFunctionResult.

2 years ago[OpenMP][AMDGCN] Enable complex functions
Pushpinder Singh [Thu, 19 Aug 2021 11:41:19 +0000 (17:11 +0530)]
[OpenMP][AMDGCN] Enable complex functions

This patch enables basic complex functionality using the ocml builtins.

Reviewed By: jdoerfert

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

2 years ago[X86] Building constant vector which element type is half will cause assertion fail.
Liu, Chen3 [Tue, 24 Aug 2021 05:58:08 +0000 (13:58 +0800)]
[X86] Building constant vector which element type is half will cause assertion fail.

Fix assertion fail when building con constant vector which element type is half.

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

2 years ago[LLDB][GUI] Handle extra navigation keys in forms
Omar Emara [Tue, 24 Aug 2021 05:08:28 +0000 (22:08 -0700)]
[LLDB][GUI] Handle extra navigation keys in forms

This patch handles the up and down keys if they weren't handled by the
selected field. Moreover, it makes sure the form always absorb the key
to take full control until the form is canceled or submitted.

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

2 years ago[IPO] Remove DisableTailCalls (NFC)
Kazu Hirata [Tue, 24 Aug 2021 05:20:22 +0000 (22:20 -0700)]
[IPO] Remove DisableTailCalls (NFC)

The last use was removed on Jun 9, 2015 in commit
d9699bc7bdf0362173fcd256690f61a4d47429c2.

2 years ago[LLDB][GUI] Add submit form key combination
Omar Emara [Tue, 24 Aug 2021 04:18:05 +0000 (21:18 -0700)]
[LLDB][GUI] Add submit form key combination

This patch adds a new key ALt+Enter key combination to form windows.
Once invoked, the first action is executed without having to navigate to
its button.

Field exit callbacks are now also invoked on validation to support this
aforementioned key combination.

One concern for this key combination is its potential use by the window
manager of the host. I am not sure if this will be a problem, but it is
worth putting in consideration.

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

2 years ago[profile] Update counter offset to account for binary ids
Petr Hosek [Tue, 24 Aug 2021 04:24:24 +0000 (21:24 -0700)]
[profile] Update counter offset to account for binary ids

In the raw profile, binary ids immediately follow the header so when
computing counters offset we need to account for the new section.

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

2 years ago[LLDB][GUI] Add extra keys to text field
Omar Emara [Thu, 19 Aug 2021 18:47:07 +0000 (11:47 -0700)]
[LLDB][GUI] Add extra keys to text field

This patch adds many new keys to the text field and implements new
behaviors as follows:

```
case KEY_HOME:
case KEY_CTRL_A:
  MoveCursorToStart();
case KEY_END:
case KEY_CTRL_E:
  MoveCursorToEnd();
case KEY_RIGHT:
case KEY_SF:
  MoveCursorRight();
case KEY_LEFT:
case KEY_SR:
  MoveCursorLeft();
case KEY_BACKSPACE:
case KEY_DELETE:
  RemovePreviousChar();
case KEY_DC:
  RemoveNextChar();
case KEY_EOL:
case KEY_CTRL_K:
  ClearToEnd();
case KEY_DL:
case KEY_CLEAR:
  Clear();
```

This patch also refactors scrolling to be dynamic at draw time for
easier handing.

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

2 years ago[X86] AVX512FP16 instructions enabling 5/6
Wang, Pengfei [Tue, 24 Aug 2021 01:05:33 +0000 (09:05 +0800)]
[X86] AVX512FP16 instructions enabling 5/6

Enable FP16 FMA instructions.

Ref.: https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html

Reviewed By: LuoYuanke

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

2 years ago[SCEV] Add a hasFlags utility to improve readability [NFC]
Philip Reames [Tue, 24 Aug 2021 00:36:24 +0000 (17:36 -0700)]
[SCEV] Add a hasFlags utility to improve readability [NFC]

2 years ago[AArch64][GlobalISel] Select @llvm.aarch64.neon.ld2.*
Jessica Paquette [Mon, 23 Aug 2021 22:17:47 +0000 (15:17 -0700)]
[AArch64][GlobalISel] Select @llvm.aarch64.neon.ld2.*

This is pretty similar to the ST2 selection code in
`AArch64InstructionSelector::selectIntrinsicWithSideEffects`.

This is a GISel equivalent of the ld2 case in `AArch64DAGToDAGISel::Select`.
There's some weirdness there that appears here too (e.g. using ld1 for scalar
cases, which are 1-element vectors in SDAG.)

It's a little gross that we have to create the copy and then select it right
after, but I think we'd need to refactor the existing copy selection code
quite a bit to do better.

This was falling back while building llvm-project with GISel for AArch64.

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

2 years ago[lit] Add the option to output test result as resultdb json format
Haowei Wu [Mon, 9 Aug 2021 18:45:49 +0000 (11:45 -0700)]
[lit] Add the option to output test result as resultdb json format

This change adds the option --resultdb-output=path allow llvm-lit
generating LuCI ResultDB JSON output for the test results, which
can be better integrated with certain CI/CQ framework.

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

2 years ago[mlir]Linalg] Allow controlling fusion of linalg.generic -> linalg.tensor_expand_shape.
MaheshRavishankar [Mon, 23 Aug 2021 23:27:15 +0000 (16:27 -0700)]
[mlir]Linalg] Allow controlling fusion of linalg.generic -> linalg.tensor_expand_shape.

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

2 years ago[dllexport] Instantiate default ctor default args
Reid Kleckner [Mon, 23 Aug 2021 22:56:29 +0000 (15:56 -0700)]
[dllexport] Instantiate default ctor default args

Fixes https://bugs.llvm.org/show_bug.cgi?id=51414.

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

2 years agoFix DWARFDie::getDeclFile(...) to work with DW_AT_specification.
Greg Clayton [Fri, 20 Aug 2021 19:10:21 +0000 (12:10 -0700)]
Fix DWARFDie::getDeclFile(...) to work with DW_AT_specification.

DWARFDie::getDeclFile(...) previously only supported getting the DW_AT_decl_file if the DIE itself contained the DW_AT_decl_file attribute, or if the DIE had a DW_AT_abstract_origin that pointed to another DIE that had a DW_AT_decl_file. This patch allows the function to get the right attribute value if there is a DW_AT_specification that points to another DIE. We also test that if a DW_AT_abtract_origin or DW_AT_specification points to a DIE in another CU with a DW_FORM_ref_addr, that the right line table is used to extract the file index.

Full tests were added for the following cases:
- DIE has a DW_AT_decl_file attribute
- DIE has a DW_AT_abtract_origin that points to another die in the same CU
- DIE has a DW_AT_abtract_origin that points to another die in another CU
- DIE has a DW_AT_specification that points to another die in the same CU
- DIE has a DW_AT_specification that points to another die in another CU

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

2 years ago[openmp][devicertl] Freestanding nvptx via stub printf
Jon Chesterfield [Mon, 23 Aug 2021 22:07:46 +0000 (23:07 +0100)]
[openmp][devicertl] Freestanding nvptx via stub printf

Compiled nvptx devicertl as freestanding, breaking the
dependency on host glibc and gcc-multilibs. Thus build it by default.

Comes at the cost of #defining out printf. Tried mapping it onto
__builtin_printf but that gets transformed back to printf instead
of hitting the cuda/openmp lowering transform.

Printf could be preserved by one of:
- dropping all the standard headers and ffreestanding
- providing a header only printf implementation
- changing the compiler handling of printf

Reviewed By: grokos

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

2 years ago[MLGO] Make sure inliner logs when deleting callees
Mircea Trofin [Mon, 23 Aug 2021 21:43:36 +0000 (14:43 -0700)]
[MLGO] Make sure inliner logs when deleting callees

When using final reward (which is now the default), we were skipping
logging decisions that were leading to callee deletion. This fixes that.

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

2 years ago[ExecutionEngine] Use the libunwind __register_frame on Darwin
Azharuddin Mohammed [Mon, 23 Aug 2021 21:34:46 +0000 (14:34 -0700)]
[ExecutionEngine] Use the libunwind __register_frame on Darwin

This was already the case, but the recent change (957334382cd1) altered
the behavior on some of our bots where __unw_add_dynamic_fde is not
found. This restores the prior behavior on Darwin while also retaining
the new behavior from that change.

2 years ago[mlir][sparse] replace support lib conversion with actual MLIR codegen
Aart Bik [Mon, 23 Aug 2021 17:29:19 +0000 (10:29 -0700)]
[mlir][sparse] replace support lib conversion with actual MLIR codegen

Rationale:
Passing in a pointer to the memref data in order to implement the
dense to sparse conversion was a bit too low-level. This revision
improves upon that approach with a cleaner solution of generating
a loop nest in MLIR code itself that prepares the COO object before
passing it to our "swiss army knife" setup.  This is much more
intuitive *and* now also allows for dynamic shapes.

Reviewed By: bixia

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

2 years ago[libc] Enable string to integer conversion functions in the default build
Michael Jones [Fri, 20 Aug 2021 18:05:52 +0000 (18:05 +0000)]
[libc] Enable string to integer conversion functions in the default build

Adds atoi, atol, atoll, strtol, strtoll, strtoul, and strtoull to the
list of entrypoints for Windows and aarch64 linux, as well as moving
them out of the LLVM_LIBC_FULL_BUILD condition for x86_64 linux.

Reviewed By: sivachandra

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

2 years ago[InstCombine] generalize subtract with 'not' operands; 2nd try
Sanjay Patel [Mon, 23 Aug 2021 21:03:09 +0000 (17:03 -0400)]
[InstCombine] generalize subtract with 'not' operands; 2nd try

This is a re-try of 3aa009cc87e3 which was reverted at
9577fac0fddf because it caused an infinite loop.

For the extra test case, either re-ordering the transforms
or adding the extra clause to avoid sub-of-sub is enough
to prevent the infinite compile, but I'm doing both to be
safer.

Original commit message:
The motivation was to get min/max intrinsics to parity
with cmp+select idioms, but this unlocks a few more
folds because isFreeToInvert recognizes add/sub with
constants too.

In the min/max example, we have too many extra uses
for smaller folds to improve things, but this fold
is able to eliminate uses even though we can't reduce
the number of instructions.

2 years ago[TargetMachine] Move COFF special case for ExternalSymbolSDNode from shouldAssumeDSOL...
Fangrui Song [Mon, 23 Aug 2021 20:54:39 +0000 (13:54 -0700)]
[TargetMachine] Move COFF special case for ExternalSymbolSDNode from shouldAssumeDSOLocal to X86Subtarget

Intended to be NFC. ARM/AArch64 don't appear to need adjustment.

TargetMachine::shouldAssumeDSOLocal is expected to be very simple, ideally
matching isDSOLocal(). The IR producers are expected to set dso_local correctly.
(While some may think this function can make producers' work easier, the
function is really not in a good position to set dso_local. See the various
special cases we duplicate from clang CodeGenModule.cpp.)

Reviewed By: mstorsjo

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

2 years agoFixed doc build.
Artem Belevich [Mon, 23 Aug 2021 20:45:13 +0000 (13:45 -0700)]
Fixed doc build.

2 years ago[mlir] Add support for VariadicOfVariadic operands
River Riddle [Mon, 23 Aug 2021 20:23:09 +0000 (20:23 +0000)]
[mlir] Add support for VariadicOfVariadic operands

This revision adds native ODS support for VariadicOfVariadic operand
groups. An example of this is the SwitchOp, which has a variadic number
of nested operand ranges for each of the case statements, where the
number of case statements is variadic. Builtin ODS support allows for
generating proper accessors for the nested operand ranges, builder
support, and declarative format support. VariadicOfVariadic operands
are supported by providing a segment attribute to use to store the
operand groups, mapping similarly to the AttrSizedOperand trait
(but with a user defined attribute name).

`build` methods for VariadicOfVariadic operand expect inputs of the
form `ArrayRef<ValueRange>`. Accessors for the variadic ranges
return a new `OperandRangeRange` type, which represents a
contiguous range of `OperandRange`. In the declarative assembly
format, VariadicOfVariadic operands and types are by default
formatted as a comma delimited list of value lists:
`(<value>, <value>), (), (<value>)`.

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

2 years ago[CUDA] Bump the latest supported CUDA version to 11.4.
Artem Belevich [Tue, 17 Aug 2021 21:39:58 +0000 (14:39 -0700)]
[CUDA] Bump  the latest supported CUDA version to 11.4.

This should reduce the amount of noise issued by clang for the recent-ish CUDA
versions.

Clang still does not support all the features offered by NVCC, but is expected
to handle CUDA headers and produce binaries for all GPUs supported by NVCC.

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

2 years ago[CUDA] Improve CUDA version detection and diagnostics.
Artem Belevich [Tue, 17 Aug 2021 19:32:05 +0000 (12:32 -0700)]
[CUDA] Improve CUDA version detection and diagnostics.

Always use cuda.h to detect CUDA version. It's a more universal approach
compared to version.txt which is no longer present in recent CUDA versions.

Split the 'unknown CUDA version' warning in two:

* when detected CUDA version is partially supported by clang. It's expected to
work in general, at the feature parity with the latest supported CUDA
version. and may be missing support for the new features/instructions/GPU
variants. Clang will issue a warning.

* when detected version is new. Recent CUDA versions have been working with
clang reasonably well, and will likely to work similarly to the partially
supported ones above. Or it may not work at all. Clang will issue a warning and
proceed as if the latest known CUDA version was detected.

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

2 years ago[CUDA] Add support for CUDA-11.4
Artem Belevich [Tue, 17 Aug 2021 19:27:37 +0000 (12:27 -0700)]
[CUDA] Add support for CUDA-11.4

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

2 years ago[CUDA] Bump default GPU architecture to sm_35.
Artem Belevich [Tue, 17 Aug 2021 18:51:12 +0000 (11:51 -0700)]
[CUDA] Bump default GPU architecture to sm_35.

It's the oldest GPU architecture currently supported by all CUDA versions clang
can use.

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

2 years agoRevert rG1c9bec727ab5c53fa060560dc8d346a911142170 : [InstCombine] Fold (gep (oneuse...
Simon Pilgrim [Mon, 23 Aug 2021 20:06:06 +0000 (21:06 +0100)]
Revert rG1c9bec727ab5c53fa060560dc8d346a911142170 : [InstCombine] Fold (gep (oneuse(gep Ptr, Idx0)), Idx1) -> (gep Ptr, (add Idx0, Idx1)) (PR51069)

Reverted (manually due to merge conflicts) while regressions reported on PR51540 are investigated

As noticed on D106352, after we've folded "(select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (select C, Idx, 0))" if the inner Ptr was also a (now one use) gep we could then merge the geps, using the sum of the indices instead.

I've limited this to basic 2-op geps - a more general case further down InstCombinerImpl.visitGetElementPtrInst doesn't have the one-use limitation but only creates the add if it can be created via SimplifyAddInst.

https://alive2.llvm.org/ce/z/f8pLfD (Thanks Roman!)

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

2 years ago[AArch64] Correct store ReadAdrBase operand
David Green [Mon, 23 Aug 2021 20:07:55 +0000 (21:07 +0100)]
[AArch64] Correct store ReadAdrBase operand

It appears that the Read operand for stores was being placed on the
first operand (the stored value) not the address base. This adds a
ReadST for the stored value operand, allowing the ReadAdrBase to
correctly act upon the address.

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

2 years ago[AArch64] Add Scheduling tests for Load/Store ReadAdv operands.
David Green [Mon, 23 Aug 2021 09:49:26 +0000 (10:49 +0100)]
[AArch64] Add Scheduling tests for Load/Store ReadAdv operands.

2 years ago[mlir][Linalg] Allow all build methods of Structured ops to specify additional attrib...
MaheshRavishankar [Mon, 23 Aug 2021 17:15:35 +0000 (10:15 -0700)]
[mlir][Linalg] Allow all build methods of Structured ops to specify additional attributes.

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

2 years ago[MergeICmps] Allow sinking past non-load/store
Nikita Popov [Sun, 22 Aug 2021 16:15:55 +0000 (18:15 +0200)]
[MergeICmps] Allow sinking past non-load/store

This is a followup to D106591. MergeICmps currently only allows
sinking the loads past either instructions that don't write to
memory at all, or simple loads/stores that don't modify the memory
the loads access.

The "simple loads/stores" part of this check doesn't seem necessary
to me -- AA isModRef() already accurately models any operation
that may clobber the memory. For example, in the adjusted test case
the transform is still fine if the call to @foo() isn't readonly,
but inaccessiblememonly -- in both cases, the call cannot modify
the loaded memory.

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

2 years ago[mlir][NFC] Add inlineRegion overloads that take a block iterator insert position
River Riddle [Mon, 23 Aug 2021 19:49:38 +0000 (19:49 +0000)]
[mlir][NFC] Add inlineRegion overloads that take a block iterator insert position

This allows for inlining into an empty block or to the beginning of a block. NFC as the existing implementations now foward to this overload.

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

2 years ago[DSE] Check post-dominance for malloc+memset->calloc transform.
Alina Sbirlea [Fri, 20 Aug 2021 17:33:33 +0000 (10:33 -0700)]
[DSE] Check post-dominance for malloc+memset->calloc transform.

Aiming to address the regression discussed in
https://reviews.llvm.org/D103009.

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

2 years ago[libc++][NFC] Reindent error message
Louis Dionne [Mon, 23 Aug 2021 19:34:40 +0000 (15:34 -0400)]
[libc++][NFC] Reindent error message

2 years ago[NFC][clang] Use X86 Features declaration from X86TargetParser
Andrei Elovikov [Mon, 23 Aug 2021 19:05:15 +0000 (12:05 -0700)]
[NFC][clang] Use X86 Features declaration from X86TargetParser

...instead of redeclaring them in clang's own X86Target.def. They were already
required to be in sync (IIUC), so no reason to maintain two identical lists.

Reviewed By: erichkeane, craig.topper

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

2 years ago[openmp] Use llvm GridValues from devicertl
Jon Chesterfield [Mon, 23 Aug 2021 19:25:23 +0000 (20:25 +0100)]
[openmp] Use llvm GridValues from devicertl

Add include path to the cmakefiles and set the target_impl enums
from the llvm constants instead of copying the values.

Reviewed By: jdoerfert

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

2 years agoFix late rematerialization operands check
Stanislav Mekhanoshin [Fri, 20 Aug 2021 17:14:31 +0000 (10:14 -0700)]
Fix late rematerialization operands check

D106408 enables rematerialization of instructions with virtual
register uses. That has uncovered the bug in the allUsesAvailableAt
implementation: https://bugs.llvm.org/show_bug.cgi?id=51516.

In the majority of cases canRematerializeAt() called to check if
an instruction can be rematerialized before the given UseIdx.
However, SplitEditor::enterIntvAtEnd() calls it to rematerialize
an instruction at the end of a block passing LIS.getMBBEndIdx()
into the check. In the testcase from the bug it has attempted to
rematerialize ADDXri after STRXui in bb.17. The use operand %55
of the ADD is killed by the STRX but that is undetected by the check
because it adjusts passed UseIdx to the reg slot, before the kill.
The value is dead at the index passed to the check however.

This change uses a later of passed UseIdx and its reg slot. This
shall be correct because if are checking an availability of operands
before an instruction that instruction cannot be the one defining
these operands. If we are checking for late rematerialization we
are really interested if operands live past the instruction.

The bug is not exploitable without D106408 but needed to reland
reverted D106408.

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

2 years ago[PowerPC][AIX] Set the HasAlloca flag in the AIX Traceback Table only if R31 is used...
Zarko Todorovski [Mon, 23 Aug 2021 18:34:35 +0000 (14:34 -0400)]
[PowerPC][AIX] Set the HasAlloca flag in the AIX Traceback Table only if R31 is used as a frame pointer

After c063946476e083a9a0c5bd397337d1ece4742ec6 usage of R31 doesn't necessarily mean
that alloca is used. The `TracebackTable::IsAllocaUsedMask` flag should be set only
when R31 is used as a frame pointer.

On AIX the `function calls alloca' bit seems to be set whenever R31 is
set up as a frame pointer, even when there is no alloca call.

Reviewed By: lkail

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

2 years ago[InstCombine] improve efficiency of isFreeToInvert
Sanjay Patel [Mon, 23 Aug 2021 18:51:58 +0000 (14:51 -0400)]
[InstCombine] improve efficiency of isFreeToInvert

This is NFC-intended when viewed from outside the pass.
I was trying to make sure that we don't infinite loop
in subtract combines and noticed that we handle the
non-canonical forms of add/sub here, but it should
not be necessary. Coding it this way seems slightly
clearer than mixing all 4 patterns as before.

2 years ago[mlir][FoldUtils] Ensure the created constant dominates the replaced op
River Riddle [Mon, 23 Aug 2021 18:14:18 +0000 (18:14 +0000)]
[mlir][FoldUtils] Ensure the created constant dominates the replaced op

This revision fixes a bug where an operation would get replaced with
a pre-existing constant that didn't dominate it. This can occur when
a pattern inserts operations to be folded at the beginning of the
constants insertion block. This revision fixes the bug by moving the
existing constant before the replaced operation in such cases. This is
fine because if a constant didn't already exist, a new one would have
been inserted before this operation anyways.

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

2 years ago[lldb][NFC] Remove unused method RichManglingContext::IsFunction
Alex Langford [Mon, 23 Aug 2021 18:31:36 +0000 (11:31 -0700)]
[lldb][NFC] Remove unused method RichManglingContext::IsFunction

2 years ago[MLIR][Docs] Fix broken link to tuple type rationale
Krzysztof Drewniak [Mon, 16 Aug 2021 15:21:02 +0000 (15:21 +0000)]
[MLIR][Docs] Fix broken link to tuple type rationale

Reviewed By: rriddle

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

2 years ago[libc][NFC] Add explicit casts to ctype functions
Alfonso Gregory [Mon, 23 Aug 2021 18:15:14 +0000 (18:15 +0000)]
[libc][NFC] Add explicit casts to ctype functions

Reviewed By: sivachandra

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

2 years agoFix fallback code that gets decl file + line.
Greg Clayton [Fri, 20 Aug 2021 23:36:06 +0000 (16:36 -0700)]
Fix fallback code that gets decl file + line.

When a function has no line table, but does have debug info (DW_TAG_subprogram), we fall back to creating a line table with a single line entry that has the start address of the function and the source file and line of the function declaration. The bug in this code was that we might have a DW_TAG_subprogram that uses a DW_AT_specification or DW_AT_abstract_origin that points to another DIE, and that DIE might be in another compile unit. The bug was we were grabbing the file index value from the DIE, and that index could be from the other DIE in another compile unit that has its own and compleltely different file table, so we might be using a file index from one compile unit with the file table from another. This was causing a crash in llvm-gsymuil when run against dSYM files. dsymutil, the Apple DWARF linker, will often unique types and can end up with more absolute references across different compile units.

The fix is to use the DWARFDie::getDeclFile(...) accessor as it does fetch this information correctly.

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

2 years ago[AArch64][GlobalISel] Add regbankselect support for G_LLROUND
Jessica Paquette [Mon, 23 Aug 2021 16:55:52 +0000 (09:55 -0700)]
[AArch64][GlobalISel] Add regbankselect support for G_LLROUND

Same as G_LROUND: destination should always be a GPR, source should always be
a FPR.

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

2 years agoImplement #pragma clang restrict_expansion
Chris Bieneman [Thu, 29 Jul 2021 14:37:49 +0000 (09:37 -0500)]
Implement #pragma clang restrict_expansion

This patch adds `#pragma clang restrict_expansion ` to enable flagging
macros as unsafe for header use. This is to allow macros that may have
ABI implications to be avoided in headers that have ABI stability
promises.

Using macros in headers (particularly public headers) can cause a
variety of issues relating to ABI and modules. This new pragma logs
warnings when using annotated macros outside the main source file.

This warning is added under a new diagnostics group -Wpedantic-macros

Reviewed By: aaron.ballman

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

2 years ago[AArch64][GlobalISel] Legalize G_LLROUND for s64 + s32
Jessica Paquette [Mon, 23 Aug 2021 16:33:12 +0000 (09:33 -0700)]
[AArch64][GlobalISel] Legalize G_LLROUND for s64 + s32

Same as G_LROUND.

Also add a TODO for full fp16 legalization.

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

2 years ago[GlobalISel] Translate @llvm.llround.* -> G_LLROUND
Jessica Paquette [Mon, 23 Aug 2021 16:16:20 +0000 (09:16 -0700)]
[GlobalISel] Translate @llvm.llround.* -> G_LLROUND

Translate it using `IRTranslator::translateSimpleIntrinsic`.

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

2 years ago[openmp][nfc] Refactor GridValues
Jon Chesterfield [Mon, 23 Aug 2021 15:19:10 +0000 (16:19 +0100)]
[openmp][nfc] Refactor GridValues

Remove redundant fields and replace pointer with virtual function

Of fourteen fields, three are dead and four can be computed from the
remainder. This leaves a couple of currently dead fields in place as
they are expected to be used from the deviceRTL shortly. Two of the
fields that can be computed are only used from codegen and require a
log2() implementation so are inlined into codegen instead.

This change leaves the new methods in the same location in the struct
as the previous fields for convenience at review.

Reviewed By: jdoerfert

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

2 years ago[InstCombine] Add reduced sub/negate test from PR51584.
Florian Hahn [Mon, 23 Aug 2021 14:45:53 +0000 (15:45 +0100)]
[InstCombine] Add reduced sub/negate test from PR51584.

2 years agoRevert "[InstCombine] generalize subtract with 'not' operands"
Florian Hahn [Mon, 23 Aug 2021 14:31:48 +0000 (15:31 +0100)]
Revert "[InstCombine] generalize subtract with 'not' operands"

This reverts commit 3aa009cc87e3789ac44bbb98b04846736373e08f.

The reverted commit causes an infinite loop in instcombine. See PR51584.

2 years ago[InstrProfiling] Add AIX triple to platform test
Jinsong Ji [Mon, 23 Aug 2021 13:16:48 +0000 (13:16 +0000)]
[InstrProfiling] Add AIX triple to platform test

We found that AIX was not covered in most of the InstrProfiling tests.
So we are trying to enable the tests gradually.

This is to add AIX triple to platform tests to make sure the
registrations are OK.

Reviewed By: MaskRay

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

2 years ago[tsan] Do not include <stdatomic.h> from sanitize-thread-disable.c
Alexander Potapenko [Mon, 23 Aug 2021 13:46:28 +0000 (15:46 +0200)]
[tsan] Do not include <stdatomic.h> from sanitize-thread-disable.c

Looks like non-x86 bots are unhappy with inclusion of <stdatomic.h>
e.g.:

clang-armv7-vfpv3-2stage - https://lab.llvm.org/buildbot/#/builders/182/builds/626
clang-ppc64le-linux - https://lab.llvm.org/buildbot/#/builders/76/builds/3619
llvm-clang-win-x-armv7l - https://lab.llvm.org/buildbot/#/builders/60/builds/4514

It seems to be unnecessary, just remove it and replace atomic_load()
calls with dereferences of _Atomic*.

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

2 years ago[clang-format] break after the closing paren of a TypeScript decoration
Krasimir Georgiev [Mon, 23 Aug 2021 13:51:39 +0000 (15:51 +0200)]
[clang-format] break after the closing paren of a TypeScript decoration

This fixes up a regression we found from
https://reviews.llvm.org/D107267: in specific contexts, clang-format
stopped breaking after the `)` in TypeScript decorations. There were no test cases covering this, so I added one.

Reviewed By: MyDeveloperDay

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

2 years ago[OpenMP][test] fix omp_get_wtime.c test to be more accommodating
Peyton, Jonathan L [Fri, 20 Aug 2021 21:06:13 +0000 (16:06 -0500)]
[OpenMP][test] fix omp_get_wtime.c test to be more accommodating

The omp_get_wtime.c test fails intermittently if the recorded times are
off by too much which can happen when many tests are run in parallel.

Instead of failing if one timing is a little off, take average of 100
timings minus the 10 worst.

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

2 years ago[X86] Add unaligned partial load test
Simon Pilgrim [Mon, 23 Aug 2021 12:59:54 +0000 (13:59 +0100)]
[X86] Add unaligned partial load test

Shows LoadedSlice::canMergeExpensiveCrossRegisterBankCopy failure to merge unaligned dereferencable loads.

Another candidate for PR45116

2 years ago[clang][CodeGen] GetDefaultAlignTempAlloca uses preferred alignment
Andy Wingo [Wed, 4 Aug 2021 13:49:13 +0000 (15:49 +0200)]
[clang][CodeGen] GetDefaultAlignTempAlloca uses preferred alignment

This function was defaulting to use the ABI alignment for the LLVM
type.  Here we change to use the preferred alignment.  This will allow
unification with GetTempAlloca, which if alignment isn't specified, uses
the preferred alignment.

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

2 years ago[clang][NFC] Tighten up code for GetGlobalVarAddressSpace
Andy Wingo [Wed, 4 Aug 2021 09:32:51 +0000 (11:32 +0200)]
[clang][NFC] Tighten up code for GetGlobalVarAddressSpace

The LangAS local is only used in the OpenCL case; move its decl
inwards.

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

2 years ago[clang][NFC] GetOrCreateLLVMGlobal takes LangAS
Andy Wingo [Wed, 4 Aug 2021 09:27:02 +0000 (11:27 +0200)]
[clang][NFC] GetOrCreateLLVMGlobal takes LangAS

Pass a LangAS instead of a target address space to
GetOrCreateLLVMGlobal, to remove a place where the frontend assumes that
target address space 0 is special.

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

2 years ago[mlir][SCF] Do not peel loops inside partial iterations
Matthias Springer [Mon, 23 Aug 2021 12:33:56 +0000 (21:33 +0900)]
[mlir][SCF] Do not peel loops inside partial iterations

Do not apply loop peeling to loops that are contained in the partial iteration of an already peeled loop. This is to avoid code explosion when dealing with large loop nests. Can be controlled with a new pass option `skip-partial`.

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

2 years ago[FuncSpec] Don't specialize function which are easy to inline
Chuanqi Xu [Mon, 23 Aug 2021 11:20:07 +0000 (19:20 +0800)]
[FuncSpec] Don't specialize function which are easy to inline

It would waste time to specialize a function which would inline finally.
This patch did two things:

- Don't specialize functions which are always-inline.
- Don't spescialize functions whose lines of code are less than threshold
(100 by default).

For spec2017int, this patch could reduce the number of specialized
functions by 33%. Then the compile time didn't increase for every
benchmark.

Reviewed By: SjoerdMeijer, xbolva00, snehasish

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

2 years ago[tsan] Add support for disable_sanitizer_instrumentation attribute
Alexander Potapenko [Tue, 17 Aug 2021 11:19:15 +0000 (13:19 +0200)]
[tsan] Add support for disable_sanitizer_instrumentation attribute

Unlike __attribute__((no_sanitize("thread"))), this one will cause TSan
to skip the entire function during instrumentation.

Depends on https://reviews.llvm.org/D108029

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

2 years ago[X86][AVX] Add PR13310 test coverage
Simon Pilgrim [Mon, 23 Aug 2021 10:34:00 +0000 (11:34 +0100)]
[X86][AVX] Add PR13310 test coverage

Show failure to fold scaled-index into gather/scatter scale operands

2 years agoRecommit "[LoopVectorize][AArch64] Enable ordered reductions by default for AArch64"
Florian Hahn [Mon, 23 Aug 2021 10:17:37 +0000 (11:17 +0100)]
Recommit "[LoopVectorize][AArch64] Enable ordered reductions by default for AArch64"

This reverts the revert ab9296f13be45cd190608f54a69bdd5c7c561b16.

The issue causing the revert should be fixed in 9baed023b4b5.

2 years ago[AMDGPU] Try to fix a GCC 11 warning
Jay Foad [Mon, 23 Aug 2021 09:49:01 +0000 (10:49 +0100)]
[AMDGPU] Try to fix a GCC 11 warning

Apparently GCC 11 was warning:
AMDGPURegisterBankInfo.cpp:2543:33: warning: enumerated and non-enumerated type in conditional expression [-Wextra]

2 years ago[AArch64][SME] Support NEON scalar FP instructions in streaming mode
Cullen Rhodes [Fri, 13 Aug 2021 07:40:39 +0000 (07:40 +0000)]
[AArch64][SME] Support NEON scalar FP instructions in streaming mode

The following scalar FP instructions are legal in streaming mode:

  0101 1110 xx1x xxxx 11x1 11xx xxxx xxxx # FMULX/FRECPS/FRSQRTS (scalar)
  0101 1110 x10x xxxx 00x1 11xx xxxx xxxx # FMULX/FRECPS/FRSQRTS (scalar, FP16)
  01x1 1110 1x10 0001 11x1 10xx xxxx xxxx # FRECPE/FRSQRTE/FRECPX (scalar)
  01x1 1110 1111 1001 11x1 10xx xxxx xxxx # FRECPE/FRSQRTE/FRECPX (scalar, FP16)

Predicate them on `HasNEONorStreamingSVE`. Full list of affected
instructions:

  FMULX16, FMULX32, FMULX64, FRECPS16, FRECPS32, FRECPS64, FRSQRTS16,
  FRSQRTS32, FRSQRTS64, FRECPEv1f16, FRECPEv1i32, FRECPEv1i64, FRECPXv1f16,
  FRECPXv1i32, FRECPXv1i64, FRSQRTEv1f16, FRSQRTEv1i32, FRSQRTEv1i64

Depends on D107902.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06/SIMD-FP-Instructions

Execution of NEON instructions that are illegal in streaming mode will
cause a trap or exception. Using FMULX [1] as an example, this check is
at the top of the pseudocode:

  if elements == 1 then
      CheckFPEnabled64();
  else
      CheckFPAdvSIMDEnabled64();

For the legal scalar variants it calls `CheckFPEnabled64`, whereas for the
illegal vector variants it calls `CheckFPAdvSIMDEnabled64` which traps.

This is useful for observing which instructions are/aren't legal
in streaming mode.

[1] https://developer.arm.com/documentation/ddi0602/2021-06/SIMD-FP-Instructions/FMULX--Floating-point-Multiply-extended-

Reviewed By: david-arm

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

2 years ago[AArch64][SME] Add predicate for NEON support in streaming mode
Cullen Rhodes [Wed, 18 Aug 2021 12:46:22 +0000 (12:46 +0000)]
[AArch64][SME] Add predicate for NEON support in streaming mode

Split out from D107903 to remove dependency for D108039 and D108279.

Reviewed By: paulwalker-arm

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

2 years ago[Polly] Never consider non-SCoP blocks as error blocks.
Michael Kruse [Mon, 23 Aug 2021 00:23:51 +0000 (19:23 -0500)]
[Polly] Never consider non-SCoP blocks as error blocks.

Code outside the SCoP will be executed recardless of the code versioning
runtime check introduced by CodeGeneration. Assumption made based on
that these are never executed in Polly-optimized code does not hold.

This fixes the miscompilation of MultiSource/Applications/lambda-0.1.3

2 years ago[libc] Add a multi-waiter mutex test.
Siva Chandra Reddy [Sat, 21 Aug 2021 04:46:32 +0000 (04:46 +0000)]
[libc] Add a multi-waiter mutex test.

A corresponding adjustment to mtx_lock has also been made.

2 years ago[M68k][NFC] Tidy up the just-migrated MC tests
Min-Yih Hsu [Mon, 23 Aug 2021 05:43:02 +0000 (22:43 -0700)]
[M68k][NFC] Tidy up the just-migrated MC tests

Cleanup the formats of the MC tests that were just migrated. NFC

2 years ago[M68k][test] Migrate some MOVE instruction MC tests
Min-Yih Hsu [Mon, 23 Aug 2021 05:24:31 +0000 (22:24 -0700)]
[M68k][test] Migrate some MOVE instruction MC tests

Migrate some MOVE instruction MC tests from test/CodeGen/M68k.
Unfortunately the tests touched in this commit were failed due to
lacking of the `abs.W` operand, which forces any memory address parsed
from assembly being represented in 32-bits.
We're temporarily allowing these unwanted widening in the tests until
the support for `abs.W` is there.

2 years ago[libc] Add range reduction functions based on Paine and Hanek algorithm.
Siva Chandra Reddy [Fri, 4 Jun 2021 06:12:50 +0000 (06:12 +0000)]
[libc] Add range reduction functions based on Paine and Hanek algorithm.

These functions will be used in a future patch to implement
trigonometric functions. Unit tests have been added but to the
libc-long-running-tests suite. The unit tests long running because we
compare against MPFR computations performed at 1280 bits of precision.

Some cleanups or elimination of repeated patterns can be done as follow
up changes.

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

2 years ago[NFC] clang-format -i clang/lib/CodeGen/CGStmtOpenMP.cpp
Shilei Tian [Mon, 23 Aug 2021 02:57:05 +0000 (22:57 -0400)]
[NFC] clang-format -i clang/lib/CodeGen/CGStmtOpenMP.cpp

2 years ago[PowerPC] Use int64_t to represent stack object offset and frame size
Kai Luo [Mon, 23 Aug 2021 02:02:36 +0000 (02:02 +0000)]
[PowerPC] Use int64_t to represent stack object offset and frame size

This is the first step to enable PPC64 support huge frame size(>2G). Also fix an assertion error for frame size, i.e.,`int x; !isInt<32>(x);` should be always evaluated false, so the guard code for frame size is impossible to hit.

Reviewed By: jsji

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

2 years ago[Polly] Add support for -polly-dump-before/after with NPM.
Michael Kruse [Mon, 23 Aug 2021 01:35:14 +0000 (20:35 -0500)]
[Polly] Add support for -polly-dump-before/after with NPM.

The new pass manager does not allow adding module passes at the
-polly-position=before-vectorizer extension point. Introduce a
DumpFunctionPass that dumps only current function. In contrast to the
legacy pass manager's -polly-dump-before, each function will be dumped
into its own file. -polly-dump-before-file is still not supported.

The DumpFunctionPass uses llvm::CloneModule to copy the current function
into a new module and then write it into a file.

2 years ago[mlir] Add op for NCHW conv2d.
Stella Laurenzo [Sun, 22 Aug 2021 22:11:42 +0000 (15:11 -0700)]
[mlir] Add op for NCHW conv2d.

* This is the native data layout for PyTorch and npcomp was using the prior version before cleanup.

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

2 years ago[mlir][linalg] Add script to update the LinalgNamedStructuredOps.yaml. nfc
Stella Laurenzo [Sun, 22 Aug 2021 23:54:10 +0000 (16:54 -0700)]
[mlir][linalg] Add script to update the LinalgNamedStructuredOps.yaml. nfc

Also adds banners to the files with update instructions.

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

2 years ago[mlir][python] Makes C++ extension code relocatable by way of a macro.
Stella Laurenzo [Sun, 22 Aug 2021 20:43:55 +0000 (13:43 -0700)]
[mlir][python] Makes C++ extension code relocatable by way of a macro.

* Resolves a TODO by making this configurable by downstreams.
* This seems to be the last thing allowing full use of the Python bindings as a library within another project (i.e. be embedding them).

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

2 years ago[GVN] Fix test for loop load PRE on alloca (NFC)
Nikita Popov [Sun, 22 Aug 2021 20:28:53 +0000 (22:28 +0200)]
[GVN] Fix test for loop load PRE on alloca (NFC)

This test was not modifying the pointer in the loop, so the loads
just ended up as undef, without relation to loop load PRE.

Pass the alloca to the called function, so the memory is
potentially modified.

2 years ago[GVN] Don't short-circuit load PRE
Nikita Popov [Sun, 22 Aug 2021 19:08:58 +0000 (21:08 +0200)]
[GVN] Don't short-circuit load PRE

4ad41902e8c7481ccf3cdf6e618dfcd1e1fc10fc changed this code to
propagate Changed if scalar GEP PRE is performed. However, as
implemented this would skip the load PRE entirely if GEP indices
were PREd. Make sure load PRE runs even if Changed is already
true.

This likely has no functional effect as load PRE would then
occur on a later GVN iteration.

2 years ago[scudo][standalone] Link tests against libatomic if libatomic exists
Amy Kwan [Sun, 22 Aug 2021 18:46:52 +0000 (13:46 -0500)]
[scudo][standalone] Link tests against libatomic if libatomic exists

It is possible that libatomic does not exist on some systems. This patch updates
the scudo standalone tests to link against libatomic if the library exists.

This is an update to the original patch: https://reviews.llvm.org/D64134 and
aims to resolve https://bugs.llvm.org/show_bug.cgi?id=51431.

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