Commit Graph

418329 Commits

Author SHA1 Message Date
Konstantin Varlamov 658957c79a [libc++][ranges] Implement changes to reverse_iterator from One Ranges Proposal.
Changes in [P0896](https://wg21.link/p0896):
- add `disable_sized_sentinel_for`;
- add `iter_move` and `iter_swap`;
- add a `requires` clause to the `operator->`;
- add `iterator_concept`;
- check that the `Iterator` template parameter is a bidirectional
  iterator;
- add constraints to all comparison operators;
- change the definitions of `iterator_category`, `value_type`,
  `difference_type` and `reference` (changes to `iterator_category` were
  already implemented).

Also add a few forgotten things to the `reverse_iterator` synopsis
(notably the spaceship operator).

Differential Revision: https://reviews.llvm.org/D120180
2022-03-17 19:58:03 -07:00
Sterling Augustine 07998f6d75 Correct and complete dependency sets after 74b411d38c
Prior to this change the __support_cpp_array_ref target's only dependency was libc_root.
but it #includes "TypeTraits.h" and Array.h for that matter.

These dependencies matter when building in distributed build systems and the relevant
files must be know for the distributed build to ship them to the executor.

Differential Revision: https://reviews.llvm.org/D121974
2022-03-17 19:52:49 -07:00
Jessica Clarke 63ea7797dd [RISCV] Fix buildbot breakage by explicitly instantiating templates
RISCVISelDAGToDAG's selectImm uses RISCVTargetLowering::getAddr
(specifically the ConstantPoolSDNode) as of 41454ab256 ("[RISCV] Use
constant pool for large integers"), but nothing explicitly instantiates
any of the templates, the only reason they exist is because of the
various lowering methods in RISCVISelLowering.cpp that themselves use
the methods. However, with inlining, those can end up not existing as
real functions and thus not be exported, leading to link errors. Up
until now this hasn't happened, but for whatever reason D121654 has
triggered this on the sanitizer-ppc64be-linux buildbot, giving:

  ../../../../lib/libLLVMRISCVCodeGen.a(RISCVISelDAGToDAG.cpp.o): In function `selectImm(llvm::SelectionDAG*, llvm::SDLoc const&, llvm::MVT, long, llvm::RISCVSubtarget const&)':
  RISCVISelDAGToDAG.cpp:(.text._ZL9selectImmPN4llvm12SelectionDAGERKNS_5SDLocENS_3MVTElRKNS_14RISCVSubtargetE+0x3d8): undefined reference to `llvm::SDValue llvm::RISCVTargetLowering::getAddr<llvm::ConstantPoolSDNode>(llvm::ConstantPoolSDNode*, llvm::SelectionDAG&, bool) const'
  collect2: error: ld returned 1 exit status

Fix this by explicitly instantiating getAddr in its four different forms
so separate translation units can reliably use it.

Fixes: 41454ab256 ("[RISCV] Use constant pool for large integers")
2022-03-18 02:22:17 +00:00
Sterling Augustine 9065dd1439 Fix invalid preprocessor directive. 2022-03-17 19:12:48 -07:00
Sterling Augustine 6f958b6ff5 Update llvm-config.h.cmake for LLVM_UNREACHABLE_OPTIMIZE 2022-03-17 19:04:42 -07:00
Weining Lu b75d2ec124 [LoongArch] Add some blank lines to make .td more tidy. NFC 2022-03-18 09:49:16 +08:00
Vasileios Porpodas 9136145eb0 Revert "[SLP] Fix lookahead operand reordering for splat loads." due to build failures
This reverts commit 5efa78985b.
2022-03-17 18:22:04 -07:00
Vasileios Porpodas 511fa0800f [SLP][NFC] Added a test for a followup patch that enables handling splat loads with uses. 2022-03-17 18:05:54 -07:00
Vasileios Porpodas 5efa78985b [SLP] Fix lookahead operand reordering for splat loads.
Splat loads are inexpensive in X86. For a 2-lane vector we need just one
instruction: `movddup (%reg), xmm0`. Using the standard Splat score leads
to worse code. This patch adds a new score dedicated for splat loads.

Please note that a splat is usually three IR instructions:
- It is usually a load and 2 inserts:
 %ld = load double, double* %gep
 %ins1 = insertelement <2 x double> poison, double %ld, i32 0
 %ins2 = insertelement <2 x double> %ins1, double %ld, i32 1

- But it can also be a load, an insert and a shuffle:
 %ld = load double, double* %gep
 %ins = insertelement <2 x double> poison, double %ld, i32 0
 %shf = shufflevector <2 x double> %ins, <2 x double> poison, <2 x i32> zeroinitializer

Because of this some of the lit tests contain more IR instructions.

Differential Revision: https://reviews.llvm.org/D121354
2022-03-17 18:05:54 -07:00
Vasileios Porpodas b051c836c0 [SLP][NFC] This adds a test for a follow-up patch that fixes a look-ahead operand reordering issue
Differential Revision: https://reviews.llvm.org/D121353
2022-03-17 18:05:53 -07:00
Benjamin Kramer 5d2ce7663b Use llvm::append_range instead of push_back loops where applicable. NFCI. 2022-03-18 01:25:34 +01:00
Paul Kirth 964398ccb1 Revert "Revert "Revert "[misexpect] Re-implement MisExpect Diagnostics"""
This reverts commit 6cf560d69a.
2022-03-18 00:21:33 +00:00
Nico Weber 5f4a334ded [gn build] (manually) port 6316129e06 2022-03-17 20:08:14 -04:00
Paul Kirth 6cf560d69a Revert "Revert "[misexpect] Re-implement MisExpect Diagnostics""
I mistakenly reverted my commit, so I'm relanding it.

This reverts commit 10866a1df4.
2022-03-18 00:04:22 +00:00
Paul Kirth 10866a1df4 Revert "[misexpect] Re-implement MisExpect Diagnostics"
This reverts commit e7749d4713.
2022-03-17 23:54:26 +00:00
Paul Kirth e7749d4713 [misexpect] Re-implement MisExpect Diagnostics
Reimplements MisExpect diagnostics from D66324 to reconstruct its
original checking methodology only using MD_prof branch_weights
metadata.

New checks rely on 2 invariants:

1) For frontend instrumentation, MD_prof branch_weights will always be
   populated before llvm.expect intrinsics are lowered.

2) for IR and sample profiling, llvm.expect intrinsics will always be
   lowered before branch_weights are populated from the IR profiles.

