platform/upstream/llvm.git
3 years ago[OpenCL] Fix typo in the test.
Anastasia Stulova [Fri, 23 Apr 2021 13:35:44 +0000 (14:35 +0100)]
[OpenCL] Fix typo in the test.

3 years ago[InstCombine] Added tests for PR50096; NFC
Dávid Bolvanský [Fri, 23 Apr 2021 13:25:27 +0000 (15:25 +0200)]
[InstCombine] Added tests for PR50096; NFC

3 years ago[lld-macho] Have tests default to targeting macos 10.15
Jez Ng [Thu, 22 Apr 2021 23:37:47 +0000 (19:37 -0400)]
[lld-macho] Have tests default to targeting macos 10.15

D101114 enforced proper version checks, which exposed a variety of version
mismatch issues in our tests. We previously changed the test inputs to
target 10.0, which was the simpler thing to do, but we should really
just have our lit.local.cfg default to targeting 10.15, which is what is done
here. We're not likely to ever have proper support for the older versions
anyway, as that would require more work for unclear benefit; for instance,
llvm-mc seems to generate a different compact unwind format for older macOS
versions, which would cause our compact-unwind.s test to fail.

Targeting 10.15 by default causes the following behavioral changes:
* `__mh_execute_header` is now a section symbol instead of an absolute symbol
* LC_BUILD_VERSION gets emitted instead of LC_VERSION_MIN_MACOSX. The former is
  32 bytes in size whereas the latter is 16 bytes, so a bunch of hardcoded
  address offsets in our tests had to be updated.
* >= 10.6 executables are PIE by default

Note that this diff was stacked atop of a local revert of most of the test
changes in rG8c17a875150f8e736e8f9061ddf084397f45f4c5, to make review easier.

Reviewed By: #lld-macho, oontvoo

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

3 years ago[X86] combineSetCCAtomicArith - pull out repeated ops. NFCI.
Simon Pilgrim [Fri, 23 Apr 2021 13:19:24 +0000 (14:19 +0100)]
[X86] combineSetCCAtomicArith - pull out repeated ops. NFCI.

Reduces diff in D101074

3 years agoAMDGPU: Fix assert on inline asm on gfx90a
Matt Arsenault [Fri, 23 Apr 2021 02:34:17 +0000 (22:34 -0400)]
AMDGPU: Fix assert on inline asm on gfx90a

This was assuming all mayLoad instructions have one def.

3 years ago[llvm][NFC] Fix assert indentation
Timm Bäder [Fri, 23 Apr 2021 12:36:17 +0000 (14:36 +0200)]
[llvm][NFC] Fix assert indentation

This triggers GCC's misleading-indentation checker.

3 years ago[InstCombine] Fixed newly added tests; NFC
Dávid Bolvanský [Fri, 23 Apr 2021 12:42:37 +0000 (14:42 +0200)]
[InstCombine] Fixed newly added tests; NFC

3 years ago[InstCombine][NFC] add tests for printf("%s", str) --> puts(str)/noop transformation.
Dawid Jurczak [Fri, 23 Apr 2021 12:24:19 +0000 (14:24 +0200)]
[InstCombine][NFC] add tests for printf("%s", str) --> puts(str)/noop transformation.

Split off from D100724.

Reviewed By: xbolva00

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

3 years agoReland "[Clang] Propagate guaranteed alignment for malloc and others"
Dávid Bolvanský [Fri, 23 Apr 2021 12:05:57 +0000 (14:05 +0200)]
Reland "[Clang] Propagate guaranteed alignment for malloc and others"

This relands commit 6914a0ed2b30924b188968e59a83efa07ac5fe57. Crash in InstCombine was fixed.

3 years ago[InstCombine] Fixed crash when setting align attr for memalign
Dávid Bolvanský [Fri, 23 Apr 2021 12:03:49 +0000 (14:03 +0200)]
[InstCombine] Fixed crash when setting align attr for memalign

3 years ago[clang] Do not crash on template specialization following a fatal error
Adam Czachorowski [Thu, 15 Apr 2021 20:33:05 +0000 (22:33 +0200)]
[clang] Do not crash on template specialization following a fatal error

There was a missing isInvalid() check leading to an attempt to
instantiate template with an empty instantiation stack.

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

3 years ago[RISCV] Custom lower vector F(MIN|MAX)NUM to vf(min|max)
Fraser Cormack [Thu, 22 Apr 2021 08:55:27 +0000 (09:55 +0100)]
[RISCV] Custom lower vector F(MIN|MAX)NUM to vf(min|max)

This patch adds support for both scalable- and fixed-length vector code
lowering of the llvm.minnum and llvm.maxnum intrinsics to the equivalent
RVV instructions.

Reviewed By: craig.topper

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

3 years ago[lldb][NFC] Remove a stray unicode character in the LLDB test docs
Raphael Isemann [Fri, 23 Apr 2021 11:20:06 +0000 (13:20 +0200)]
[lldb][NFC] Remove a stray unicode character in the LLDB test docs

There was a U+2028 character in this line (a special paragraph separator).

3 years ago[dexter] Add keyword argument 'on_line' to DexLabel
OCHyams [Fri, 23 Apr 2021 11:00:16 +0000 (12:00 +0100)]
[dexter] Add keyword argument 'on_line' to DexLabel

Add optional keyword argument 'on_line' to DexLabel to label the specifed line
instead of the line the command is found on.

This will be helpful when used alongside DexDeclareFile (D99651).

Reviewed By: TWeaver

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

3 years ago[doc] Clarify constrained fcmps behavior
Thomas Preud'homme [Thu, 22 Apr 2021 12:17:42 +0000 (13:17 +0100)]
[doc] Clarify constrained fcmps behavior

Reviewed By: uweigand

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

3 years agoRecommit "[NewGVN] Track simplification dependencies for phi-of-ops."
Florian Hahn [Fri, 23 Apr 2021 08:57:03 +0000 (09:57 +0100)]
Recommit "[NewGVN] Track simplification dependencies for phi-of-ops."

This recommits 4f5da356ff35a218f23f0b0c4d08aee90da7de6e, including
explicit implementations of move a constructor and deleted copy
constructors/assignment operators, to fix failures with some compilers.

This reverts the revert 74854d00e854196445727a49df58fe5768d9ed5b.

3 years agoRe-reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs...
Stephen Tozer [Thu, 22 Apr 2021 11:06:52 +0000 (12:06 +0100)]
Re-reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with non-const operands"

