platform/upstream/llvm.git
2 years ago[LICM] Extract debugify test (NFC)
Nikita Popov [Sat, 24 Jul 2021 15:03:20 +0000 (17:03 +0200)]
[LICM] Extract debugify test (NFC)

Only one of the tests in the file wants to check debug info, so
move it into a separate file. This allows update_test_checks to
work.

2 years ago[ADT] Remove WrappedPairNodeDataIterator (NFC)
Kazu Hirata [Sat, 24 Jul 2021 15:02:57 +0000 (08:02 -0700)]
[ADT] Remove WrappedPairNodeDataIterator (NFC)

The last use was removed on Jul 16, 2020 in commit
f1d4db4f0cdcbfeaee0840bf8a4fb5dc1b9b56fd.

2 years ago[X86] Add additional div-mod-pair negative test coverage
Simon Pilgrim [Sat, 24 Jul 2021 14:21:46 +0000 (15:21 +0100)]
[X86] Add additional div-mod-pair negative test coverage

As suggested on D106745

2 years ago[mlir] Restore markUnknownOpDynamicallyLegal to call isDynamicallyLegal by default
Benjamin Kramer [Sat, 24 Jul 2021 13:54:42 +0000 (15:54 +0200)]
[mlir] Restore markUnknownOpDynamicallyLegal to call isDynamicallyLegal by default

Looks like an oversight from b7a464989955e6374b39b518e317b59b510d4dc5

This should probably have a test case ...

2 years ago[BasicTTI] Set scalarization cost of scalable vector casts to Invalid.
Sander de Smalen [Sat, 24 Jul 2021 12:41:40 +0000 (13:41 +0100)]
[BasicTTI] Set scalarization cost of scalable vector casts to Invalid.

When BasicTTIImpl::getCastInstrCost can't determine the cost of a
vector cast operation when the types need legalization, it falls
back to calculating scalarization costs. Instead of crashing on
`cast<FixedVectorType>(DstVTy)` when the type is a scalable vector,
return an Invalid cost.

Reviewed By: david-arm

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

2 years ago[X86] Add i128 div-mod-pair test coverage
Simon Pilgrim [Sat, 24 Jul 2021 13:00:40 +0000 (14:00 +0100)]
[X86] Add i128 div-mod-pair test coverage

2 years ago[SVE][NFC] Cleanup fixed length code gen tests to make them more resilient.
Paul Walker [Thu, 22 Jul 2021 16:09:18 +0000 (17:09 +0100)]
[SVE][NFC] Cleanup fixed length code gen tests to make them more resilient.

Many of the tests have used NEXT when DAG is more approprite. In
some cases single DAG lines have been used. Note that these are
manual tests because they're to complex for update_llc_test_checks.py
and so it's worth not relying too much on the ordered output.

I've also made the CHECK lines more uniform when it comes to the
ordering of things like LO/HI.

2 years ago[CGP] despeculateCountZeros - Don't create is-zero branch if cttz/ctlz source is...
Simon Pilgrim [Sat, 24 Jul 2021 11:58:02 +0000 (12:58 +0100)]
[CGP] despeculateCountZeros - Don't create is-zero branch if cttz/ctlz source is known non-zero

If value tracking can confirm that the cttz/ctlz source is known non-zero then we don't need to create a branch (which DAG will struggle to recover from).

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

2 years ago[gn build] Port 6aa9e746ebde
LLVM GN Syncbot [Sat, 24 Jul 2021 12:03:50 +0000 (12:03 +0000)]
[gn build] Port 6aa9e746ebde

2 years ago[AVR] Only support sp, r0 and r1 in llvm.read_register
Ayke van Laethem [Thu, 18 Feb 2021 17:02:13 +0000 (18:02 +0100)]
[AVR] Only support sp, r0 and r1 in llvm.read_register

Most other registers are allocatable and therefore cannot be used.

This issue was flagged by the machine verifier, because reading other
registers is considered reading from an undefined register.

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

2 years ago[AVR] Fix rotate instructions
Ayke van Laethem [Thu, 18 Feb 2021 15:12:11 +0000 (16:12 +0100)]
[AVR] Fix rotate instructions

This patch fixes some issues with the RORB pseudo instruction.

  - A minor issue in which the instructions were said to use the SREG,
    which is not true.
  - An issue with the BLD instruction, which did not have an output operand.
  - A major issue in which invalid instructions were generated. The fix
    also reduce RORB from 4 to 3 instructions, so it's also a small
    optimization.

These issues were flagged by the machine verifier.

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

2 years ago[AVR] Expand large shifts early in IR
Ayke van Laethem [Sun, 14 Feb 2021 22:29:59 +0000 (23:29 +0100)]
[AVR] Expand large shifts early in IR

This patch makes sure shift instructions such as this one:

    %result = shl i32 %n, %amount

are expanded just before the IR to SelectionDAG conversion to a loop so
that calls to non-existing library functions such as __ashlsi3 are
avoided. The generated code is currently pretty bad but there's a lot of
room for improvement: the shift itself can be done in just four
instructions.

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

2 years ago[AVR] Improve 8/16 bit atomic operations
Ayke van Laethem [Sat, 20 Feb 2021 19:51:38 +0000 (20:51 +0100)]
[AVR] Improve 8/16 bit atomic operations

There were some serious issues with atomic operations. This patch should
fix the biggest issues.

For details on the issue take a look at this Compiler Explorer sample:
https://godbolt.org/z/n3ndhn

Code:

    void atomicadd(_Atomic char *val) {
        *val += 5;
    }

Output:

    atomicadd:
        movw    r26, r24
        ldi     r24, 5     ; 'operand' register
        in      r0, 63
        cli
        ld      r24, X     ; load value
        add     r24, r26   ; value += X
        st      X, r24     ; store value back
        out     63, r0
        ret                ; return the wrong value (in r24)

There are various problems with this.

 - The value to add (5) is stored in r24. However, the value to add to
   is loaded in the same register: r24.
 - The `add` instruction adds half of the pointer to the loaded value,
   instead of (attempting to) add the operand with value 5.
 - The output value of the cmpxchg instruction (which is not used in
   this code sample) is the new value with 5 added, not the old value.
   The LangRef specifies that it has to be the old value, before the
   operation.