These invariants allow the checking to assume how the existing branch
weights are populated depending on the profiling method used, and emit
the correct diagnostics. If these invariants are ever invalidated, the
MisExpect related checks would need to be updated, potentially by
re-introducing MD_misexpect metadata, and ensuring it always will be
transformed the same way as branch_weights in other optimization passes.

Frontend based profiling is now enabled without using LLVM Args, by
introducing a new CodeGen option, and checking if the -Wmisexpect flag
has been passed on the command line.

Differential Revision: https://reviews.llvm.org/D115907
2022-03-17 23:46:23 +00:00
Yonghong Song 2e94d8e67a [BPF] handle unsigned icmp ops in BPFAdjustOpt pass
When investigating an issue with bcc tool inject.py, I found
a verifier failure with latest clang. The portion of code
can be illustrated as below:
  struct pid_struct {
    u64 curr_call;
    u64 conds_met;
    u64 stack[2];
  };
  struct pid_struct *bpf_map_lookup_elem();
  int foo() {
    struct pid_struct *p = bpf_map_lookup_elem();
    if (!p) return 0;
    p->curr_call--;
    if (p->conds_met < 1 || p->conds_met >= 3)
        return 0;
    if (p->stack[p->conds_met - 1] == p->curr_call)
        p->conds_met--;
    ...
  }