Previous build failures were caused by an error in bitcode reading and
writing for DIArgList metadata, which has been fixed in e5d844b587.
There were also some unnecessary asserts that were being triggered on
certain builds, which have been removed.

This reverts commit dad5caa59e6b2bde8d6cf5b64a972c393c526c82.

3 years ago[X86][AMX][NFC] Make comparison operators to be complete
Wang, Pengfei [Fri, 23 Apr 2021 09:11:45 +0000 (17:11 +0800)]
[X86][AMX][NFC] Make comparison operators to be complete

The previous D101039 didn't fix the SmallSet insertion issue, due to we
always return false for the comparison between 2 different nonnull BBs.
This patch makes the the comparison to be complete by comparing `MBB`
first, so that we can always get the invariant order by a single
operator.

3 years agoRevert "[Clang] Propagate guaranteed alignment for malloc and others"
Dávid Bolvanský [Fri, 23 Apr 2021 09:33:12 +0000 (11:33 +0200)]
Revert "[Clang] Propagate guaranteed alignment for malloc and others"

This reverts commit c2297544c04764237cedc523083c7be2fb3833d4. Some buildbots are broken.

3 years ago[gn build] Port c623945d707c
LLVM GN Syncbot [Fri, 23 Apr 2021 09:26:02 +0000 (09:26 +0000)]
[gn build] Port c623945d707c

3 years ago[mlir] Support masked N-D vector transfer ops in ProgressiveVectorToSCF.
Matthias Springer [Fri, 23 Apr 2021 09:11:07 +0000 (18:11 +0900)]
[mlir] Support masked N-D vector transfer ops in ProgressiveVectorToSCF.

Mask vectors are handled similar to data vectors in N-D TransferWriteOp. They are copied into a temporary memory buffer, which can be indexed into with non-constant values.

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

3 years agollvm-objdump: refactor SourcePrinter into separate file. NFC.
Tim Northover [Mon, 15 Feb 2021 11:58:35 +0000 (11:58 +0000)]
llvm-objdump: refactor SourcePrinter into separate file. NFC.

Preparatory patch for MachO feature.

3 years ago[mlir] Support masked 1D vector transfer ops in ProgressiveVectorToSCF
Matthias Springer [Fri, 23 Apr 2021 09:04:58 +0000 (18:04 +0900)]
[mlir] Support masked 1D vector transfer ops in ProgressiveVectorToSCF

Support for masked N-D vector transfer ops will be added in a subsequent commit.

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

3 years ago[Clang] Propagate guaranteed alignment for malloc and others
Dávid Bolvanský [Fri, 23 Apr 2021 08:11:59 +0000 (10:11 +0200)]
[Clang] Propagate guaranteed alignment for malloc and others

LLVM should be smarter about *known* malloc's alignment and this knowledge may enable other optimizations.

Originally started as LLVM patch - https://reviews.llvm.org/D100862 but this logic should be really in Clang.

Reviewed By: rjmccall

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

3 years ago[mlir] Support broadcast dimensions in ProgressiveVectorToSCF
Matthias Springer [Fri, 23 Apr 2021 08:59:46 +0000 (17:59 +0900)]
[mlir] Support broadcast dimensions in ProgressiveVectorToSCF

This commit adds support for broadcast dimensions in permutation maps of vector transfer ops.

Also fixes a bug in VectorToSCF that generated incorrect in-bounds checks for broadcast dimensions.

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

3 years agoRevert "[NewGVN] Track simplification dependencies for phi-of-ops."
Florian Hahn [Fri, 23 Apr 2021 08:56:17 +0000 (09:56 +0100)]
Revert "[NewGVN] Track simplification dependencies for phi-of-ops."

This reverts commit 4f5da356ff35a218f23f0b0c4d08aee90da7de6e.

This causes some  buildbot failures, e.g.
https://lab.llvm.org/buildbot/#/builders/139/builds/3019

3 years ago[mlir] Use SCF for loops in ProgressiveVectorToSCF
Matthias Springer [Thu, 22 Apr 2021 02:33:23 +0000 (11:33 +0900)]
[mlir] Use SCF for loops in ProgressiveVectorToSCF

Use SCF for loops instead of Affine for loops.

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

3 years ago[mlir][docs] Update `add_mlir_doc` usage
Marius Brehler [Fri, 23 Apr 2021 08:45:57 +0000 (08:45 +0000)]
[mlir][docs] Update `add_mlir_doc` usage

Updates the docs to reflect the changes introduced to the `add_mlir_doc`
CMake macro with https://reviews.llvm.org/D100517.

3 years ago[NewGVN] Track simplification dependencies for phi-of-ops.
Florian Hahn [Fri, 23 Apr 2021 08:27:06 +0000 (09:27 +0100)]
[NewGVN] Track simplification dependencies for phi-of-ops.

If we are using a simplified value, we need to add an extra
dependency this value , because changes to the class of the
simplified value may require us to invalidate any decision based on
that value.

This is done by adding such values as additional users, however the
current code does not excludes temporary instructions.

At the moment, this means that we miss those dependencies for
phi-of-ops, because they are temporary instructions at this point. We
instead need to add the extra dependencies to the root instruction of
the phi-of-ops.

This patch pushes the responsibility of adding extra users to the
callers of createExpression & performSymbolicEvaluation. At those
points, it is clearer which real instruction to pick.

Alternatively we could either pass the 'real' instruction as additional
argument or use another map, but I think the approach in the patch makes
things a bit easier to follow.

Fixes PR35074.

Reviewed By: asbirlea

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

3 years ago[mlir] Support dimension permutations in ProgressiveVectorToSCF
Matthias Springer [Fri, 23 Apr 2021 08:22:40 +0000 (17:22 +0900)]
[mlir] Support dimension permutations in ProgressiveVectorToSCF

This commit adds support for dimension permutations in permutation maps of vector transfer ops.

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

3 years ago[lldb][NFC] Delete a checked-in build log in docs/testsuite
Raphael Isemann [Fri, 23 Apr 2021 08:36:43 +0000 (10:36 +0200)]
[lldb][NFC] Delete a checked-in build log in docs/testsuite

3 years ago[MLIR][NFC] Fix warning, trim includes + cleanup in AffineOps.h
Uday Bondhugula [Thu, 22 Apr 2021 06:35:37 +0000 (12:05 +0530)]
[MLIR][NFC] Fix warning, trim includes + cleanup in AffineOps.h

Fix style/clang-tidy warning, trim stale includes and forward
declarations, and cleanup/fix stale comments.

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