This patch fixes the first two and leaves the third problem to be fixed
at a later date. I believe atomics were mostly broken before this patch,
with this patch they should become usable as long as you ignore the
output of the atomic operation. In particular it fixes the following
things:

 - It sets the earlyclobber flag for the input ('$operand' operand) so
   that the register allocator puts it in a different register than the
   output value.
 - It fixes a number of issues with the pseudo op expansion pass, for
   example now it adds the $operand field instead of the pointer. This
   fixes most machine instruction verifier issues (other flagged issues
   are unrelated to atomics).

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

2 years ago[AVR] Set R31R30 as clobbered after ADJCALLSTACKDOWN
Ayke van Laethem [Tue, 2 Mar 2021 00:21:41 +0000 (01:21 +0100)]
[AVR] Set R31R30 as clobbered after ADJCALLSTACKDOWN

In most cases, using R31R30 is fine because the call (which always
precedes ADJCALLSTACKDOWN) will clobber R31R30 anyway. However, in some
rare cases the register allocator might insert an instruction between
the call and the ADJCALLSTACKDOWN instruction and expect the register
pair to be live afterwards. I think this happens as a result of
rematerialization. Therefore, to fix this, the instruction needs to have
Defs set to R31R30.

Setting the Defs field does have the effect of making the instruction
look dead, which it certainly is not. This is fixed by setting
hasSideEffects to true.

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

2 years ago[AVR] Do not chain stores in call frame setup
Ayke van Laethem [Wed, 3 Mar 2021 13:23:31 +0000 (14:23 +0100)]
[AVR] Do not chain stores in call frame setup

Previously, AVRTargetLowering::LowerCall attempted to keep stack stores
in order with chains. Perhaps this worked in the past, but it does not
work now: it appears that the SelectionDAG legalization phase removes
these chains. Therefore, I've removed these chains entirely to match
X86 (which, similar to AVR, also prefers to use push instructions over
stack-relative stores to set up a call frame). With this change, all the
stack stores are in a somewhat reasonable order.

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

2 years ago[lld][WebAssembly] Align __heap_base
Ayke van Laethem [Wed, 21 Jul 2021 21:35:10 +0000 (23:35 +0200)]
[lld][WebAssembly] Align __heap_base

__heap_base was not aligned. In practice, it will often be aligned
simply because it follows the stack, but when the stack is placed at the
beginning (with the --stack-first option), the __heap_base might be
unaligned. It could even be byte-aligned.

At least wasi-libc appears to expect that __heap_base is aligned:
https://github.com/WebAssembly/wasi-libc/blob/659ff414560721b1660a19685110e484a081c3d4/dlmalloc/src/malloc.c#L5224

While WebAssembly itself does not appear to require any alignment for
memory accesses, it is sometimes required when sharing a pointer
externally. For example, WASI might expect alignment up to 8:
https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#-timestamp-u64

This issue got introduced with the addition of the --stack-first flag:
https://reviews.llvm.org/D46141
I suspect the lack of alignment wasn't intentional here.

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

2 years ago[mlir] ConversionTarget legality callbacks refactoring
Butygin [Tue, 6 Jul 2021 16:11:16 +0000 (19:11 +0300)]
[mlir] ConversionTarget legality callbacks refactoring

* Get rid of Optional<std::function> as std::function already have a null state
* Add private setLegalityCallback function to set legality callback for unknown ops
* Get rid of unknownOpsDynamicallyLegal flag, use unknownLegalityFn state insted. This causes behavior change when user first calls markUnknownOpDynamicallyLegal with callback and then without but I am not sure is the original behavior was really a 'feature', or just oversignt in the original implementation.

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

2 years ago[clang][patch] Remove test artifact before running test for consistent results
Melanie Blower [Sat, 24 Jul 2021 11:52:11 +0000 (07:52 -0400)]
[clang][patch] Remove test artifact before running test for consistent results

Fix non-deterministic test behavior by removing previously-created
test directory, see comments in D95159

2 years ago[DAG] Add initial SelectionDAG::isGuaranteedNotToBeUndefOrPoison framework (PR51129)
Simon Pilgrim [Sat, 24 Jul 2021 10:36:20 +0000 (11:36 +0100)]
[DAG] Add initial SelectionDAG::isGuaranteedNotToBeUndefOrPoison framework (PR51129)

I've setup the basic framework for the isGuaranteedNotToBeUndefOrPoison call and updated DAGCombiner::visitFREEZE to use it, further Opcodes can be handled when we have test coverage.

I'm not aware of any vector test freeze coverage so the DemandedElts (and the Depth) args are not being used yet - but they are in place.

SelectionDAG::isGuaranteedNotToBePoison wrappers have also been added.

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

2 years ago[x86] add more tests for add with CMOV of constants; NFC
Sanjay Patel [Fri, 23 Jul 2021 15:59:49 +0000 (11:59 -0400)]
[x86] add more tests for add with CMOV of constants; NFC

See D106607 / https://llvm.org/PR51069 for details.

2 years ago[llvm] Inline getAssociatedFunction() in LLVM_DEBUG.
Alexander Belyaev [Sat, 24 Jul 2021 09:49:17 +0000 (11:49 +0200)]
[llvm] Inline getAssociatedFunction() in LLVM_DEBUG.

Function* F is used only inside LLVM_DEBUG, so that it causes unused
variable warning.

2 years ago[InstCombine] Add freezeAllUsesOfArgument to visitFreeze
hyeongyu kim [Sat, 24 Jul 2021 09:06:21 +0000 (18:06 +0900)]
[InstCombine] Add freezeAllUsesOfArgument to visitFreeze

In D106041, a freeze was added before the branch condition to solve the miscompilation problem of SimpleLoopUnswitch.
However, I found that the added freeze disturbed other optimizations in the following situations.
```
arg.fr = freeze(arg)
use(arg.fr)
...
use(arg)
```
It is a problem that occurred when arg and arg.fr were recognized as different values.
Therefore, changing to use arg.fr instead of arg throughout the function eliminates the above problem.
Thus, I add a function that changes all uses of arg to freeze(arg) to visitFreeze of InstCombine.

Reviewed By: nikic

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