The verifier failure looks like:
  ...
  8: (79) r1 = *(u64 *)(r0 +0)
   R0_w=map_value(id=0,off=0,ks=4,vs=32,imm=0) R10=fp0 fp-8=mmmm????
  9: (07) r1 += -1
  10: (7b) *(u64 *)(r0 +0) = r1
   R0_w=map_value(id=0,off=0,ks=4,vs=32,imm=0) R1_w=inv(id=0) R10=fp0 fp-8=mmmm????
  11: (79) r2 = *(u64 *)(r0 +8)
   R0_w=map_value(id=0,off=0,ks=4,vs=32,imm=0) R1_w=inv(id=0) R10=fp0 fp-8=mmmm????
  12: (bf) r3 = r2
  13: (07) r3 += -3
  14: (b7) r4 = -2
  15: (2d) if r4 > r3 goto pc+13
   R0=map_value(id=0,off=0,ks=4,vs=32,imm=0) R1=inv(id=0) R2=inv(id=2)
   R3=inv(id=0,umin_value=18446744073709551614,var_off=(0xffffffff00000000; 0xffffffff))
   R4=inv-2 R10=fp0 fp-8=mmmm????
  16: (07) r2 += -1
  17: (bf) r3 = r2
  18: (67) r3 <<= 3
  19: (bf) r4 = r0
  20: (0f) r4 += r3
  math between map_value pointer and register with unbounded min value is not allowed

Here the compiler optimized "p->conds_met < 1 || p->conds_met >= 3" to
  r2 = p->conds_met
  r3 = r2
  r3 += -3
  r4 = -2
  if (r3 < r4) return 0
  r2 += -1
  r3 = r2
  ...
In the above, r3 is initially equal to r2, but is modified used by the comparison.
But later on r2 is used again. This caused verification failure.

BPF backend has a pass, AdjustOpt, to prevent such transformation, but only
focused on signed integers since typical bpf helper returns signed integers.
To fix this case, let us handle unsigned integers as well.

Differential Revision: https://reviews.llvm.org/D121937
2022-03-17 16:24:39 -07:00
Alina Sbirlea 6c4931e7d0 [docs] Fix codeblock. 2022-03-17 15:53:20 -07:00
Mehdi Amini 71302b6711 Revert "[MLIR][Presburger] introduce SetCoalescer"
This reverts commit dad80e9710.

The build is broken with some configurations (gcc-5 and gcc-8):