3 years ago[mlir] Handle strided 1D vector transfer ops in ProgressiveVectorToSCF
Matthias Springer [Fri, 23 Apr 2021 08:18:26 +0000 (17:18 +0900)]
[mlir] Handle strided 1D vector transfer ops in ProgressiveVectorToSCF

Strided 1D vector transfer ops are 1D transfers operating on a memref dimension different from the last one. Such transfer ops do not accesses contiguous memory blocks (vectors), but access memory in a strided fashion. In the absence of a mask, strided 1D vector transfer ops can also be lowered using matrix.column.major.* LLVM instructions (in a later commit).

Subsequent commits will extend the pass to handle the remaining missing permutation maps (broadcasts, transposes, etc.).

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

3 years ago[Debug-Info] change return type to void for attribute adding functions.
Chen Zheng [Thu, 22 Apr 2021 05:53:41 +0000 (01:53 -0400)]
[Debug-Info] change return type to void for attribute adding functions.

Make following function return void:

    addLabel()
    addSectionLabel()
    addSectionDelta()

This aligns with other attributes adding functions.

Reviewed By: dblaikie

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

3 years ago[GlobalISel] Remove ConstantFoldingMIRBuilder
Jay Foad [Thu, 22 Apr 2021 11:38:02 +0000 (12:38 +0100)]
[GlobalISel] Remove ConstantFoldingMIRBuilder

ConstantFoldingMIRBuilder was an experiment which is not used for
anything. The constant folding functionality is now part of
CSEMIRBuilder.

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

3 years ago[AArch64] Fix for BTI landing pad insertion with PAC-RET+bkey.
Daniel Kiss [Fri, 23 Apr 2021 08:06:15 +0000 (10:06 +0200)]
[AArch64] Fix for BTI landing pad insertion with PAC-RET+bkey.

EMITBKEY is emitted for PAC-RET+bkey, which is a non machine instructions.

PR: 49957

Reviewed By: eugenis

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

3 years ago[cland] Dont emit missing newline warnings when building preamble
Kadir Cetinkaya [Wed, 14 Apr 2021 17:28:14 +0000 (19:28 +0200)]
[cland] Dont emit missing newline warnings when building preamble

When building preamble, clangd truncates file contents. This yielded
errnous warnings in some cases.

This patch fixes the issue by turning off no-newline-at-eof warnings whenever
the file has more contents than the preamble.

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

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

3 years ago[LoopReroll] Fix rerolling loop with extra instructions
KAWASHIMA Takahiro [Thu, 8 Apr 2021 03:33:25 +0000 (12:33 +0900)]
[LoopReroll] Fix rerolling loop with extra instructions

Fixes PR47627

This fix suppresses rerolling a loop which has an unrerollable
instruction.

Sample IR for the explanation below:

```
define void @foo([2 x i32]* nocapture %a) {
entry:
  br label %loop

loop:
  ; base instruction
  %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]

  ; unrerollable instructions
  %stptrx = getelementptr inbounds [2 x i32], [2 x i32]* %a, i64 %indvar, i64 0
  store i32 999, i32* %stptrx, align 4

  ; extra simple arithmetic operations, used by root instructions
  %plus20 = add nuw nsw i64 %indvar, 20
  %plus10 = add nuw nsw i64 %indvar, 10

  ; root instruction 0
  %ldptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %a, i64 %plus20, i64 0
  %value0 = load i32, i32* %ldptr0, align 4
  %stptr0 = getelementptr inbounds [2 x i32], [2 x i32]* %a, i64 %plus10, i64 0
  store i32 %value0, i32* %stptr0, align 4

  ; root instruction 1
  %ldptr1 = getelementptr inbounds [2 x i32], [2 x i32]* %a, i64 %plus20, i64 1
  %value1 = load i32, i32* %ldptr1, align 4
  %stptr1 = getelementptr inbounds [2 x i32], [2 x i32]* %a, i64 %plus10, i64 1
  store i32 %value1, i32* %stptr1, align 4

  ; loop-increment and latch
  %indvar.next = add nuw nsw i64 %indvar, 1
  %exitcond = icmp eq i64 %indvar.next, 5
  br i1 %exitcond, label %exit, label %loop

exit:
  ret void
}
```

In the loop rerolling pass, `%indvar` and `%indvar.next` are appended
to the `LoopIncs` vector in the `LoopReroll::DAGRootTracker::findRoots`
function.

Before this fix, two instructions with `unrerollable instructions`
comment above are marked as `IL_All` at the end of the
`LoopReroll::DAGRootTracker::collectUsedInstructions` function,
as well as instructions with `extra simple arithmetic operations`
comment and `loop-increment and latch` comment. It is incorrect
because `IL_All` means that the instruction should be executed in all
iterations of the rerolled loop but the `store` instruction should
not.

This fix rejects instructions which may have side effects and don't
belong to def-use chains of any root instructions and reductions.

See https://bugs.llvm.org/show_bug.cgi?id=47627 for more information.

3 years ago[RISCV] Implement the vnot.v builtin.
Hsiangkai Wang [Tue, 20 Apr 2021 03:01:22 +0000 (11:01 +0800)]
[RISCV] Implement the vnot.v builtin.

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

3 years ago[X86][AMX][NFC] Avoid assert for the same immidiate value
Wang, Pengfei [Fri, 23 Apr 2021 03:42:54 +0000 (11:42 +0800)]
[X86][AMX][NFC] Avoid assert for the same immidiate value

The previous condition in the assert was over strict. We ought to allow
the same immidiate value being loaded more than once. The intention for
the assert is to check the same AMX register uses multiple different
immidiate shapes. So this fix supposes to be NFC.

Reviewed By: LuoYuanke

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

3 years ago[X86][AMX] Try to hoist AMX shapes' def
Wang, Pengfei [Thu, 22 Apr 2021 01:10:26 +0000 (09:10 +0800)]
[X86][AMX] Try to hoist AMX shapes' def

We request no intersections between AMX instructions and their shapes'
def when we insert ldtilecfg. However, this is not always ture resulting
from not only users don't follow AMX API model, but also optimizations.

This patch adds a mechanism that tries to hoist AMX shapes' def as well.
It only hoists shapes inside a BB, we can improve it for cases across
BBs in future. Currently, it only hoists shapes of which all sources' def
above the first AMX instruction. We can improve for the case that only
source that moves an immediate value to a register below AMX instruction.

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