2 years agoRevert D106195 "[dfsan] Add wrappers for v*printf functions"
George Balatsouras [Sat, 24 Jul 2021 07:37:39 +0000 (07:37 +0000)]
Revert D106195 "[dfsan] Add wrappers for v*printf functions"

This reverts commit bf281f364757d6af8d9d8456f26d334d1eeaf575.

This commit causes dfsan to segfault.

2 years ago[SimplifyCFG] Add additional if conversion tests (NFC)
Nikita Popov [Sat, 24 Jul 2021 08:35:02 +0000 (10:35 +0200)]
[SimplifyCFG] Add additional if conversion tests (NFC)

Test a readonly call in between, as well as the combination of
an atomic and simple store.

2 years ago[CMake] Add LIBXML2_DEFINITIONS when testing for symbol existance
Markus Böck [Sat, 24 Jul 2021 07:54:21 +0000 (09:54 +0200)]
[CMake] Add LIBXML2_DEFINITIONS when testing for symbol existance

Currently when linking LLVM against Libxml2, a simple check is performed to check whether it can be linked successfully. This check currently adds the include directories and the libraries for libxml2, but not definitions found by the config.

This causes issues on Windows when trying to link against a static libxml2. Libxml2 requires LIBXML_STATIC to be defined in the preprocessor to be able to link statically. This definition is put into LIBXML2_DEFINITIONS in the cmake config, but not properly forwarded to check_symbol_exists leading to it failing as it could not find xmlReadMemory in a DLL.

This patch simply appends the content of LIBXML2_DEFINITIONS to the symbol check definitions, fixing the issue.

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

2 years ago[CMake] Don't LTO optimize targets on Darwin, but only if its not ThinLTO
Azharuddin Mohammed [Wed, 21 Jul 2021 22:41:24 +0000 (15:41 -0700)]
[CMake] Don't LTO optimize targets on Darwin, but only if its not ThinLTO

This is just a workaround. Pass the `-mllvm,-O0` link flags only if its
not ThinLTO. Doing that with ThinLTO currently results in an error:

```
Remaining virtual register operands
UNREACHABLE executed at .../llvm/lib/CodeGen/MachineRegisterInfo.cpp:209!
```

2 years ago[GlobalISel] Add GUnmerge, GMerge, GConcatVectors, GBuildVector abstractions. NFC.
Amara Emerson [Sat, 24 Jul 2021 04:55:47 +0000 (21:55 -0700)]
[GlobalISel] Add GUnmerge, GMerge, GConcatVectors, GBuildVector abstractions. NFC.

Use these to slightly simplify some code in the artifact combiner.

2 years agoRe-re-re-apply "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."
Lang Hames [Thu, 22 Jul 2021 00:52:25 +0000 (10:52 +1000)]
Re-re-re-apply "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."

The ccache builders have recevied a config update that should eliminate the
build issues seen previously.

2 years ago[gn build] Port 96709823ec37
LLVM GN Syncbot [Sat, 24 Jul 2021 03:08:02 +0000 (03:08 +0000)]
[gn build] Port 96709823ec37

2 years ago[AMDGPU] Deduce attributes with the Attributor
Kuter Dinel [Sun, 27 Jun 2021 17:41:56 +0000 (20:41 +0300)]
[AMDGPU] Deduce attributes with the Attributor

This patch introduces a pass that uses the Attributor to deduce AMDGPU specific attributes.

Reviewed By: jdoerfert, arsenm

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

2 years ago[flang] runtime: fix problems with I/O around EOF & delimited characters
peter klausler [Thu, 22 Jul 2021 16:47:37 +0000 (09:47 -0700)]
[flang] runtime: fix problems with I/O around EOF & delimited characters

When a WRITE overwrites an endfile record, we need to forget
that there was an endfile record.  When doing a BACKSPACE
after an explicit ENDFILE statement, the position afterwards
must be upon the endfile record.

Attempts to join list-directed delimited character input across
record boundaries was due to a bad reading of the standard
and has been deleted, now that the requirements are better understood.
This problem would cause a read attempt past EOF if a delimited
character input value was at the end of a record.

It turns out that delimited list-directed (and NAMELIST) character
output is required to emit contiguous doubled instances of the
delimiter character when it appears in the output value.  When
fixed-size records are being emitted, as is the case with internal
output, this is not possible when the problematic character falls
on the last position of a record.  No two other Fortran compilers
do the same thing in this situation so there is no good precedent
to follow.

Because it seems least wrong, with this patch we now emit one copy
of the delimiter as the last character of the current record and
another as the first character of the next record.  (The
second-least-wrong alternative might be to flag a runtime error,
but that seems harsh since it's not an explicit error in the standard,
and the output may not have to be usable later as input anyway.)
Consequently, the output is not suitable for use as list-directed or
NAMELIST input.

If a later standard were to clarify this case, this behavior will of
course change as needed to conform.

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

2 years ago[flang] Runtime: Reset list-directed input state for each NAMELIST item
peter klausler [Wed, 21 Jul 2021 20:07:04 +0000 (13:07 -0700)]
[flang] Runtime: Reset list-directed input state for each NAMELIST item

NAMELIST I/O formatting uses the runtime infrastructure for
list-directed I/O.  List-directed input processing has same state
that requires reinitialization for each successive NAMELIST input
item.  This patch fixes bugs with "null" items and repetition counts
on NAMELIST input items after the first in the group.

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

2 years ago[LLDB][GUI] Check fields validity in actions
Omar Emara [Sat, 24 Jul 2021 01:02:24 +0000 (18:02 -0700)]
[LLDB][GUI] Check fields validity in actions

This patch adds a virtual method HasError to fields, it can be
overridden by fields that have errors. Additionally, a form method
CheckFieldsValidity was added to be called by actions that expects all
the field to be valid.

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

2 years ago[LLDB][GUI] Add Platform Plugin Field
Omar Emara [Sat, 24 Jul 2021 00:59:02 +0000 (17:59 -0700)]
[LLDB][GUI] Add Platform Plugin Field

This patch adds a new Platform Plugin Field. It is a choices field that
lists all the available platform plugins and can retrieve the name of the
selected plugin. The default selected plugin is the currently selected
one. This patch also allows for arbitrary scrolling to make scrolling
easier when setting choices.

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