mlir/lib/Analysis/Presburger/PresburgerRelation.cpp:402:32: error: qualified name does not name a class before '{' token
 class presburger::SetCoalescer {
2022-03-17 22:50:16 +00:00
Stanislav Mekhanoshin 275b0c5a5a [AMDGPU] Add 2 gfx940 mfma tests. NFC. 2022-03-17 15:47:13 -07:00
Johannes Doerfert 4308fdf83b [Attributor] Remove more non-deterministic behavior and debug output 2022-03-17 17:42:32 -05:00
Johannes Doerfert 59a6b668ab [OpenMP][FIX] Initialize member to avoid undefined value in debug output 2022-03-17 17:42:32 -05:00
Johannes Doerfert 88ea86c369 [Attributor][FIX] Remove reference into map that might dangle
The reference was taken and the map was modified after. This can (and
did) lead to dangling pointers and all sorts of problems afterwards.
2022-03-17 17:42:32 -05:00
Ellis Hoag f6b5142ac2 [AlwaysInliner] Emit inline remark only when successful
Failures in `InlineFunction()` are caught after D121722, but `emitInlinedIntoBasedOnCost()` should only be called when inlining is successful. This also removes an unnecessary call to `shouldInline()` which always returned `InlineCost::getAlways()`.

Reviewed By: kyulee, nikic

Differential Revision: https://reviews.llvm.org/D121946
2022-03-17 15:40:24 -07:00
Alina Sbirlea 187a5f230f [docs] Add details to MemorySSA docs.
Add more details to the docs regarding optimized accesses for Uses and Defs.
Include incoming changes from https://reviews.llvm.org/D121381.

Differential Revision: https://reviews.llvm.org/D121740
2022-03-17 15:25:09 -07:00
Thomas Lively 7062094bbc [WebAssembly] Add end-to-end codegen tests for wasm_simd128.h
Add a test checking that each SIMD intrinsic produces the expected instruction.
Since this test spans both clang and LLVM, place it in a new
intrinsic-header-tests subdirectory of cross-project-tests.

This revives D101684 now that cross-project-tests exists. In practice, the tests
of lowering from wasm_simd128.h to LLVM IR were not as useful as this end-to-end
test.

Updates the version check of gdb in cross-project-tests/lit.cfg.py so that
unexpected version formats do not prevent the new tests from running.

Depends on D121661.

Differential Revision: https://reviews.llvm.org/D121662
2022-03-17 15:22:17 -07:00
Mehdi Amini 6316129e06 Add a cmake flag to turn `llvm_unreachable()` into builtin_trap() when assertions are disabled
Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121750
2022-03-17 22:21:14 +00:00
Jonas Devlieghere 74b45f91b8
[lldb] Migrate ProcessGDBRemote to ReportWarning 2022-03-17 15:13:48 -07:00
Kyungwoo Lee ddb85f34f5 [ObjCARC] Fix non-determinism
We often failed in the assertion, non-deterministically with a large IR:
```
Assertion `notDifferentParent(LocA.Ptr, LocB.Ptr) && "BasicAliasAnalysis doesn't support interprocedural queries."
```
Looking at the comment in https://reviews.llvm.org/D87806, it appears it's actually a module pass for new PM while the legacy PM still works as a function pass.
The fix is to align the same behavior in between new PM and old PM, which initializes ObjCARCContract for each function.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D121949
2022-03-17 15:01:09 -07:00
Nikolas Klauser 3e02c8e2fc [libc++] [test] Add ranges_robust_against_copying_*.pass.cpp
This tests the same QoI issue as the existing STL Classic test,
    but for the Ranges algorithms. Also, do the same thing for all
    the algorithms that take projections.

I found a few missing algorithms and added them to the existing test, too. `std::find_first_of` currently fails; I should look at why that is (and in particular, what is it doing weird that //makes// it inconsistent with the entire rest of libc++?).

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D121265
2022-03-17 22:36:18 +01:00
Louis Dionne ce3feebd33 [libc++] Install psutil on CI builders
This will make it possible to add a timeout when running the tests.
2022-03-17 17:33:13 -04:00
Changpeng Fang dd5895cc39 AMDGPU: Use the implicit kernargs for code object version 5
Summary:
  Specifically, for trap handling, for targets that do not support getDoorbellID,
we load the queue_ptr from the implicit kernarg, and move queue_ptr to s[0:1].
To get aperture bases when targets do not have aperture registers, we load
private_base or shared_base directly from the implicit kernarg. In clang, we use
implicitarg_ptr + offsets to implement __builtin_amdgcn_workgroup_size_{xyz}.

Reviewers: arsenm, sameerds, yaxunl

Differential Revision: https://reviews.llvm.org/D120265
2022-03-17 14:12:36 -07:00
Louis Dionne 2c9995c117 [libc++] Add missing <cstddef> include 2022-03-17 17:07:37 -04:00
Sam Clegg a04a507714 [lld][WebAssembly] Fix crash accessing non-live __tls_base symbol
In programs that don't otherwise depend on `__tls_base` it won't
be marked as live.  However this symbol is used internally in
a couple of places do we need to mark it as live explictily in
those places.

Fixes: #54386

Differential Revision: https://reviews.llvm.org/D121931
2022-03-17 13:59:45 -07:00
Eli Friedman 523c572c37 [IndVars] Add a new test affected by 62f86d4f 2022-03-17 13:49:07 -07:00
Andrew Litteken f7d90ad57b [IROutliner] Make sure that loop debug info is stripped.
As pointed out in https://github.com/llvm/llvm-project/issues/54155#issuecomment-1057465479, there was a crash when loop info was being outlined. It was not being properly stripped and adjusted, so would point to the wrong location. This uses similar logic found in the CodeExtractor to adjust the loop debug info.

Reviewer: fhahn, paquette

Differential Revision: https://reviews.llvm.org/D120869
2022-03-17 14:41:53 -06:00
Valentin Clement 518a837e93
[flang] Add array constructor lowering tests
This patch adds some tests for the lowering of
array constructors.

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

Reviewed By: PeteSteinfeld

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

Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2022-03-17 21:40:37 +01:00
Stanislav Mekhanoshin d9ac55fab2 [AMDGPU] New MFMA names for existing instructions
Old names are supported as aliases.
_1k MFMA got new opcodes.

Differential Revision: https://reviews.llvm.org/D121741
2022-03-17 13:05:36 -07:00
Stanislav Mekhanoshin e0b9364b5c [AMDGPU] Add gfx90a and gfx940 to get_elf_mach_gfx_name.cpp
Differential Revision: https://reviews.llvm.org/D120849
2022-03-17 13:05:07 -07:00
Ben Barham 4125524112 [VFS] Add print/dump to the whole FileSystem hierarchy
For now most are implemented by printing out the name of the filesystem,
but this can be expanded in the future. Only `OverlayFileSystem` and
`RedirectingFileSystem` are properly implemented in this patch.
  - `OverlayFileSystem`: Prints each filesystem in the order that any
    operations are actually run on them. Optionally prints recursively.
  - `RedirectingFileSystem`: Prints out all mappings, as well as the
    `ExternalFS`. Most of this was already implemented other than the
    handling for the `DirectoryRemap` case and to actually print out the
    mapping.

Each FS should implement `printImpl` rather than `print`, where the
latter just fowards to the former. This is to avoid spreading the
default arguments through to the subclasses (where we may miss updating
in the future).

Differential Revision: https://reviews.llvm.org/D121421
2022-03-17 13:02:40 -07:00
Johannes Doerfert b4cc3b1dd8 [OpenMP][FIX] Make metadata and attribute check lines less detailed
The update_cc script should really do this automatically :(
2022-03-17 14:58:22 -05:00
Michel Weber dad80e9710 [MLIR][Presburger] introduce SetCoalescer
This patch refactors the current coalesce implementation. It introduces
the `SetCoalescer`, a class in which all coalescing functionality lives.
The main advantage over the old design is the fact that the vectors of
constraints do not have to be passed around, but are implemented as
private fields of the SetCoalescer. This will become especially
important once more inequality types are introduced.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D121364
2022-03-17 19:52:01 +00:00
Benjamin Kramer d80210fc90 [dsymutil] Store possible Swift reflection sections in an array
No need for a unordered_map of enum, which is also broken in GCC before
6.1. No functionality change intended.
2022-03-17 20:37:39 +01:00
Benjamin Kramer 548757ba86 [mlir] Move InterfaceMap::InterfaceMap to the cpp file
So we don't end up with a copy of std::sort in every dialect definition.
NFCI.
2022-03-17 20:14:24 +01:00
Benjamin Kramer ba8e336a23 [mlir] Use array_pod_sort for sorting stats/counters.
This isn't performance sensitive and array_pod_sort is a lot smaller.
NFCI.
2022-03-17 20:14:24 +01:00
Stanislav Mekhanoshin 522b259976 [AMDGPU] Allow v_accvgpr_write to use SGPR src on gfx940
Differential Revision: https://reviews.llvm.org/D121843
2022-03-17 12:12:06 -07:00
LLVM GN Syncbot f18590118e [gn build] Port 22570bac69 2022-03-17 19:06:22 +00:00
Kevin P. Neal ae6db2f3d8 Precommit test for D121483:
[FPEnv][InstSimplify] Teach CannotBeNegativeZero() about constrained intrinsics.
2022-03-17 15:03:05 -04:00
Johannes Doerfert 052a6c744a [OpenMP][FIX] Relax test check lines 2022-03-17 14:01:47 -05:00
Pavel Labath f93d861349
[lldb] Fix ^C handling in IOHandlerProcessSTDIO
D120762 accidentally moved the interrupt check into the block which was
reading stdio. This meant that a ^C only took effect after a regular
character has been pressed.

This patch fixes that and adds a (pexpect) test.

Differential revision: https://reviews.llvm.org/D121912
2022-03-17 11:52:19 -07:00