3 years ago[X86] Enable compilation of user interrupt handlers.
Wang, Pengfei [Fri, 23 Apr 2021 03:12:04 +0000 (11:12 +0800)]
[X86] Enable compilation of user interrupt handlers.

Add __uintr_frame structure and use UIRET instruction for functions with
x86 interrupt calling convention when UINTR is present.

Reviewed By: LuoYuanke

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

3 years ago[RISCV] Implement the vneg.v builtin.
Hsiangkai Wang [Tue, 20 Apr 2021 02:53:19 +0000 (10:53 +0800)]
[RISCV] Implement the vneg.v builtin.

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

3 years ago[NFC] Suppress cpplint warning in test
Vitaly Buka [Fri, 23 Apr 2021 03:19:54 +0000 (20:19 -0700)]
[NFC] Suppress cpplint warning in test

3 years ago[InlineSpiller] Clean-up isSpillCandBB
Serguei Katkov [Wed, 21 Apr 2021 05:29:25 +0000 (12:29 +0700)]
[InlineSpiller] Clean-up isSpillCandBB

This is mostly NFC except that for end of BB not previous slot is used.
Idx is used to find a def of sibling live interval in that slot.
The def on end of MBB and on previous slot of end MBB should be the same,
so it should be NFC.

Reviewers: reames, qcolombet, MatzeB, wmi, rnk
Reviewed By: rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100922

3 years ago[lld/mac] Implement support for .weak_def_can_be_hidden
Nico Weber [Thu, 22 Apr 2021 15:28:35 +0000 (11:28 -0400)]
[lld/mac] Implement support for .weak_def_can_be_hidden

I first had a more invasive patch for this (D101069), but while trying
to get that polished for review I realized that lld's current symbol
merging semantics mean that only a very small code change is needed.
So this goes with the smaller patch for now.

This has no effect on projects that build with -fvisibility=hidden
(e.g.  chromium), since these see .private_extern symbols instead.

It does have an effect on projects that build with -fvisibility-inlines-hidden
(e.g. llvm) in -O2 builds, where LLVM's GlobalOpt pass will promote most inline
functions from .weak_definition to .weak_def_can_be_hidden.

Before this patch:

    % ls -l out/gn/bin/clang out/gn/lib/libclang.dylib
    -rwxr-xr-x  1 thakis  staff  113059936 Apr 22 11:51 out/gn/bin/clang
    -rwxr-xr-x  1 thakis  staff   86370064 Apr 22 11:51 out/gn/lib/libclang.dylib
    % out/gn/bin/llvm-objdump --macho --weak-bind out/gn/bin/clang | wc -l
        8291
    % out/gn/bin/llvm-objdump --macho --weak-bind out/gn/lib/libclang.dylib | wc -l
        5698

With this patch:

    % ls -l out/gn/bin/clang out/gn/lib/libclang.dylib
    -rwxr-xr-x  1 thakis  staff  111721096 Apr 22 11:55 out/gn/bin/clang
    -rwxr-xr-x  1 thakis  staff   85291208 Apr 22 11:55 out/gn/lib/libclang.dylib
    thakis@MBP llvm-project % out/gn/bin/llvm-objdump --macho --weak-bind out/gn/bin/clang | wc -l
         725
    thakis@MBP llvm-project % out/gn/bin/llvm-objdump --macho --weak-bind out/gn/lib/libclang.dylib | wc -l
         542

Linking clang becomes a tiny bit faster with this patch:

    x 100    0.67263818    0.77847815    0.69430709    0.69877208   0.017715892
    + 100    0.67209601    0.73323393    0.68600798    0.68917346   0.012824377
    Difference at 95.0% confidence
            -0.00959861 +/- 0.00428661
            -1.37364% +/- 0.613449%
            (Student's t, pooled s = 0.0154648)

This only happens if lld with the patch and lld without the patch are both
linked with an lld with the patch or both linked with an lld without the patch
(...or with ld64). I accidentally linked the lld with the patch with an lld
without the patch and the other way round at first. In that setup, no
difference is found. That makese sense, since having fewer weak imports will
make the linked output a bit faster too. So not only does this make linking
binaries such as clang a bit faster (since fewer exports need to be written to
the export trie by lld), the linked output binary binary is also a bit faster
(since dyld needs to process fewer dynamic imports).

This also happens to fix the one `check-clang` failure when using lld as host
linker, but mostly for silly reasons: See crbug.com/1183336, mostly comment 26.
The real bug here is that c-index-test links all of LLVM both statically and
dynamically, which is an ODR violation. Things just happen to work with this
patch.

So after this patch, check-clang, check-lld, check-llvm all pass with lld as
host linker :)

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

3 years ago[lld/mac] slightly improve weak-private-extern.s test
Nico Weber [Thu, 22 Apr 2021 13:58:52 +0000 (09:58 -0400)]
[lld/mac] slightly improve weak-private-extern.s test

- __got is in --bind output, so print that too (makes the test
  a bit stronger)
- WEAK_DEFINES, BINDS_TO_WEAK are in the mach-o header, so
  --private-header is enough, no need for --all-headers
  (makes the test a bit easier to work with when it fails)

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

3 years ago[gn build] (manually) port 0b2bc69ba29
Nico Weber [Fri, 23 Apr 2021 02:40:53 +0000 (22:40 -0400)]
[gn build] (manually) port 0b2bc69ba29

3 years ago[NFC] Fix cpplint warning
Vitaly Buka [Fri, 23 Apr 2021 02:05:20 +0000 (19:05 -0700)]
[NFC] Fix cpplint warning

3 years agoAMDGPU: Restore atomic fp feature on FP atomic instruction definitions
Matt Arsenault [Fri, 9 Apr 2021 22:40:59 +0000 (18:40 -0400)]
AMDGPU: Restore atomic fp feature on FP atomic instruction definitions

9931b1f7a4785b6a17fb87b81a3546d61d0cbca1 switched this to checking for
the two specific subtargets, instead of the dedicated feature. This
broke supporting functions which force added the feature when emitting
targets that do not actually support them. This stil does not work for
the targets that use the gfx6/7 or gfx10 encodings.

3 years ago[IR][sanitizer] Add module flag "frame-pointer" and set it for cc1 -mframe-pointer...
Fangrui Song [Fri, 23 Apr 2021 01:07:29 +0000 (18:07 -0700)]
[IR][sanitizer] Add module flag "frame-pointer" and set it for cc1 -mframe-pointer={non-leaf,all}