2 years ago[source maps] fix source mapping when there are multiple matching rules
Walter Erquinigo [Fri, 23 Jul 2021 23:21:05 +0000 (16:21 -0700)]
[source maps] fix source mapping when there are multiple matching rules

D104406 introduced an error in which, if there are multiple matchings rules for a given path, lldb was only checking for the validity in the filesystem of the first match instead of looking exhaustively one by one until a valid file is found.

Besides that, a call to consume_front was being done incorrectly, as it was modifying the input, which renders subsequent matches incorrect.

I added a test that checks for both cases.

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

2 years ago[tests] SCEV trip count w/ neg step and varying rhs
Philip Reames [Sat, 24 Jul 2021 00:19:34 +0000 (17:19 -0700)]
[tests] SCEV trip count w/ neg step and varying rhs

2 years agoStyle tweaks for SCEV's computeMaxBECountForLT [NFC]
Philip Reames [Sat, 24 Jul 2021 00:10:02 +0000 (17:10 -0700)]
Style tweaks for SCEV's computeMaxBECountForLT [NFC]

2 years ago[LangRef] Clarify comdat
Fangrui Song [Fri, 23 Jul 2021 23:33:06 +0000 (16:33 -0700)]
[LangRef] Clarify comdat

* ELF supports `nodeduplicate`.
* ELF calls the concept "section group". `GRP_COMDAT` emulates the PE COMDAT deduplication feature.
* "COMDAT group" is an ELF term. Avoid it for PE/COFF.
* WebAssembly supports comdat but only supports the `any` selection kind. https://bugs.llvm.org/show_bug.cgi?id=50531
* A comdat must be included or omitted as a unit. Both the compiler and the linker must obey this rule.
* A global object can be a member of at most one comdat.
* COFF requires a non-local linkage for non-`nodeduplicate` selection kinds.
* llvm.global_ctors/.llvm.global_dtors: if the third field is used on ELF, it must reference a global variable or function in a comdat

Reviewed By: rnk

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

2 years ago[Attributor][FIX] checkForAllInstructions, correctly handle declarations
Kuter Dinel [Thu, 22 Jul 2021 03:19:07 +0000 (06:19 +0300)]
[Attributor][FIX] checkForAllInstructions, correctly handle declarations

checkForAllInstructions was not handling declarations correctly.
It should have been returning false when it gets called on a declaration

The patch also fixes a test case for AAFunctionReachability for it to be able
to pass after the changes to the checkForAllinstructions.

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

2 years ago[cmake] Export LLVM_HOST_TRIPLE in the LLVMConfig.cmake
Stella Stamenova [Fri, 23 Jul 2021 22:52:36 +0000 (15:52 -0700)]
[cmake] Export LLVM_HOST_TRIPLE in the LLVMConfig.cmake

This is referenced in several of the cmake files that are part of an llvm install and it is also useful by downstream components such as onnx-mlir.

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

2 years ago[SCEV] Fix bug involving zero step and non-invariant RHS in trip count logic
Philip Reames [Fri, 23 Jul 2021 22:18:01 +0000 (15:18 -0700)]
[SCEV] Fix bug involving zero step and non-invariant RHS in trip count logic

Eli pointed out the issue when reviewing D104140. The max trip count logic makes an assumption that the value of IV changes. When the step is zero, the nowrap fact becomes trivial, and thus there's nothing preventing the loop from being nearly infinite. (The "nearly" part is because mustprogress may disallow an infinite loop while still allowing 999999999 iterations before RHS happens to allow an exit.)

This is very difficult to see in practice. You need a means to produce a loop varying RHS in a mustprogress loop which doesn't allow the loop to be infinite. In most cases, LICM or SCEV are smart enough to remove the loop varying expressions.

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

2 years ago[libc] Accommodate Fuchsia's death test framework in fenv tests.
Siva Chandra Reddy [Fri, 23 Jul 2021 16:56:56 +0000 (16:56 +0000)]
[libc] Accommodate Fuchsia's death test framework in fenv tests.

Fuchsia's death test framework runs the closure which can die in a
different thread. Hence, the FP exceptions which cause the closure to
die should be enalbed in the closure.

Reviewed By: michaelrj

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

2 years ago[lld/mac] Fix comment typo in new start-end.s test
Nico Weber [Fri, 23 Jul 2021 22:14:26 +0000 (18:14 -0400)]
[lld/mac] Fix comment typo in new start-end.s test

2 years ago[Bazel] Swap stray td_srcs to deps
Geoffrey Martin-Noble [Fri, 23 Jul 2021 21:50:58 +0000 (14:50 -0700)]
[Bazel] Swap stray td_srcs to deps

This is the last instance of td_srcs in MLIR core build files. `deps` is
generally preferred. There are still some cases where `td_srcs` is
useful where creating a td_library would just be another layer of
indirection, so not (yet) dropping it entirely.

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

2 years ago[NFC][SimplifyCFG] Add tests for `FoldTwoEntryPHINode()` with prof md
Roman Lebedev [Fri, 23 Jul 2021 15:10:39 +0000 (18:10 +0300)]
[NFC][SimplifyCFG] Add tests for `FoldTwoEntryPHINode()` with prof md

2 years ago[ConstantFold] Fix GEP of GEP fold with opaque pointers
Nikita Popov [Fri, 23 Jul 2021 21:56:41 +0000 (23:56 +0200)]
[ConstantFold] Fix GEP of GEP fold with opaque pointers

This was previously combining indices even though they operate on
different types. For non-opaque pointers, the condition is
automatically satisfied based on the pointer types being equal.

2 years ago[ConstantFold] Extract GEP of GEP fold (NFCI)
Nikita Popov [Fri, 23 Jul 2021 20:46:52 +0000 (22:46 +0200)]
[ConstantFold] Extract GEP of GEP fold (NFCI)

Move this fold into a separate function and clean up the control
flow a bit.

2 years ago[WebAssembly] Codegen for pmin and pmax
Thomas Lively [Fri, 23 Jul 2021 21:49:20 +0000 (14:49 -0700)]
[WebAssembly] Codegen for pmin and pmax

Replace the clang builtins and LLVM intrinsics for {f32x4,f64x2}.{pmin,pmax}
with standard codegen patterns. Since wasm_simd128.h uses an integer vector as
the standard single vector type, the IR for the pmin and pmax intrinsic
functions contains bitcasts that would not be there otherwise. Add extra codegen
patterns that can still select the pmin and pmax instructions in the presence of
these bitcasts.

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