The Linux kernel objtool diagnostic `call without frame pointer save/setup`
arise in multiple instrumentation passes (asan/tsan/gcov). With the mechanism
introduced in D100251, it's trivial to respect the command line
-m[no-]omit-leaf-frame-pointer/-f[no-]omit-frame-pointer, so let's do it.

Fix: https://github.com/ClangBuiltLinux/linux/issues/1236 (tsan)
Fix: https://github.com/ClangBuiltLinux/linux/issues/1238 (asan)

Also document the function attribute "frame-pointer" which is long overdue.

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

3 years ago[libc++][ranges] Add range.cmp: equal_to, not_equal_to, less, etc.
zoecarver [Fri, 23 Apr 2021 00:33:04 +0000 (17:33 -0700)]
[libc++][ranges] Add range.cmp: equal_to, not_equal_to, less, etc.

Adds the six new concept constrained comparisons.

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

3 years agoReapply "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
Jon Chesterfield [Fri, 23 Apr 2021 00:06:23 +0000 (01:06 +0100)]
Reapply  "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"

This reverts commit 24c1ed3b34f7602b955e52cd8a362f4e27eb5f20.

3 years agoCWG2076: Permit implicit conversions within a single level of braces
Richard Smith [Thu, 22 Apr 2021 23:48:34 +0000 (16:48 -0700)]
CWG2076: Permit implicit conversions within a single level of braces
during overload resolution, even when calling a copy constructor.

3 years ago[lldb] Update register state parsing for JSON crashlogs
Jonas Devlieghere [Thu, 22 Apr 2021 23:37:25 +0000 (16:37 -0700)]
[lldb] Update register state parsing for JSON crashlogs

 - The register encoding state in the JSON crashlog format changes.
   Update the parser accordingly.
 - Print the register state when printing the symbolicated thread.

3 years ago[re-land][lld-macho] Fix min version check
Jez Ng [Thu, 22 Apr 2021 23:08:04 +0000 (19:08 -0400)]
[re-land][lld-macho] Fix min version check

We had got it backwards... the minimum version of the target
should be higher than the min version of the object files, presumably
since new platforms are backwards-compatible with older formats.

Fixes PR50078.

The original commit (aa05439c9cde) broke many tests that had inputs too
new for our target platform (10.0). This commit changes the inputs to
target 10.0, which was the simpler thing to do, but we should really
just have our lit.local.cfg default to targeting 10.15... we're not
likely to ever have proper support for the older versions anyway. I will
follow up with a change to that effect.

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

3 years ago[RISCV] [1/2] Add IR intrinsic for Zbp extension
Levy Hsu [Thu, 22 Apr 2021 23:19:15 +0000 (16:19 -0700)]
[RISCV] [1/2] Add IR intrinsic for Zbp extension

RV32/64:
    grev
    grevi
    gorc
    gorci
    shfl
    shfli
    unshfl
    unshfli

RV64 ONLY:
    grevw
    greviw
    gorcw
    gorciw
    shflw
    shfli     (For non-existing shfliw)
    unshfli   (For non-existing unshfliw)

Reviewed By: craig.topper

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

3 years ago[clang][nfc] Split getOrCheckAMDGPUCodeObjectVersion
Jon Chesterfield [Thu, 22 Apr 2021 23:24:41 +0000 (00:24 +0100)]
[clang][nfc] Split getOrCheckAMDGPUCodeObjectVersion

[clang][nfc] Split getOrCheckAMDGPUCodeObjectVersion

Separates detection of deprecated or invalid code object version from
returning the version. Written to avoid any behaviour change.

Precursor to a revision of D98746.

Reviewed By: yaxunl

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

3 years agoscudo: Only static_assert for compressed LSB format with clang.
Peter Collingbourne [Thu, 22 Apr 2021 23:09:23 +0000 (16:09 -0700)]
scudo: Only static_assert for compressed LSB format with clang.

It looks like there's some old version of gcc that doesn't like this
static_assert (I couldn't reproduce the issue with gcc 8, 9 or 10).
Work around the issue by only checking the static_assert under clang,
which should provide sufficient coverage.

Should hopefully fix this buildbot:
https://lab.llvm.org/buildbot/#/builders/112/builds/5356

3 years agoRevert "[lld-macho] Fix min version check"
Jez Ng [Thu, 22 Apr 2021 23:07:18 +0000 (19:07 -0400)]
Revert "[lld-macho] Fix min version check"

This reverts commit aa05439c9cde873ba18ae847ac7c23877178a9ca.

3 years ago[HIP] Support overloaded math functions for hipRTC
Yaxun (Sam) Liu [Mon, 19 Apr 2021 16:32:42 +0000 (12:32 -0400)]
[HIP] Support overloaded math functions for hipRTC

Remove the dependence on standard C++ header
for overloaded math functions in HIP header
since standard C++ header is not available for hipRTC.

Reviewed by: Artem Belevich, Justin Lebar

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

3 years agollvm-objdump: add --rpaths to macho support
Keith Smiley [Mon, 19 Apr 2021 18:09:59 +0000 (11:09 -0700)]
llvm-objdump: add --rpaths to macho support

This prints the rpaths for the given binary

Reviewed By: kastiglione

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

3 years agoRevert "[AST] Enable AST node introspection on Apple"
Stephen Kelly [Thu, 22 Apr 2021 22:52:23 +0000 (23:52 +0100)]
Revert "[AST] Enable AST node introspection on Apple"

This reverts commit 907409a536cd66a09a91ee28e1f6f8bcc7127bc7.

This caused a failure

  http://green.lab.llvm.org/green//job/lldb-cmake-standalone/2827/consoleFull#-210109660a1ca8a51-895e-46c6-af87-ce24fa4cd561

Assertion failed: (!CodeSynthesisContexts.empty() && "Cannot perform an
instantiation without some context on the " "instantiation stack"),
function SubstType, file
/Users/buildslave/jenkins/workspace/lldb-cmake-standalone/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp,
line 2071.

3 years agoscudo: Optimize getSizeLSBByClassId() by compressing the table into an integer if...
Peter Collingbourne [Thu, 22 Apr 2021 19:59:57 +0000 (12:59 -0700)]
scudo: Optimize getSizeLSBByClassId() by compressing the table into an integer if possible. NFCI.

With AndroidSizeClassMap all of the LSBs are in the range 4-6 so we
only need 2 bits of information per size class. Furthermore we have
32 size classes, which conveniently lets us fit all of the information
into a 64-bit integer. Do so if possible so that we can avoid a table
lookup entirely.

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

3 years ago[WebAssembly] Fix fixEndsAtEndOfFunction for delegate
Heejin Ahn [Thu, 22 Apr 2021 09:00:57 +0000 (02:00 -0700)]
[WebAssembly] Fix fixEndsAtEndOfFunction for delegate

Background:
CFGStackify's [[ https://github.com/llvm/llvm-project/blob/398f25340000f26d648ebbc7eae9dc401ffc7d5f/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp#L1481-L1540 | fixEndsAtEndOfFunction ]] fixes block/loop/try's return
type when the end of function is unreachable and the function return
type is not void. So if a function returns i32 and `block`-`end` wraps the
whole function, i.e., the `block`'s `end` is the last instruction of the
function, the `block`'s return type should be i32 too:
```
block i32
  ...
end
end_function
```

If there are consecutive `end`s, this signature has to be propagate to
those blocks too, like:
```
block i32
  ...
  block i32
    ...
  end
end
end_function
```

This applies to `try`-`end` too:
```
try i32
  ...
catch
  ...
end
end_function
```

In case of `try`, we not only follow consecutive `end`s but also follow
`catch`, because for the type of the whole `try` to be i32, both `try`
and `catch` parts have to be i32:
```
try i32
  ...
  block i32
    ...
  end
catch
  ...
  block i32
    ...
  end
end
end_function
```

---

Previously we only handled consecutive `end`s or `end` before a `catch`.
But now we have `delegate`, which serves like `end` for
`try`-`delegate`. So we have to follow `delegate` too and mark its
corresponding `try` as i32 (the function's return type):
```
try i32
  ...
catch
  ...
  try i32    ;; Here
    ...
  delegate N
end
end_function
```

Reviewed By: tlively

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

3 years ago[WebAssembly] Serialize params/results in MachineFunctionInfo
Heejin Ahn [Wed, 21 Apr 2021 10:49:17 +0000 (03:49 -0700)]
[WebAssembly] Serialize params/results in MachineFunctionInfo

This adds support for YAML serialization of `Params` and `Results`
fields in `WebAssemblyMachineFunctionInfo`. Types are printed as `MVT`'s
string representation. This is for writing MIR tests easier.

The tests added are testing simple parsing and printing of `params` /
`results` fields under `machineFunctionInfo`.

Reviewed By: tlively

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

3 years ago[WebAssembly] Put utility functions in Utils directory (NFC)
Heejin Ahn [Wed, 21 Apr 2021 18:44:40 +0000 (11:44 -0700)]
[WebAssembly] Put utility functions in Utils directory (NFC)

This CL
1. Creates Utils/ directory under lib/Target/WebAssembly
2. Moves existing WebAssemblyUtilities.cpp|h into the Utils/ directory
3. Creates Utils/WebAssemblyTypeUtilities.cpp|h and put type
   declarataions and type conversion functions scattered in various
   places into this single place.

It has been suggested several times that it is not easy to share utility
functions between subdirectories (AsmParser, DIsassembler, MCTargetDesc,
...). Sometimes we ended up [[ https://reviews.llvm.org/D92840#2478863 | duplicating ]] the same function because of
this.

There are already other targets doing this: AArch64, AMDGPU, and ARM
have Utils/ subdirectory under their target directory.

This extracts the utility functions into a single directory Utils/ and
make them sharable among all passes in WebAssembly/ and its
subdirectories. Also I believe gathering all type-related conversion
functionalities into a single place makes it more usable. (Actually I
was working on another CL that uses various type conversion functions
scattered in multiple places, which became the motivation for this CL.)

Reviewed By: dschuff, aardappel

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

3 years ago[lld-macho] Fix min version check
Jez Ng [Thu, 22 Apr 2021 22:24:55 +0000 (18:24 -0400)]
[lld-macho] Fix min version check

We had got it backwards... the minimum version of the target
should be higher than the min version of the object files, presumably
since new platforms are backwards-compatible with older formats.

Fixes PR50078.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho][nfc] Clean up some constructor declarations
Jez Ng [Thu, 22 Apr 2021 02:09:48 +0000 (22:09 -0400)]
[lld-macho][nfc] Clean up some constructor declarations

Remove unnecessary default ctor + add `explicit` to others

3 years ago[flang] (NFC) Break up flang/runtime/reduction.cpp
peter klausler [Thu, 22 Apr 2021 21:23:45 +0000 (14:23 -0700)]
[flang] (NFC) Break up flang/runtime/reduction.cpp

The single source file reduction.cpp is a little large in
terms of both source lines and generated text bytes, so
split SUM, PRODUCT, FINDLOC, and MAXLOC/MAXVAL/MINLOC/MINVAL
off into their own C++ source files that share a set of
implementation function templates now in a common header.

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

3 years ago[RISCV] Fix crash with fptosi.sat/fptoui.sat intrinsics on RV64. Add test cases.
Craig Topper [Thu, 22 Apr 2021 22:10:47 +0000 (15:10 -0700)]
[RISCV] Fix crash with fptosi.sat/fptoui.sat intrinsics on RV64. Add test cases.

Add PromoteIntOp_FP_TO_XINT_SAT to type legalize the bit width
operand from i32 to i64 for RV64.

Add test cases for the saturating intrinsics for half/float/double
and i32/i64. CodeGen is definitely not optimal. We can probably
make use of the native behavior of fcvt instructions in many cases.

Fixes PR50083

3 years ago[Hexagon] Improve lowering of returns of i1
Krzysztof Parzyszek [Thu, 22 Apr 2021 21:18:39 +0000 (16:18 -0500)]
[Hexagon] Improve lowering of returns of i1

Emit explicit any-extend to avoid weird tstbit sequences.

3 years ago[AST] Enable AST node introspection on Apple
Stephen Kelly [Thu, 22 Apr 2021 21:19:21 +0000 (22:19 +0100)]
[AST] Enable AST node introspection on Apple

This was previously excluded due to possible buildbot failures.

3 years ago[dfsan] Fix Len argument type in call to __dfsan_mem_transfer_callback
Elia Geretto [Thu, 22 Apr 2021 21:05:13 +0000 (21:05 +0000)]
[dfsan] Fix Len argument type in call to __dfsan_mem_transfer_callback

This patch is supposed to solve: https://bugs.llvm.org/show_bug.cgi?id=50075

The function `__dfsan_mem_transfer_callback` takes a `Len` argument of type `i64`; however, when processing a `MemTransferInst` such as `llvm.memcpy.p0i8.p0i8.i32`, the `len` argument has type `i32`. In order to make the type of `len` compatible with the one of the callback argument, this change zero-extends it when necessary.

Reviewed By: stephan.yichao.zhao, gbalats

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

3 years agoRevert "Re-land "[Driver] Support default libc++ library location on Darwin""
Petr Hosek [Thu, 22 Apr 2021 21:02:46 +0000 (14:02 -0700)]
Revert "Re-land "[Driver] Support default libc++ library location on Darwin""

This reverts commit 6331680ad2ad000fdaf7e72f3c1880c7908ffa25 because
this breaks the compiler-rt build.

3 years ago[GVN] Generate LE and BE check lines (NFC)
Nikita Popov [Thu, 22 Apr 2021 20:44:08 +0000 (22:44 +0200)]
[GVN] Generate LE and BE check lines (NFC)

I accidentally dropped some check lines in my previous commit.
Apparently update_test_checks no longer warns on label conflicts???

3 years ago[GVN] Regenerate test checks (NFC)
Nikita Popov [Thu, 22 Apr 2021 20:38:18 +0000 (22:38 +0200)]
[GVN] Regenerate test checks (NFC)

3 years ago[Hexagon] Use 'vnot' instead of 'not' in patterns with vectors
Krzysztof Parzyszek [Thu, 22 Apr 2021 19:59:30 +0000 (14:59 -0500)]
[Hexagon] Use 'vnot' instead of 'not' in patterns with vectors

'not' expands to checking for an xor with a -1 constant. Since
this looks for a ConstantSDNode it will never match for a vector.

Co-authored-by: Craig Topper <craig.topper@sifive.com>
Differential Revision: https://reviews.llvm.org/D100687

3 years agolldb/Instrumentation: NFC-ish use GetFrameCodeAddressForSymbolication()
Fred Riss [Thu, 22 Apr 2021 18:02:45 +0000 (11:02 -0700)]
lldb/Instrumentation: NFC-ish use GetFrameCodeAddressForSymbolication()

A couple of our Instrumentation runtimes were gathering backtraces,
storing it in a StructuredData array and later creating a HistoryThread
using this data. By deafult HistoryThread will consider the history PCs
as return addresses and thus will substract 1 from them to go to the
call address.

This is usually correct, but it's also wasteful as when we gather the
backtraces ourselves, we have much better information to decide how
to backtrace and symbolicate. This patch uses the new
GetFrameCodeAddressForSymbolication() to gather the PCs that should
be used for symbolication and configures the HistoryThread to just
use those PCs as-is.

(The MTC plugin was actaully applying a -1 itself and then the
HistoryThread would do it again, so this actaully fixes a bug there.)

rdar://77027680

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

3 years ago[trace][intel-pt] Fix a crash on unconsumed Expected's Error
Jan Kratochvil [Thu, 22 Apr 2021 20:24:05 +0000 (22:24 +0200)]
[trace][intel-pt] Fix a crash on unconsumed Expected's Error

Reproducible with build using libipt and -DLLVM_ENABLE_ASSERTIONS=ON:
(lldb) b main
(lldb) r
(lldb) process trace start

3 years ago[GlobalOpt] Don't replace alias with aliasee if aliasee is interposable
Arthur Eubanks [Tue, 20 Apr 2021 18:02:57 +0000 (11:02 -0700)]
[GlobalOpt] Don't replace alias with aliasee if aliasee is interposable

Both the alias and aliasee linkage are important.

PR27866 provides some background.

Reviewed By: rnk

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

3 years ago[AArch64] Improve vector reverse lowering
David Green [Thu, 22 Apr 2021 20:01:25 +0000 (21:01 +0100)]
[AArch64] Improve vector reverse lowering

This improves the lowering of v8i16 and v16i8 vector reverse shuffles.
Instead of going via a generic tbl it uses a rev64; ext pair, as already
happens for v4i32.

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

3 years ago[M68k][Disassembler][NFC] Decorate dump methods with LLVM_DUMP_METHOD
Min-Yih Hsu [Thu, 22 Apr 2021 19:00:30 +0000 (12:00 -0700)]
[M68k][Disassembler][NFC] Decorate dump methods with LLVM_DUMP_METHOD

And guard them with proper macro conditions. NFC.

3 years agoSkip unreliable LLDB tests when running under asan
Adrian Prantl [Thu, 22 Apr 2021 18:55:08 +0000 (11:55 -0700)]
Skip unreliable LLDB tests when running under asan

3 years ago[M68k][AsmParser][NFC] Remove redundant default cases
Min-Yih Hsu [Thu, 22 Apr 2021 18:49:08 +0000 (11:49 -0700)]
[M68k][AsmParser][NFC] Remove redundant default cases

Remove redundant default cases since all enumeration values have
been covered (-Wcovered-switch-default). NFC.

3 years agoRevert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
Jon Chesterfield [Thu, 22 Apr 2021 18:38:17 +0000 (19:38 +0100)]
Revert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"

This reverts commit 722d4d8e7585457d407d0639a4ae2610157e06a8.

Unclear where hsa.h should be included from, see report in D99949

3 years ago[lldb] Include thread name in crashlog.py output
Jonas Devlieghere [Thu, 22 Apr 2021 18:34:47 +0000 (11:34 -0700)]
[lldb] Include thread name in crashlog.py output

Update the JSON parser to include the thread name in the Thread object.

rdar://76677320

3 years agoAdd support of the next Ubuntu (Ubuntu 21.10 - Impish Idri)
Sylvestre Ledru [Thu, 22 Apr 2021 18:37:04 +0000 (20:37 +0200)]
Add support of the next Ubuntu (Ubuntu 21.10 - Impish Idri)

3 years ago[Diagnostics] Restore -Wdeprecated warning when user-declared copy assignment operato...
Dávid Bolvanský [Thu, 22 Apr 2021 18:35:29 +0000 (20:35 +0200)]
[Diagnostics] Restore -Wdeprecated warning when user-declared copy assignment operator is defined as deleted (PR45634)

Solves https://bugs.llvm.org/show_bug.cgi?id=45634
Be more agressive than GCC with -Wdeprecated-copy. Also provide -W(no-)deprecated-copy-user-provided-copy/dtor options to on/off this behaviour.

Reviewed By: Quuxplusone

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

3 years agoCoverage: Document how to collect a profile without a filesystem
Duncan P. N. Exon Smith [Wed, 21 Apr 2021 22:00:51 +0000 (15:00 -0700)]
Coverage: Document how to collect a profile without a filesystem

The profiling runtime was designed to work without static initializers
or a a filesystem (see 117cf2bd1ff585f9754b5f30f5a4cfd65b230bbf and
others). The no-static-initializers part was already documented but this
part got missed before.

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

3 years agoFix the triple used in llvm-mca.
Kai Nacke [Wed, 21 Apr 2021 15:23:13 +0000 (11:23 -0400)]
Fix the triple used in llvm-mca.

lookupTarget() can update the passed triple argument. This happens
when no triple is given on the command line, and the architecture
argument does not match the architecture in the default triple.

For example, passing -march=aarch64 on the command line, and the
default triple being x86_64-windows-msvc, the triple is changed
to aarch64-windows-msvc.

However, this triple is not saved, and later in the code, the
triple is constructed again from the triple name, which is the
default triple at this point. Thus the default triple is passed
to constructor of MCSubtargetInfo instance.

The triple is only used determine the object file format, and by
chance, the AArch64 target also uses the COFF file format, and
all is fine. Obviously, the AArch64 target does not support all
available binary file formats, e.g. XCOFF and GOFF, and llvm-mca
crashes in this case.

The fix is to update the triple name with the changed triple
name for the target lookup. Then the default object file format
for the architecture is used, in the example ELF.

Reviewed By: andreadb, abhina.sreeskantharajan

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

3 years ago[flang] (NFC) Document Fortran feature history
peter klausler [Thu, 22 Apr 2021 16:46:26 +0000 (09:46 -0700)]
[flang] (NFC) Document Fortran feature history

Add flang/docs/FortranFeatureHistory.md

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

3 years agoscudo: Use a table to look up the LSB for computing the odd/even mask. NFCI.
Peter Collingbourne [Thu, 22 Apr 2021 04:03:45 +0000 (21:03 -0700)]
scudo: Use a table to look up the LSB for computing the odd/even mask. NFCI.

In the most common case we call computeOddEvenMaskForPointerMaybe()
from quarantineOrDeallocateChunk(), in which case we need to look up
the class size from the SizeClassMap in order to compute the LSB. Since
we need to do a lookup anyway, we may as well look up the LSB itself
and avoid computing it every time.

While here, switch to a slightly more efficient way of computing the
odd/even mask.

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

3 years agoRevert "[sanitizer] Use COMPILER_RT_EMULATOR with gtests"
Vitaly Buka [Thu, 22 Apr 2021 18:15:23 +0000 (11:15 -0700)]
Revert "[sanitizer] Use COMPILER_RT_EMULATOR with gtests"

Missed review comments.

This reverts commit e25082961cb5aaafc817cb55593cf0ea8d3c4c22.

3 years ago[SCEV] Compute ranges for lshr recurrences
Philip Reames [Thu, 22 Apr 2021 18:05:19 +0000 (11:05 -0700)]
[SCEV] Compute ranges for lshr recurrences

Straight forward extension to the recently added infrastructure which was pioneered with shl.

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

3 years ago[Driver] Specify -ccc-install-dir for linux-cross test
Petr Hosek [Thu, 22 Apr 2021 07:08:36 +0000 (00:08 -0700)]
[Driver] Specify -ccc-install-dir for linux-cross test

This avoids test failures where extra files exist in the tree, such
as the standard library built using the runtimes build.

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

3 years agoRevert "[instcombine] Exploit UB implied by nofree attributes"
Philip Reames [Thu, 22 Apr 2021 17:47:41 +0000 (10:47 -0700)]
Revert "[instcombine] Exploit UB implied by nofree attributes"

This change effectively reverts 86664638, but since there have been some changes on top and I wanted to leave the tests in, it's not a mechanical revert.

Why revert this now?  Two main reasons:
1) There are continuing discussion around what the semantics of nofree.  I am getting increasing uncomfortable with the seeming possibility we might redefine nofree in a way incompatible with these changes.
2) There was a reported miscompile triggered by this change (https://github.com/emscripten-core/emscripten/issues/9443).  At first, I was making good progress on tracking down the issues exposed and those issues appeared to be unrelated latent bugs.  Now that we've found at least one bug in the original change, and the investigation has stalled, I'm no longer comfortable leaving this in tree.  In retrospect, I probably should have reverted this earlier and investigated the issues once the triggering change was out of tree.

3 years ago[RISCV] Add IR intrinsics for vmsge(u).vv/vx/vi.
Craig Topper [Thu, 22 Apr 2021 17:29:36 +0000 (10:29 -0700)]
[RISCV] Add IR intrinsics for vmsge(u).vv/vx/vi.

These instructions don't really exist, but we have ways we can
emulate them.

.vv will swap operands and use vmsle().vv. .vi will adjust the
immediate and use .vmsgt(u).vi when possible. For .vx we need to
use some of the multiple instruction sequences from the V extension
spec.

For unmasked vmsge(u).vx we use:
  vmslt{u}.vx vd, va, x; vmnand.mm vd, vd, vd

For cases where mask and maskedoff are the same value then we have
vmsge{u}.vx v0, va, x, v0.t which is the vd==v0 case that
requires a temporary so we use:
  vmslt{u}.vx vt, va, x; vmandnot.mm vd, vd, vt

For other masked cases we use this sequence:
  vmslt{u}.vx vd, va, x, v0.t; vmxor.mm vd, vd, v0
We trust that register allocation will prevent vd in vmslt{u}.vx
from being v0 since v0 is still needed by the vmxor.

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

3 years ago[RISCV] Add missing tests for vector type for second operand of vmsgt and vmsgtu...
Craig Topper [Thu, 22 Apr 2021 17:18:33 +0000 (10:18 -0700)]
[RISCV] Add missing tests for vector type for second operand of vmsgt and vmsgtu IR intrinsics.

Refactor to use new multiclass instead of individual patterns.

We already supported this due to SEW=64 on RV32, but we didn't have
test cases for all the types we supported.

Part of D100925

3 years ago[RISCV] Support vector type for second operand of vmfge and vmfgt IR intrinsics.
Craig Topper [Thu, 22 Apr 2021 17:07:23 +0000 (10:07 -0700)]
[RISCV] Support vector type for second operand of vmfge and vmfgt IR intrinsics.

We don't have instructions for these, but can swap the operands
to use vmle/vmflt. This makes the IR interface more consistent and
simplifies the frontend implementation.

Part of D100925