2 years ago[WebAssembly][NFC] Simplify SIMD bitconvert pattern
Thomas Lively [Fri, 23 Jul 2021 21:43:48 +0000 (14:43 -0700)]
[WebAssembly][NFC] Simplify SIMD bitconvert pattern

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

2 years ago[OpenMP] always compile with c++14 instead of gnu++14
Ye Luo [Fri, 23 Jul 2021 21:28:53 +0000 (17:28 -0400)]
[OpenMP] always compile with c++14 instead of gnu++14

Fixes PR 51174. c++14 should be a more portable option than gnu++14.

Reviewed By: tianshilei1992

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

2 years ago[NFC][SimplifyCFG] Make 'conditional block' handling more straight-forward
Roman Lebedev [Fri, 23 Jul 2021 20:10:46 +0000 (23:10 +0300)]
[NFC][SimplifyCFG] Make 'conditional block' handling more straight-forward

This will simplify making use of profile weights
to not perform the speculation when obviously unprofitable.

2 years ago[NFC][SimplifyCFG] FoldTwoEntryPHINode(): make better use of GetIfCondition() returni...
Roman Lebedev [Fri, 23 Jul 2021 19:51:36 +0000 (22:51 +0300)]
[NFC][SimplifyCFG] FoldTwoEntryPHINode(): make better use of GetIfCondition() returning dom block

2 years ago[NFC][BasicBlockUtils] Refactor GetIfCondition() to return the branch, not it's condition
Roman Lebedev [Fri, 23 Jul 2021 19:29:04 +0000 (22:29 +0300)]
[NFC][BasicBlockUtils] Refactor GetIfCondition() to return the branch, not it's condition

Otherwise e.g. the FoldTwoEntryPHINode() has to do a lot of legwork
to re-deduce what is the dominant block (i.e. for which block
is this branch the terminator).

2 years ago[NewPM] Add CrossDSOCFI pass irrespective of LTO optimization level
Pirama Arumuga Nainar [Fri, 23 Jul 2021 19:16:22 +0000 (12:16 -0700)]
[NewPM] Add CrossDSOCFI pass irrespective of LTO optimization level

This pass is not an optimization and is needed for CFI functionality
(cross-dso verification).

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

2 years ago[libc] Clean up Windows macros
Caitlyn Cano [Fri, 23 Jul 2021 20:39:09 +0000 (20:39 +0000)]
[libc] Clean up Windows macros

This clean-up removes checks for _WIN64, as the _WIN32 macro returns 1
whenever the compilation targe is 32- or 64-bit ARM.

Reviewed By: aeubanks

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

2 years ago[lld/mac] Fix start-stop.s test with expensive checks enabled
Nico Weber [Fri, 23 Jul 2021 20:54:19 +0000 (16:54 -0400)]
[lld/mac] Fix start-stop.s test with expensive checks enabled

See e.g. https://lab.llvm.org/buildbot/#/builders/16/builds/14317
Not 100% sure why this fails yet, but this fixes it. Let's get
the bots green again first :)

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

2 years ago[OpenMP] Fix bug 50022
Shilei Tian [Fri, 23 Jul 2021 20:53:56 +0000 (16:53 -0400)]
[OpenMP] Fix bug 50022

Bug 50022 [0] reports target nowait fails in certain case, which is added in this
patch. The root cause of the failure is, when the second task is created, its
parent's `td_incomplete_child_tasks` will not be incremented because there is no
parallel region here thus its team is serialized. Therefore, when the initial
thread is waiting for its unfinished children tasks, it thought there is only
one, the first task, because it is hidden helper task, so it is tracked. The
second task will only be pushed to the queue when the first task is finished.
However, when the first task finishes, it first decrements the counter of its
parent, and then release dependences. Once the counter is decremented, the thread
will move on because its counter is reset, but actually, the second task has not
been executed at all. As a result, since in this case, the main function finishes,
then `libomp` starts to destroy. When the second task is pushed somewhere, all
some of the structures might already have already been destroyed, then anything
could happen.

This patch simply moves `__kmp_release_deps` ahead of decrement of the counter.
In this way, we can make sure that the initial thread is aware of the existence
of another task(s) so it will not move on. In addition, in order to tackle
dependence chain starting with hidden helper thread, when hidden helper task is
encountered, we force the task to release dependences.

Reference:
[0] https://bugs.llvm.org/show_bug.cgi?id=50022

Reviewed By: AndreyChurbanov

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

2 years ago[Libomptarget] Add unroll flag to shared variables loop
Joseph Huber [Fri, 23 Jul 2021 18:50:25 +0000 (14:50 -0400)]
[Libomptarget] Add unroll flag to shared variables loop

Unrolling this loop provides better performance in practice because it is
executed on the device and is likely to be very small.

Reviewed By: tianshilei1992

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

2 years ago[compiler-rt][NFC] add debugging options to iossim_run
Emily Shi [Fri, 23 Jul 2021 19:21:17 +0000 (12:21 -0700)]
[compiler-rt][NFC] add debugging options to iossim_run

Add the ability to:
1. tell simctl to wait for debugger when spawning process
2. print the command that is called to launch the process

Reviewed By: delcypher

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

2 years ago[MLIR][NFC] Minor cleanup in liveness.
Rahul Joshi [Fri, 23 Jul 2021 20:12:31 +0000 (13:12 -0700)]
[MLIR][NFC] Minor cleanup in liveness.

- Rename isLastUse to isDeadAfter to reflect what the function does.
- Avoid a second walk over all operations in BlockInfoBuilder constructor.
- use std::move() to save the new in set.

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

2 years ago[NFC][compiler-rt] tidy up some whitespace in lit config
Emily Shi [Fri, 23 Jul 2021 20:19:54 +0000 (13:19 -0700)]
[NFC][compiler-rt] tidy up some whitespace in lit config

2 years ago[MergeICmps] Relax sinking check
Nikita Popov [Thu, 22 Jul 2021 20:20:25 +0000 (22:20 +0200)]
[MergeICmps] Relax sinking check

The check for sinking instructions past the load + cmp sequence
currently checks for side-effects, which includes writing to memory
and unwinding. However, I don't believe we care about sinking the
instructions past an unwind (as they don't have any side-effects
themselves).

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

2 years ago[OpenMP][Offloading] Fix data race in data mapping by using two locks
Shilei Tian [Fri, 23 Jul 2021 20:10:42 +0000 (16:10 -0400)]
[OpenMP][Offloading] Fix data race in data mapping by using two locks

This patch tries to partially fix one of the two data race issues reported in
[1] by introducing a per-entry mutex. Additional discussion can also be found in
D104418, which will also be refined to fix another data race problem.

Here is how it works. Like before, `DataMapMtx` is still being used for mapping
table lookup and update. In any case, we will get a table entry. If we need to
make a data transfer (update the data on the device), we need to lock the entry
right before releasing `DataMapMtx`, and the issue of data transfer should be
after releasing `DataMapMtx`, and the entry is unlocked afterwards. This can
guarantee that: 1) issue of data movement is not in critical region, which will
not affect performance too much, and also will not affect other threads that don't
touch the same entry; 2) if another thread accesses the same entry, the state of
data movement is consistent (which requires that a thread must first get the
update lock before getting data movement information).

For a target that doesn't support async data transfer, issue of data movement is
data transfer. This two-lock design can potentially improve concurrency compared
with the design that guards data movement with `DataMapMtx` as well. For a target
that supports async data movement, we could simply attach the event between the
issue of data movement and unlock the entry. For a thread that wants to get the
event, it must first get the lock. This can also get rid of the busy wait until
the event pointer is valid.

Reference:
[1] https://bugs.llvm.org/show_bug.cgi?id=49940

Reviewed By: grokos

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

2 years ago[CMake] Add version to libLLVM also on non-UNIX
Martin Storsjö [Fri, 23 Jul 2021 19:52:07 +0000 (22:52 +0300)]
[CMake] Add version to libLLVM also on non-UNIX

As discussed in https://reviews.llvm.org/D87521

llvm-config expects versioned library regardless of platform.

Reviewed By: mstorsjo

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

2 years ago[llvm-rc] Allow dashes as part of resource name strings
Martin Storsjö [Thu, 22 Jul 2021 21:36:05 +0000 (00:36 +0300)]
[llvm-rc] Allow dashes as part of resource name strings

This matches what MS rc.exe allows in practice. I'm not aware of
any legal syntax case that are broken by allowing dashes as part
of what the tokenizer considers an Identifier - but I'm not
very well versed in the RC syntax either, can @amccarth think of
any case that would be broken by this?

This fixes downstream bug
https://github.com/msys2/MINGW-packages/issues/9180.

Additionally, rc.exe allows such resource name strings to be surrounded
by quotes, ending up with e.g.

    Resource name (string): "QUOTEDNAME"

(i.e., the quotes end up as part of the string), which llvm-rc doesn't
support yet either. (I'm not aware of such cases in the wild though,
but resource string names with dashes do exist.)

This also allows including files with unquoted paths, with filenames
containing dashes (which fixes
https://github.com/msys2/MINGW-packages/issues/9130, which has been
worked around differently so far).

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

2 years ago[lld/mac] Implement support for section$start and section$ end symbols
Nico Weber [Thu, 15 Jul 2021 16:54:42 +0000 (12:54 -0400)]
[lld/mac] Implement support for section$start and section$ end symbols

With this, libclang_rt.profile_osx.a can be linked, that is coverage
and PGO-instrumented builds should now work with lld.

section$start and section$end symbols can create non-existing sections.
They're also undefined symbols that are only magic if there isn't a
regular symbol with their name, which means the need to be handled
in treatUndefined() instead of just looping over all existing
sections and adding start and end symbols like the ELF port does.

To represent the actual symbols, this uses absolute symbols that
get their value updated once an output section is layed out.

segment$start and segment$end are still missing for now, but they produce a
nicer error message after this patch.

Main part of PR50760.

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

2 years ago[libunwind] Allow restoring SP while unwinding.
Marco Vanotti [Fri, 23 Jul 2021 00:58:23 +0000 (17:58 -0700)]
[libunwind] Allow restoring SP while unwinding.

This commit modifies stepWithDwarf allowing for CFI directives to
specify the value of the stack pointer.

Previously, the SP would be unconditionally set to the CFA, because it
(wrongly) stated that the CFA is the stack pointer at the call site of a
function, but that is not always true.

One situation in which that is false, is for example if you have
switched stacks. In that case if you set the CFA to the SP before
switching the stack, the CFA would be far away from where the current
call frame is located.

The CFA always points to the current call frame, and that call frame
could have a CFI directive that specifies how to restore the stack
pointer. If not, it is OK to fallback and set the SP = CFA.

This change sets SP = CFA before restoring the registers during
unwinding, allowing the stack frame to be restored with a value
different than the CFA.

Reviewed By: #libunwind, phosek

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

2 years agoRevert "[FPEnv][InstSimplify] Enable more folds for constrained fadd"
Kevin P. Neal [Fri, 23 Jul 2021 19:09:05 +0000 (15:09 -0400)]
Revert "[FPEnv][InstSimplify] Enable more folds for constrained fadd"

Build bots have started failing.

This reverts commit 64c2b2c69d61dbb6459037a7bfddf29e1f280c8f.

2 years ago[FPEnv][InstSimplify] Enable more folds for constrained fadd
Kevin P. Neal [Fri, 23 Jul 2021 18:56:41 +0000 (14:56 -0400)]
[FPEnv][InstSimplify] Enable more folds for constrained fadd

Precommit tests.

2 years ago[llvm][NFC] Fix typos in Errc.h description
Cyndy Ishida [Fri, 23 Jul 2021 18:54:49 +0000 (11:54 -0700)]
[llvm][NFC] Fix typos in Errc.h description

2 years agoRevert "Delete PrintingPolicy's copy constructor/operator."
Erich Keane [Fri, 23 Jul 2021 18:24:30 +0000 (11:24 -0700)]
Revert "Delete PrintingPolicy's copy constructor/operator."

My test that showed we don't copy it was wrong!

This reverts commit 68ef916659b9cd4127276f9502fc2870ca6cfdea.

2 years agoDelete PrintingPolicy's copy constructor/operator.
Erich Keane [Fri, 23 Jul 2021 18:22:52 +0000 (11:22 -0700)]
Delete PrintingPolicy's copy constructor/operator.

This type is 'fat' now thanks to the callbacks, so it should never be
copied as far as I know.  Delete the copy operations so that we don't do
so accidentially.

2 years ago[NFC][MLGO] Just use the underlying protobuf object for logging
Mircea Trofin [Thu, 22 Jul 2021 19:45:32 +0000 (12:45 -0700)]
[NFC][MLGO] Just use the underlying protobuf object for logging

Avoid buffering just to copy the buffered data, in 'development
mode', when logging. Instead, just populate the underlying protobuf.

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

2 years ago[mlir][linalg] Add pooling_nchw_max, conv_2d_nchw as yaml ops.
Yi Zhang [Fri, 23 Jul 2021 16:15:21 +0000 (16:15 +0000)]
[mlir][linalg] Add pooling_nchw_max, conv_2d_nchw as yaml ops.

- Add pooling_nchw_max.
- Move conv_2d_nchw to yaml ops and add strides and dilation attributes.

Reviewed By: gysit

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

2 years ago[AbstractAttributor] Refine logic to indicate pessimistic fixed point when folding...
Shilei Tian [Fri, 23 Jul 2021 17:36:27 +0000 (13:36 -0400)]
[AbstractAttributor] Refine logic to indicate pessimistic fixed point when folding `__kmpc_is_spmd_exec_mode`

Since we are using assumed information now, the logic should be refined to avoid
unncessary assertion.

Reviewed By: jdoerfert

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

2 years ago[libc] add option to use SCUDO as the allocator
Michael Jones [Wed, 21 Jul 2021 22:17:15 +0000 (22:17 +0000)]
[libc] add option to use SCUDO as the allocator

This patch adds LLVM_LIBC_INCLUDE_SCUDO as a flag. When enabled it
should link in the standalone version of SCUDO as the allocator for LLVM
libc.

Reviewed By: sivachandra

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

2 years agoRevert "Update isl to isl-0.24-69-g54aac5ac"
Riccardo Mori [Fri, 23 Jul 2021 17:06:52 +0000 (19:06 +0200)]
Revert "Update isl to isl-0.24-69-g54aac5ac"

This reverts commit 13f95cc3d10d9884acd2dbfc112e3c7079403c0a.

The commit makes some polly tests failing

2 years agoRevert "[clang] -falign-loops="
Fangrui Song [Fri, 23 Jul 2021 16:58:35 +0000 (09:58 -0700)]
Revert "[clang] -falign-loops="

This reverts commit 42896eeed9e3d12e7e38217a0d7e35b9736451ac.

Unfinished. Accidentally pushed when reverting a clangd commit.

2 years agoRevert D106562 "[clangd] Get rid of arg adjusters in CommandMangler"
Fangrui Song [Fri, 23 Jul 2021 16:50:43 +0000 (09:50 -0700)]
Revert D106562 "[clangd] Get rid of arg adjusters in CommandMangler"

This reverts commit 1c0d0085bcaaf27cc8d9492eb3c5c05058e54b8e.

This commit made unittest BuildCompilerInvocation.DropsPlugins crash.

2 years ago[clang] -falign-loops=
Fangrui Song [Fri, 23 Jul 2021 16:38:18 +0000 (09:38 -0700)]
[clang] -falign-loops=

2 years agoUpdate isl to isl-0.24-69-g54aac5ac
Riccardo Mori [Fri, 23 Jul 2021 16:46:48 +0000 (18:46 +0200)]
Update isl to isl-0.24-69-g54aac5ac

This is needed for having the functions isl_{set,map}_n_basic_{set,map}
exported to the C++ interface

2 years ago[libcxx][nfc] Cleanup libc++ specific tests.
Mark de Wever [Fri, 23 Jul 2021 15:19:34 +0000 (17:19 +0200)]
[libcxx][nfc] Cleanup libc++ specific tests.

Move the tests to libcxx so they no longer need `REQUIRES: libc++`.
Verify tests don't need `REQUIRES: libc++`.

Reviewed By: #libc, ldionne

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

2 years ago[RISCV] Add a test showing an incorrect vsetvli insertion
Fraser Cormack [Fri, 23 Jul 2021 16:16:08 +0000 (09:16 -0700)]
[RISCV] Add a test showing an incorrect vsetvli insertion

This patch adds a reduced test case which identifies an illegal vsetvli
inserted by the compiler. The compiler emits a vsetvli which is intended
to preserve VL with the SEW/LMUL ratio e32/m1 when in fact the VL could
have been set by e64/m2 in a predecessor block.

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

2 years agoRevert "[clangd] Canonicalize compile flags before applying edits"
Kadir Cetinkaya [Fri, 23 Jul 2021 16:20:45 +0000 (18:20 +0200)]
Revert "[clangd] Canonicalize compile flags before applying edits"

This reverts commit 7cc8a8e3849dc4044cc799e2c1f6cc241b851b70.

2 years ago[gn build] Port e5d8b93e5a25
LLVM GN Syncbot [Fri, 23 Jul 2021 16:13:25 +0000 (16:13 +0000)]
[gn build] Port e5d8b93e5a25

2 years ago[gn build] Port 0ad562b48bfd
LLVM GN Syncbot [Fri, 23 Jul 2021 16:13:24 +0000 (16:13 +0000)]
[gn build] Port 0ad562b48bfd

2 years ago[RISCV] Avoid using x0,x0 vsetvli for vmv.x.s and vfmv.f.s unless we know the sew...
Craig Topper [Fri, 23 Jul 2021 16:05:23 +0000 (09:05 -0700)]
[RISCV] Avoid using x0,x0 vsetvli for vmv.x.s and vfmv.f.s unless we know the sew/lmul ratio is constant.

Since we're changing VTYPE, we may change VLMAX which could
invalidate the previous VL. If we can't tell if it is safe we
should use an AVL of 1 instead of keeping the old VL.

This is a quick fix. We may want to thread VL to the pseudo
instruction instead of making up a value. That will require ISD
opcode changes and changes to the C intrinsic interface.

This fixes the issue raised in D106286.

Reviewed By: frasercrmck

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

2 years ago[libcxx][nfc] Global `constexpr friend` -> `friend constexpr`.
zoecarver [Fri, 23 Jul 2021 16:08:18 +0000 (09:08 -0700)]
[libcxx][nfc] Global `constexpr friend` -> `friend constexpr`.

2 years ago[libcxx][ranges] Add `ranges::common_view`.
zoecarver [Fri, 9 Jul 2021 17:09:31 +0000 (10:09 -0700)]
[libcxx][ranges] Add `ranges::common_view`.

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

2 years ago[libc] Add option to run specific tests
Caitlyn Cano [Mon, 12 Jul 2021 20:32:51 +0000 (20:32 +0000)]
[libc] Add option to run specific tests

This addition reads command line input to run specific single tests
within a larger call to run all the tests for a particular function.
When the user adds a second argument to the command line, the code skips
all the tests that don't match the user's specified binary. If the user
doesn't specify a test correctly and/or no tests are run, a failure
message prints.

Reviewed By: sivachandra, aeubanks

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

2 years ago[X86] Fix a bug in TEST with immediate creation
Craig Topper [Fri, 23 Jul 2021 06:25:33 +0000 (23:25 -0700)]
[X86] Fix a bug in TEST with immediate creation

This code tries to form a TEST from CMP+AND with an optional
truncate in between. If we looked through the truncate, we may
have extra bits in the AND mask that shouldn't participate in
the checks. Normally SimplifyDemendedBits takes care of this, but
the AND may have another user. So manually mask out any extra bits.

Fixes PR51175.

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

2 years agoRevert "[clangd] Adjust compile flags to contain only the requested file as input"
Kadir Cetinkaya [Fri, 23 Jul 2021 15:57:52 +0000 (17:57 +0200)]
Revert "[clangd] Adjust compile flags to contain only the requested file as input"

This reverts commit ba5dd945ad9124f24452987be64040a6ea6cd25e.

2 years ago[JITLink] Add riscv.cpp
luxufan [Fri, 23 Jul 2021 15:52:59 +0000 (23:52 +0800)]
[JITLink] Add riscv.cpp

2 years ago[lld-macho][nfc] Add test for resolution of bitcode symbols
Jez Ng [Fri, 23 Jul 2021 15:33:33 +0000 (11:33 -0400)]
[lld-macho][nfc] Add test for resolution of bitcode symbols

We lacked a test for bitcode symbol precedence. We assumed that
they followed the same rules as their regular symbol counterparts, but
never had a test to verify that we were matching ld64's behavior. It
turns out that we were largely correct, though we deviate from ld64 when
there are bitcode and non-bitcode symbols of the same name. The test
added in this diff both verifies our behavior and documents the
differences.

Reviewed By: #lld-macho, thakis

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

2 years ago[lld-macho][nfc] Fix test to reflect that symbol attributes don't matter within an...
Jez Ng [Fri, 23 Jul 2021 15:33:30 +0000 (11:33 -0400)]
[lld-macho][nfc] Fix test to reflect that symbol attributes don't matter within an archive

We had a comment that claimed that defined symbols had priority
over common symbols if they occurred in the same archive. In fact, they
appear to have equal precedence. Our implementation already does this,
so I'm just updating the test comment. Also added a few other test
comments along the way for readability.

Reviewed By: #lld-macho, thakis

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

2 years ago[lld-macho] ICF: Do more work in equalsConstant, less in equalsVariable
Jez Ng [Fri, 23 Jul 2021 15:33:28 +0000 (11:33 -0400)]
[lld-macho] ICF: Do more work in equalsConstant, less in equalsVariable

In particular, relocations to absolute symbols or literal sections can
be handled in equalsConstant(), since their output addresses will not
change across each iteration of ICF. Offsets and addends can also be
dealt with entirely in equalsConstant(), making the code somewhat easier
to reason about. Only ConcatInputSections need to be handled in
equalsVariable().

LLD-ELF's implementation takes a similar approach.

Although this should make ICF do less work, in practice it seems like
there is no stat sig difference in time taken when linking
chromium_framework.

This refactor is motivated by an upcoming diff which improves ICF's handling of
addends.

Reviewed By: #lld-macho, gkm

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

2 years ago[lld-macho] Reorganize + extend ICF test
Jez Ng [Fri, 23 Jul 2021 15:33:26 +0000 (11:33 -0400)]
[lld-macho] Reorganize + extend ICF test

I found icf.s a bit hard to work with as it was not possible to
extend any of the functions `_a` ... `_k` to test new relocation /
referent types without modifying every single one of them. Additionally,
their one-letter names were not descriptive (though the comments
helped).

I've renamed all the functions to reflect the feature they are testing,
and shrunk them so that they contain just enough to test that one
feature.

I've also added tests for non-zero addends (via the
`_abs1a_ref_with_addend` and `_defined_ref_with_addend_1` functions).

Reviewed By: #lld-macho, gkm

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

2 years ago[JITLink][RISCV] Initial Support RISCV64 in JITLink
luxufan [Mon, 5 Jul 2021 12:04:17 +0000 (20:04 +0800)]
[JITLink][RISCV] Initial Support RISCV64 in JITLink

This patch is the initial support, it implements translation from object file to JIT link graph, and very few relocations were supported. Currently, the test file ELF_pc_indirect.s is passed, the HelloWorld program(compiled with mno-relax flag) can be linked correctly and run on instruction emulator correctly.

In the downstream implementation, I have implemented the GOT, PLT function, and EHFrame and some optimization will be implement soon. I will organize the code in to patches, then gradually send it to upstream.

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

2 years ago[lld/mac] Let OutputSegment store its start address
Nico Weber [Fri, 23 Jul 2021 14:19:06 +0000 (10:19 -0400)]
[lld/mac] Let OutputSegment store its start address

segment$start$/segment$end$ symbols allow creating segments without
sections, so getting the segment address off the first section
won't work there. Storing the address on the segment is arguably a
bit simpler too.

No behavior change, part of PR50760.

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

2 years ago[mlir][linalg] Fix bug in contraction op vectorization with output perm
thomasraoux [Wed, 21 Jul 2021 18:05:14 +0000 (11:05 -0700)]
[mlir][linalg] Fix bug in contraction op vectorization with output perm

When the output indexing map has a permutation we need to consider in
the contraction vector type.

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