platform/upstream/llvm.git
2 years agoAdapt `tsan/flush_memory.cpp` to run on non-local platforms.
Dan Liew [Wed, 29 Sep 2021 17:28:03 +0000 (10:28 -0700)]
Adapt `tsan/flush_memory.cpp` to run on non-local platforms.

ad890aa2327feb6b6aee676fe85b2352fba2403e landed a test without
using the `%run` prefix which means the test fails to run for
platforms that need it (e.g. iOS simulators).

This patch adds the `%run` prefix. While we're here also split
the single `RUN` line into two to make debugging easier.

rdar://83637296

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

2 years ago[Driver] Check that short triples are supported for Fuchsia
Petr Hosek [Wed, 29 Sep 2021 08:24:43 +0000 (01:24 -0700)]
[Driver] Check that short triples are supported for Fuchsia

{x86_64,aarch64}-unknown-fuchsia and {x86_64,aarch64}-fuchsia should
behave identically as targets, update the test to make sure that's the
case.

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

2 years ago[clang-cl] Accept `#pragma warning(disable : N)` for some N
Nico Weber [Tue, 28 Sep 2021 23:33:59 +0000 (19:33 -0400)]
[clang-cl] Accept `#pragma warning(disable : N)` for some N

clang-cl maps /wdNNNN to -Wno-flags for a few warnings that map
cleanly from cl.exe concepts to clang concepts.

This patch adds support for the same numbers to
`#pragma warning(disable : NNNN)`. It also lets
`#pragma warning(push)` and `#pragma warning(pop)` have an effect,
since these are used together with `warning(disable)`.

The optional numeric argument to `warning(push)` is ignored,
as are the other non-`disable` `pragma warning()` arguments.
(Supporting `error` would be easy, but we also don't support
`/we`, and those should probably be added together.)

The motivating example is that a bunch of code (including in LLVM)
uses this idiom to locally disable warnings about calls to deprecated
functions in Windows-only code, and 4996 maps nicely to
-Wno-deprecated-declarations:

    #pragma warning(push)
    #pragma warning(disable: 4996)
      f();
    #pragma warning(pop)

Implementation-wise:
- Move `/wd` flag handling from Options.td to actual Driver-level code
- Extract the function mapping cl.exe IDs to warning groups to the
  new file clang/lib/Basic/CLWarnings.cpp
- Create a diag::Group enum so that CLWarnings.cpp can refer to
  existing groups by ID (and give DllexportExplicitInstantiationDecl
  a named group), and add a function to map a diag::Group to the
  spelling of it's associated commandline flag
- Call that new function from PragmaWarningHandler

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

2 years ago[libc++] Move libc++ specific tests to `libcxx/test/libcxx`
Louis Dionne [Wed, 29 Sep 2021 17:11:52 +0000 (13:11 -0400)]
[libc++] Move libc++ specific tests to `libcxx/test/libcxx`

This is consistent with what we've been doing forever.

2 years ago[InstSimplify] (-1 << x) s>> x --> -1
Sanjay Patel [Wed, 29 Sep 2021 15:59:50 +0000 (11:59 -0400)]
[InstSimplify] (-1 << x) s>> x --> -1

This was noticed in:
https://llvm.org/PR51351

https://alive2.llvm.org/ce/z/aLxunD

2 years ago[mlir][sparse] simplify negi code generation with subi
Aart Bik [Wed, 29 Sep 2021 05:48:32 +0000 (22:48 -0700)]
[mlir][sparse] simplify negi code generation with subi

The lack of negi details leaked from merger class into codegen part.
Also, special case for vector code was not needed, the type can be used directly!

Reviewed By: bixia

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

2 years agoFix LLDB build on old Linux kernels
Walter Erquinigo [Wed, 29 Sep 2021 16:40:53 +0000 (09:40 -0700)]
Fix LLDB build on old Linux kernels

Usage of aux_size is guarded against elsewhere in this file, but is missing here.

Reviewed By: wallace

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

Original Author: calebzulawski

2 years ago[fir] Update fir.call op
Eric Schweitz [Wed, 29 Sep 2021 16:29:33 +0000 (18:29 +0200)]
[fir] Update fir.call op

Move builders to .cpp file and update accordingly.

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

Reviewed By: kiranchandramohan

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
2 years ago[PowerPC] swdiv builtins for XL compatibility
Quinn Pham [Thu, 22 Jul 2021 13:47:57 +0000 (08:47 -0500)]
[PowerPC] swdiv builtins for XL compatibility

This patch is in a series of patches to provide builtins for compatibility with
the XL compiler. This patch implements the software divide builtin as
wrappers for a floating point divide. XL provided these builtins because it
didn't produce software estimates by default at `-Ofast`. When compiled
with `-Ofast` these builtins will produce the software estimate for divide.

Reviewed By: #powerpc, nemanjai

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

2 years ago[llvm-reduce] Reduce metadata references.
Michael Kruse [Wed, 29 Sep 2021 15:51:13 +0000 (10:51 -0500)]
[llvm-reduce] Reduce metadata references.

The ReduceMetadata pass before this patch removed metadata on a per-MDNode (or NamedMDNode) basis. Either all references to an MDNode are kept, or all of them are removed. However, MDNodes are uniqued, meaning that references to MDNodes with the same data become references to the same MDNodes. As a consequence, e.g. tbaa references to the same type will all have the same MDNode reference and hence make it impossible to reduce only keeping metadata on those memory access for which they are interesting.
Moreover, MDNodes can also be referenced by some intrinsics or other MDNodes. These references were not considered for removal leading to the possibility that MDNodes are not actually removed even if selected to be removed by the oracle.

This patch changes ReduceMetadata to reduces based on removable metadata references instead. MDNodes without references implicitly dropped anyway. References by intrinsic calls should be removed by ReduceOperands or ReduceInstructions. References in other MDNodes cannot be removed as it would violate the immutability of MDNodes.

Additionally, ReduceMetadata pass before this patch used `setMetadata(I, NULL)` to remove references, where `I` is the index in the array returned by `getAllMetadata`. However, `setMetadata` expects a MDKind (such as `MD_tbaa`) as first argument. `getAllMetadata` does not return those in consecutive order (otherwise it would not need to be a `std::pair` with `first` representing the MDKind).

Reviewed By: aeubanks, swamulism

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

2 years ago[OpenCL][NFC] Refactor vloada_half and vstorea_half decls
Stuart Brady [Tue, 28 Sep 2021 16:11:04 +0000 (17:11 +0100)]
[OpenCL][NFC] Refactor vloada_half and vstorea_half decls

Group them together with the vload_half and vstore_half decls for
simplicity.

Reviewed By: svenvh

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

2 years ago[libomptarget] [amdgpu] After a kernel dispatch packet is published, its contents...
Dhruva Chakrabarti [Wed, 29 Sep 2021 05:44:14 +0000 (22:44 -0700)]
[libomptarget] [amdgpu] After a kernel dispatch packet is published, its contents must not be accessed.

Fixes: SWDEV-275232 (With contributions from Ammar Elwazir, Laurent Morichetti, and Tony Tye)

The current code is racy. After the packet is submitted, the GPU will increment the read index. If this wraps around before the memory is read from it'll refer to a signal from an unrelated packet. Change avoids reading from the packet post-submission.

Reviewed By: JonChesterfield

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

2 years ago[fir][NFC] Update fir.iterate_while op
Eric Schweitz [Wed, 29 Sep 2021 16:12:17 +0000 (18:12 +0200)]
[fir][NFC] Update fir.iterate_while op

Add getFinalValueAttrName() and remove specified number of
inlined elements for SmallVector. This patch is mainly motivated
to help the upstreaming effort.

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Reviewed By: kiranchandramohan

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

2 years ago[AArch64] Remove redundant declaration createAArch64ObjectTargetStreamer (NFC)
Kazu Hirata [Wed, 29 Sep 2021 16:08:41 +0000 (09:08 -0700)]
[AArch64] Remove redundant declaration createAArch64ObjectTargetStreamer (NFC)

Note that createAArch64ObjectTargetStreamer is declared in
AArch64TargetStreamer.h and defined in AArch64TargetStreamer.cpp.

Identified with readability-redundant-declaration.

2 years ago[AArch64] Model Cortex-A55 Q register NEON instructions
David Green [Wed, 29 Sep 2021 15:55:31 +0000 (16:55 +0100)]
[AArch64] Model Cortex-A55 Q register NEON instructions

Cortex-A55 has 2 64bit NEON vector units, meaning a 128bit instruction
requires taking both units (and can only be issued as the first
instruction in a dual issue pair). This patch models that by splitting
the WriteV SchedWrite into two - the WriteVd that reads/writes only
64bit operands, and the WriteVq that read/writes 128bit registers. The
A55 schedule then uses this distinction to model the WriteVq as taking
both resource units, and starting a Schedule Group and WriteVd as taking
one as before.

I believe this is more correct, even if it does not lead to much better
performance.

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

2 years ago[PowerPC][AIX] Warn when using pragma align(packed) on AIX.
Sean Fertile [Wed, 29 Sep 2021 15:53:46 +0000 (11:53 -0400)]
[PowerPC][AIX] Warn when using pragma align(packed) on AIX.

With xlc and xlC pragma align(packed) will pack bitfields the same way
as pragma align(bit_packed). xlclang, xlclang++ and clang will
pack bitfields the same way as pragma pack(1). Issue a warning when
source code using pragma align(packed) is used to alert the user it
may not be compatable with xlc/xlC.

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

2 years ago[InstCombine] fix miscompile from dropRedundantMaskingOfLeftShiftInput()
Sanjay Patel [Wed, 29 Sep 2021 15:38:48 +0000 (11:38 -0400)]
[InstCombine] fix miscompile from dropRedundantMaskingOfLeftShiftInput()

The test is from https://llvm.org/PR51351.

There are 2 related logic bugs from over-generalizing "lshr" to "any shr",
but I'm not sure how to expose the difference for "MaskC" because instsimplify
already folds ashr of -1.

I'll extend instsimplify to catch the MaskD pattern as a follow-up, but this
patch should be enough to avoid the miscompile.

2 years ago[InstSimplify] add tests for (-1 << x) s>> x; NFC
Sanjay Patel [Wed, 29 Sep 2021 14:56:56 +0000 (10:56 -0400)]
[InstSimplify] add tests for (-1 << x) s>> x; NFC

2 years ago[InstCombine] add test for miscompile in dropRedundantMaskingOfLeftShiftInput();...
Sanjay Patel [Wed, 29 Sep 2021 14:44:46 +0000 (10:44 -0400)]
[InstCombine] add test for miscompile in dropRedundantMaskingOfLeftShiftInput(); NFC (PR51351)

2 years ago[MSP430] Recognize Bi as an indirect branch in analyzeBranch. NFC.
Jay Foad [Wed, 29 Sep 2021 09:52:00 +0000 (10:52 +0100)]
[MSP430] Recognize Bi as an indirect branch in analyzeBranch. NFC.

Recognize Bi as an unconditional branch, just like JMP. This allows
machine verification to run after MSP430BranchSelector without failing
this assertion:

virtual bool llvm::MSP430InstrInfo::analyzeBranch(llvm::MachineBasicBlock &, llvm::MachineBasicBlock *&, llvm::MachineBasicBlock *&, SmallVectorImpl<llvm::MachineOperand> &, bool) const: Assertion `I->getOpcode() == MSP430::JCC && "Invalid conditional branch"' failed.

Note that machine verification is currently disabled after
addPreEmitPass passes because of problems on other targets, so this is
currently NFC.

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

2 years ago[TTI] BasicTTI::getInterleavedMemoryOpCost(): use getScalarizationOverhead()
Simon Pilgrim [Wed, 29 Sep 2021 15:41:53 +0000 (16:41 +0100)]
[TTI] BasicTTI::getInterleavedMemoryOpCost(): use getScalarizationOverhead()

getScalarizationOverhead() results in a somewhat better cost estimation than counting the insertion/extraction costs directly. Notably, this is still overestimating the costs.

Original Patch by: @lebedev.ri (Roman Lebedev)

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

2 years ago[clang-tidy] Merges separate isa<>/assert/unreachable/dyn_cast<>/cast<> calls
Simon Pilgrim [Wed, 29 Sep 2021 11:54:52 +0000 (12:54 +0100)]
[clang-tidy] Merges separate isa<>/assert/unreachable/dyn_cast<>/cast<> calls

We can directly use cast<> instead of separate dyn_cast<> with assertions as cast<> will perform this for us.

Similarly we can replace a if(isa<>)+cast<>/dyn_cast<> with if(dyn_cast<>)

2 years ago[CostModel][AArch64] Don't dereference CostTblEntry before null check.
Simon Pilgrim [Wed, 29 Sep 2021 11:28:38 +0000 (12:28 +0100)]
[CostModel][AArch64] Don't dereference CostTblEntry before null check.

Fix static analysis warning that we check for null Entry after dereferencing it.

I don't think this can actually happen as i8/i16 should legalize to use the i32 path which should return a cost - but I'd rather play it safe that rely on an implicit type legalization.

2 years ago[WebAssemlby][Object] Fix dead code in WasmObjectFile.cpp
Sam Clegg [Wed, 29 Sep 2021 14:26:46 +0000 (07:26 -0700)]
[WebAssemlby][Object] Fix dead code in WasmObjectFile.cpp

I introduced this by mistake in https://reviews.llvm.org/D109595.

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

2 years ago[lldb] Fix TestImportStdModule on some setups by testing minmax instead of abs
Raphael Isemann [Wed, 29 Sep 2021 14:47:12 +0000 (16:47 +0200)]
[lldb] Fix TestImportStdModule on some setups by testing minmax instead of abs

Some downstream forks of LLDB change parts of the test setup in a way that
causes lldb to somehow resolve `std::abs` (probably to `::abs`). This patch
changes the tested function here to be `std::minmax` which (hopefully) doesn't
have any identically named functions that LLDB could find and call. Just to be
extra safe this also explicitly specified the template arguments so that in
case there is a `minmax` non-template function we still don't end up calling it
from this test.

2 years agoUse rm -f to fix Windows failures from test changes
Teresa Johnson [Wed, 29 Sep 2021 14:58:49 +0000 (07:58 -0700)]
Use rm -f to fix Windows failures from test changes

Try to address Windows flakes from d87bdc272ba47b7d9109ff5c7191454ab2ae6fcb
by using 'rm -f' instead of just 'rm' as discussed in D110276. For example:
http://45.33.8.238/win/46115/step_7.txt

2 years ago[clang] Fix library name (libsupc++) in the admonition note.
Frederic Cambus [Wed, 29 Sep 2021 14:14:47 +0000 (19:44 +0530)]
[clang] Fix library name (libsupc++) in the admonition note.

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

2 years ago[AArch64] Enable type promotion for AArch64
David Green [Wed, 29 Sep 2021 14:13:12 +0000 (15:13 +0100)]
[AArch64] Enable type promotion for AArch64

This enables the type promotion pass for AArch64, which acts as a
CodeGenPrepare pass to promote illegal integers to legal ones,
especially useful for removing extends that would otherwise require
cross-basic-block analysis.

I have enabled this generally, for both ISel and GlobalISel. In some
quick experiments it appeared to help GlobalISel remove extra extends in
places too, but that might just be missing optimizations that are better
left for later. We can disable it again if required.

In my experiments, this can improvement performance in some cases, and
codesize was a small improvement. SPEC was a very small improvement,
within the noise. Some of the test cases show extends being moved out of
loops, often when the extend would be part of a cmp operand, but that
should reduce the latency of the instruction in the loop on many cpus.
The signed-truncation-check tests are increasing as they are no longer
matching specific DAG combines.

We also hope to add some additional improvements to the pass in the near
future, to capture more cases of promoting extends through phis that
have come up in a few places lately.

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

2 years agoIntroduced AllocationOpInterface to create deallocation operations on-the-fly that...
Marcel Koester [Tue, 7 Sep 2021 10:21:35 +0000 (12:21 +0200)]
Introduced AllocationOpInterface to create deallocation operations on-the-fly that are compatible with the allocation operation implementing this interface.
Added interface implementations for AllocOp and CloneOp defined in the MemRef diallect.
Adapted the BufferDeallocation pass to be compatible with the interface introduced in this CL.

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

2 years ago[IndVarSimplify] Forget phi value after changing incoming value.
Florian Hahn [Wed, 29 Sep 2021 13:38:35 +0000 (14:38 +0100)]
[IndVarSimplify] Forget phi value after changing incoming value.

This fixes an issue exposed by D71539, where IndVarSimplify tries
to access an invalid cached SCEV expression after making changes to the
underlying PHI instruction earlier.

When changing the incoming value of a PHI, forget the cached SCEV for
the PHI.

2 years ago[mlir][Linalg] Rewrite CodegenStrategy to populate a pass pipeline.
Nicolas Vasilache [Wed, 29 Sep 2021 09:36:32 +0000 (09:36 +0000)]
[mlir][Linalg] Rewrite CodegenStrategy to populate a pass pipeline.

This revision retires a good portion of the complexity of the codegen strategy and puts the logic behind pass logic.

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

2 years ago[AArch64] Add TypePromotion tests and regenerate atomic test check lines
David Green [Wed, 29 Sep 2021 13:35:09 +0000 (14:35 +0100)]
[AArch64] Add TypePromotion tests and regenerate atomic test check lines

This adds some extra tests for TypePromotion as per D110239, and
regenerated the check lines in atomic-ops.ll and cmpxchg-idions.ll to be
more easy to maintain with changing codegen (hopefully in a way that
does not reduce what is tested).

2 years ago[NFC][X86] Add codegen test coverage for interleaved load/store i8 stride=2
Roman Lebedev [Wed, 29 Sep 2021 12:27:26 +0000 (15:27 +0300)]
[NFC][X86] Add codegen test coverage for interleaved load/store i8 stride=2

2 years ago[NFC][X86][LV] Add costmodel test coverage for interleaved i8 load/store stride=2
Roman Lebedev [Wed, 29 Sep 2021 12:19:56 +0000 (15:19 +0300)]
[NFC][X86][LV] Add costmodel test coverage for interleaved i8 load/store stride=2

2 years ago[lld/mac] Don't warn on both --icf=all and -no_deduplicate
Nico Weber [Wed, 29 Sep 2021 00:57:40 +0000 (20:57 -0400)]
[lld/mac] Don't warn on both --icf=all and -no_deduplicate

Instead, just make the later flag win, like usual.
Implement this by making -no_deduplicate an actual alias for --icf=none
at the Options.td level.

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

2 years ago[LTO][Legacy] Add -debug-pass-manager option to enable pass run/skip trace.
Wael Yehia [Mon, 20 Sep 2021 14:59:26 +0000 (14:59 +0000)]
[LTO][Legacy] Add -debug-pass-manager option to enable pass run/skip trace.

Reviewed by: steven_wu, fhahn, tejohnson

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

2 years agoRevert 9b944c184396ce55a3ad608779cc326ba12c9ee3 with fixes
Salman Javed [Wed, 29 Sep 2021 11:59:04 +0000 (07:59 -0400)]
Revert 9b944c184396ce55a3ad608779cc326ba12c9ee3 with fixes

This reintroduces c0687e1984a82925918c874b7bb68ad34c32aed0 (Add support
for `NOLINTBEGIN` ... `NOLINTEND` comments) but with fixes to the tests.

2 years ago[lldb] [Host] Remove TerminalStateSwitcher
Michał Górny [Wed, 29 Sep 2021 11:13:54 +0000 (13:13 +0200)]
[lldb] [Host] Remove TerminalStateSwitcher

Remove TerminalStateSwitcher class.  It is not used anywhere and its API
is really weird.  This is the first step towards cleaning up Terminal.h.

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

2 years agoNFC: [Debugify] Fix a typo when checking variables in the original mode
Djordje Todorovic [Wed, 29 Sep 2021 11:20:15 +0000 (04:20 -0700)]
NFC: [Debugify] Fix a typo when checking variables in the original mode

2 years ago[PowerPC] Implement builtin for vbpermd
Nemanja Ivanovic [Wed, 29 Sep 2021 11:33:46 +0000 (06:33 -0500)]
[PowerPC] Implement builtin for vbpermd

The instruction has similar semantics to vbpermq but for doublewords.
It was added in Power9 and the ABI documents the builtin.

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

2 years ago[NFC][X86][LV] Add some test coverage for [un]masked gather/scatter
Roman Lebedev [Wed, 29 Sep 2021 09:49:28 +0000 (12:49 +0300)]
[NFC][X86][LV] Add some test coverage for [un]masked gather/scatter

While we did have test coverage for the intrinsics,
i don't believe there was LV-based test coverage.

2 years ago[PowerPC] Define XL-compatible macros only for AIX and Linux
Nemanja Ivanovic [Wed, 29 Sep 2021 11:14:12 +0000 (06:14 -0500)]
[PowerPC] Define XL-compatible macros only for AIX and Linux

Since XLC only ever shipped on PowerPC AIX and Linux, it is not reasonable to
provide the compatibility macros on any target other than those two. This patch
restricts those macros to AIX/Linux.

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

2 years ago[SelectionDAG] Make WidenVecRes_EXTRACT_SUBVECTOR work for scalable vectors.
Sander de Smalen [Wed, 29 Sep 2021 10:33:40 +0000 (11:33 +0100)]
[SelectionDAG] Make WidenVecRes_EXTRACT_SUBVECTOR work for scalable vectors.

The legalizer handles this by breaking up an EXTRACT_SUBVECTOR into
smaller parts, and combines those together, padding the result with
UNDEF vectors, e.g.

  nxv6i64 extract_subvector(nxv12i64, 6)
  <->
  nxv8i64 concat(
    nxv2i64 extract_subvector(nxv16i64, 6)
    nxv2i64 extract_subvector(nxv16i64, 8)
    nxv2i64 extract_subvector(nxv16i64, 10)
    nxv2i64 undef)

Reviewed By: frasercrmck, david-arm

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

2 years ago[AArch64][SVE] Fix extract_subvector patterns for unpacked fp types.
Sander de Smalen [Tue, 28 Sep 2021 18:44:10 +0000 (19:44 +0100)]
[AArch64][SVE] Fix extract_subvector patterns for unpacked fp types.

The patterns added in D110163 were incorrect, since it used the wrong
element widths for its shuffles.

Example for nxv2f16 extract_subvector(nxv8f16 %in, 6):
  <a|b|c|d|e|f|g|h>
               ^^^
           extract g and h.

  => UUNPKHI .h -> .s results in:
  <e  |f  |g  |h  >

  => UUNPKHI .s -> .d results in:
  <g      |h      >

Reviewed By: david-arm

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

2 years ago[X86] Fix handling of i128<->fp on Windows
Martin Storsjö [Thu, 23 Sep 2021 10:38:36 +0000 (13:38 +0300)]
[X86] Fix handling of i128<->fp on Windows

On Windows, i128 arguments are passed as indirect arguments, and
they are returned in xmm0.

This is mostly fixed up by `WinX86_64ABIInfo::classify` in Clang, making
the IR functions return v2i64 instead of i128, and making the arguments
indirect. However for cases where libcalls are generated in the target
lowering, the lowering uses the default x86_64 calling convention for
i128, where they are passed/returned as a register pair.

Add custom lowering logic, similar to the existing logic for i128
div/mod (added in 4a406d32e97b1748c4eed6674a2c1819b9cf98ea),
manually making the libcall (while overriding the return type to
v2i64 or passing the arguments as pointers to arguments on the stack).

X86CallingConv.td doesn't seem to handle i128 at all, otherwise
the windows specific behaviours would ideally be implemented as
overrides there, in generic code, handling these cases automatically.

This fixes https://bugs.llvm.org/show_bug.cgi?id=48940.

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

2 years ago[AArch64][GlobalISel] Add selection tests for vector G_UMULH/G_SMULH.
Amara Emerson [Wed, 29 Sep 2021 09:54:18 +0000 (02:54 -0700)]
[AArch64][GlobalISel] Add selection tests for vector G_UMULH/G_SMULH.

We already import these patterns from SelectionDAG.

2 years ago[AMDGPU] Require AMDGPU target for ASAN instrumentation tests
David Spickett [Wed, 29 Sep 2021 09:52:27 +0000 (10:52 +0100)]
[AMDGPU] Require AMDGPU target for ASAN instrumentation tests

Should fix test failure on Arm/AArch64 quick bots which
only build those targets.

https://lab.llvm.org/buildbot/#/builders/171/builds/4077

2 years ago[RemoveRedundantDebugValues] Enable machine verification after this pass
Jay Foad [Wed, 29 Sep 2021 09:11:57 +0000 (10:11 +0100)]
[RemoveRedundantDebugValues] Enable machine verification after this pass

Machine verification after RemoveRedundantDebugValues has been disabled
since the pass was first added in D105279, but I guess this was just due
to copy-and-paste. Enabling it does not show any problems in check-llvm
in an LLVM_ENABLE_EXPENSIVE_CHECKS build.

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

2 years ago[llvm-objcopy] Rename relocation sections together with their targets.
Igor Kudrin [Wed, 29 Sep 2021 09:36:37 +0000 (16:36 +0700)]
[llvm-objcopy] Rename relocation sections together with their targets.

As for now, llvm-objcopy renames only sections that are specified
explicitly in --rename-section, while GNU objcopy keeps names of
relocation sections in sync with their targets. For example:

> readelf -S test.o
...
  [ 1] .foo      PROGBITS
  [ 2] .rela.foo RELA

> objcopy --rename-section .foo=.bar test.o gnu.o
> readelf -S gnu.o
...
  [ 1] .bar      PROGBITS
  [ 2] .rela.bar RELA

> llvm-objcopy --rename-section .foo=.bar test.o llvm.o
> readelf -S llvm.o
...
  [ 1] .bar      PROGBITS
  [ 2] .rela.foo RELA

This patch makes llvm-objcopy to match the behavior of GNU objcopy better.

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

2 years ago[AArch64][GlobalISel] Make some vector G_SMULH/G_UMULH legal.
Amara Emerson [Wed, 29 Sep 2021 09:09:21 +0000 (02:09 -0700)]
[AArch64][GlobalISel] Make some vector G_SMULH/G_UMULH legal.

2 years ago[Flang] Fix failing plugin tests
Andrzej Warzynski [Wed, 29 Sep 2021 07:28:40 +0000 (07:28 +0000)]
[Flang] Fix failing plugin tests

The updated tests were originally added in
https://reviews.llvm.org/D109890 and are currently causing some
buildbots to fail.

This patch:
* adds missing items in the `REQUIRERS` list in tests
* adds `flangOmpReport` (the plugin library added in D109890) as a CMake
  dependency for tests (only when examples are enabled)

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

2 years ago[lldb/gdb-remote] Remove last_stop_packet_mutex
Pavel Labath [Wed, 29 Sep 2021 09:22:15 +0000 (11:22 +0200)]
[lldb/gdb-remote] Remove last_stop_packet_mutex

This is a remnant of the non-stop mode.

2 years ago[Bazel] fix for aa53785f23b2b89a9a423af131697b1f7c92869f
Krasimir Georgiev [Wed, 29 Sep 2021 08:52:53 +0000 (10:52 +0200)]
[Bazel] fix for aa53785f23b2b89a9a423af131697b1f7c92869f

2 years ago[libcxx] Run u16string tests for gdb pretty printers
David Spickett [Wed, 29 Sep 2021 08:47:16 +0000 (09:47 +0100)]
[libcxx] Run u16string tests for gdb pretty printers

As far as I can tell these were just missed out when the tests
were first added. No specific reason they should be skipped.

2 years ago[VP] Vector predicated vector splice intrinsic
Simon Moll [Wed, 29 Sep 2021 06:46:51 +0000 (08:46 +0200)]
[VP] Vector predicated vector splice intrinsic

This patch introduces the vector-predicated version of the
experimental_vector_splice intrinsic [1] at the IR level. It considers
the active vector length for both vectors and and uses a vector mask to
disable certain lanes in the result.

[1] https://reviews.llvm.org/D94708

Change originally authored by Vineet Kumar <vineet.kumar@bsc.es>

Reviewed By: simoll

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

2 years ago[OpenCL] Fix as_type3 invalid store creation
Sven van Haastregt [Wed, 29 Sep 2021 08:40:06 +0000 (09:40 +0100)]
[OpenCL] Fix as_type3 invalid store creation

With -fpreserve-vec3-type enabled, a cast was not created when
converting from a non-vec3 type to a vec3 type, even though a
conversion to vec3 was performed.  This resulted in creation of
invalid store instructions.

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

2 years ago[fir][NFC] Rename operand of ArrayCoorOp
Eric Schweitz [Wed, 29 Sep 2021 08:30:54 +0000 (10:30 +0200)]
[fir][NFC] Rename operand of ArrayCoorOp

Rename `lenParams` to `typeparams` to be in sync with fir-dev.

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Reviewed By: jeanPerier

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

2 years ago[ORC][examples] Port LLJITWithRemoteDebugging to SimpleRemoteEPC
Stefan Gränitz [Mon, 27 Sep 2021 12:36:50 +0000 (14:36 +0200)]
[ORC][examples] Port LLJITWithRemoteDebugging to SimpleRemoteEPC

Though this is a full port of the example, it is not yet fully functional due to a threading issue in the SimpleRemoteEPC implementation. The issue was discussed in D110530, but it needs a more thorough solution. For now we are dropping the dependency to the old `OrcRPC` here (it's been the last use-case in-tree). The test for the example is under review in ... and will be re-enabled once the threading issue is solved.

2 years ago[ORC-RT] Add target dependencies to ORC-RT regression tests.
Lang Hames [Wed, 29 Sep 2021 05:08:47 +0000 (22:08 -0700)]
[ORC-RT] Add target dependencies to ORC-RT regression tests.

check-orc-rt had no cmake target dependency on orc or llvm-jitlink, which
could lead to regression test failures in compiler-rt. This patch should
fix the issue.

Patch by Jack Andersen (jackoalan@gmail.com). Thanks Jack!

Reviewed By: lhames

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

2 years ago[JITLink][MachO][x86-64] Add support for splitting compact-unwind sections.
Lang Hames [Wed, 29 Sep 2021 02:11:28 +0000 (19:11 -0700)]
[JITLink][MachO][x86-64] Add support for splitting compact-unwind sections.

Follow-up to fc734da7954 to enable compact-unwind splitting on x86-64.

2 years ago[AIX] Enable PGO without LTO
Jinsong Ji [Wed, 29 Sep 2021 01:53:29 +0000 (01:53 +0000)]
[AIX] Enable PGO without LTO

On AIX, we relied on LTO to merge the csects for profiling data/counter
sections.

AIX binder now get the namedcsect support to support the merging,
so now we can enable PGO without LTO with the new binder.

Reviewed By: Whitney

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

2 years ago[AMDGPU] Do not internalize ASan device library functions.
hsmahesha [Wed, 29 Sep 2021 01:48:36 +0000 (07:18 +0530)]
[AMDGPU] Do not internalize ASan device library functions.

ASan device library functions (those starts with the prefix __asan_)
are at the moment undergoing through undesired optimizations due to
internalization. Hence, in order to avoid such undesired optimizations
on ASan device library functions, do not internalize them in the first
place.

Reviewed By: yaxunl

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

2 years ago[gn build] Port c07f7099690e
LLVM GN Syncbot [Wed, 29 Sep 2021 01:03:11 +0000 (01:03 +0000)]
[gn build] Port c07f7099690e

2 years agoRevert "Recommit "[AArch64] Split bitmask immediate of bitwise AND operation""
Sterling Augustine [Wed, 29 Sep 2021 00:09:18 +0000 (17:09 -0700)]
Revert "Recommit "[AArch64] Split bitmask immediate of bitwise AND operation""

This reverts commit 73a196a11c0e6fe7bbf33055cc2c96ce3c61ff0d.

Causes crashes as reported in https://reviews.llvm.org/D109963

2 years ago[SelectionDAG] Fix incorrect condition for shift amount truncation
Itay Bookstein [Mon, 27 Sep 2021 22:36:41 +0000 (15:36 -0700)]
[SelectionDAG] Fix incorrect condition for shift amount truncation

Comment says:
  // If the operand is larger than the shift count type but the shift
  // count type has enough bits to represent any shift value ...

It clearly talks about the shifted operand, not the shift-amount operand,
but the comparison is performed against Log2_32_Ceil(Op2.getValueSizeInBits())
where Op2 is the shift amount operand. This comparison also doesn't make
sense in the context of the previous one (ShiftsSize > Op2Size) because
Op2Size == Op2.getValueSizeInBits(). Fix to use Op1.

Reviewed By: craig.topper

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

2 years ago[AIX] Change the linkage of profiling counter/data to be private
Jinsong Ji [Tue, 28 Sep 2021 22:28:13 +0000 (22:28 +0000)]
[AIX] Change the linkage of profiling counter/data to be private

We generate symbols like `profc`/`profd` for each function, and put them into csects.
When there are weak functions,  we generate weak symbols for the functions as well,
with ELF (and some others),  linker (binder) will discard and only keep one copy of the weak symbols.

However, on AIX, the current binder can NOT discard the weak symbols if we put all of them into the same csect,
as binder can NOT discard a subset of a csect.

This creates a unique challenge for using those symbols to calculate some relative offsets.

This patch changed the linkage of `profc`/`profd` symbols to be private, so that all the profc/profd for each weak symbol will be *local* to objects, and all kept in the csect, so we won't have problem. Although only one of the counters will be used, all the pointer in the profd is correct.

The downside is that we won't be able to discard the duplicated counters and profile data,
but those can not be discarded even if we keep the weak linkage,
due to the binder limitation of not discarding a subsect of the csect either .

Reviewed By: Whitney, MaskRay

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

2 years ago[JITLink][MachO][arm64] Add support for splitting compact-unwind sections.
Lang Hames [Wed, 29 Sep 2021 00:14:54 +0000 (17:14 -0700)]
[JITLink][MachO][arm64] Add support for splitting compact-unwind sections.

CompactUnwindSplitter splits compact-unwind sections on record boundaries and
adds keep-alive edges from target functions back to their respective records.

In MachO_arm64.cpp, a CompactUnwindSplitter pass is added to the pre-prune pass
list when setting up the standard pipeline.

This patch does not provide runtime support for compact-unwind, but is a first
step towards enabling it.

2 years ago[AArch64][GlobalISel] Run overlapping_and after legalization
Jessica Paquette [Tue, 28 Sep 2021 22:57:02 +0000 (15:57 -0700)]
[AArch64][GlobalISel] Run overlapping_and after legalization

When we have code with truncates, those truncates may be changed into G_ANDs
with constants. These may, in turn, feed into other G_AND instructions.

Running this combine post-legalize allows us to optimize examples like this one:

https://godbolt.org/z/zrGY4dfEW

SDAG currently optimizes the example above so that there is only one `and`.
GISel doesn't optimize it, because the G_AND we'd optimize here is translated
as a G_TRUNC. Later, that G_TRUNC is turned into a G_AND during legalization.

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

2 years agoClean up large copies of binaries copied into temp directories in tests
Teresa Johnson [Wed, 22 Sep 2021 18:41:44 +0000 (11:41 -0700)]
Clean up large copies of binaries copied into temp directories in tests

In looking at the disk space used by a ninja check-all, I found that a
few of the largest files were copies of clang and lld made into temp
directories by a couple of tests. These tests were added in D53021 and
D74811. Clean up these copies after usage.

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

2 years ago[test] Specify triple in backend-attribute-error-warning.cpp
Arthur Eubanks [Tue, 28 Sep 2021 23:59:15 +0000 (16:59 -0700)]
[test] Specify triple in backend-attribute-error-warning.cpp

Tests fail on Windows otherwise.

2 years ago[GlobalISel] Combine mulo x, 2 -> addo x, x
Jessica Paquette [Tue, 28 Sep 2021 22:04:23 +0000 (15:04 -0700)]
[GlobalISel] Combine mulo x, 2 -> addo x, x

Similar to what SDAG does when it sees a smulo/umulo against 2
(see: `DAGCombiner::visitMULO`)

This pattern is fairly common in Swift code AFAICT.

Here's an example extracted from a Swift testcase:

https://godbolt.org/z/6cT8Mesx7

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

2 years ago[libc] Add support for 128 bit ints in limits.h
Michael Jones [Tue, 28 Sep 2021 18:25:43 +0000 (18:25 +0000)]
[libc] Add support for 128 bit ints in limits.h

Also, this adds unit tests to check that limits.h complies with the C
standard.

Reviewed By: sivachandra

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

2 years ago[clang] Let PPCallbacks::PragmaWarning() pass specifier as enum instead of string
Nico Weber [Tue, 28 Sep 2021 15:55:11 +0000 (11:55 -0400)]
[clang] Let PPCallbacks::PragmaWarning() pass specifier as enum instead of string

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

2 years agofixes bug #51926 where dangling comma caused overrun
Fred Grim [Sat, 25 Sep 2021 16:07:12 +0000 (09:07 -0700)]
fixes bug #51926 where dangling comma caused overrun

bug 51926 identified an issue where a dangling comma caused the cell count to be to off by one

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

2 years ago[NFC][sanitizer] Return StackDepotStats by value
Vitaly Buka [Tue, 28 Sep 2021 18:20:18 +0000 (11:20 -0700)]
[NFC][sanitizer] Return StackDepotStats by value

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

2 years ago[mlir][Python] Fix lifetime of ExecutionEngine runtime functions.
Sean Silva [Tue, 28 Sep 2021 21:58:51 +0000 (21:58 +0000)]
[mlir][Python] Fix lifetime of ExecutionEngine runtime functions.

We weren't retaining the ctypes closures that the ExecutionEngine was
calling back into, leading to mysterious errors.

Open to feedback about how to test this. And an extra pair of eyes to
make sure I caught all the places that need to be aware of this.

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

2 years agoReland [clang] Rework dontcall attributes
Arthur Eubanks [Thu, 23 Sep 2021 20:54:24 +0000 (13:54 -0700)]
Reland [clang] Rework dontcall attributes

To avoid using the AST when emitting diagnostics, split the "dontcall"
attribute into "dontcall-warn" and "dontcall-error", and also add the
frontend attribute value as the LLVM attribute value. This gives us all
the information to report diagnostics we need from within the IR (aside
from access to the original source).

One downside is we directly use LLVM's demangler rather than using the
existing Clang diagnostic pretty printing of symbols.

Previous revisions didn't properly declare the new dependencies.

Reviewed By: nickdesaulniers

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

2 years ago[mlir][tosa] Add i32 to supported quantized type
Rob Suderman [Tue, 28 Sep 2021 21:53:07 +0000 (14:53 -0700)]
[mlir][tosa] Add i32 to supported quantized type

Quantized int type should include I32 types as its the output of a quantizd
convolution or matmul operation.

Reviewed By: NatashaKnk

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

2 years ago[CodeGen] Fix wrapping personality symbol on ARM
Shoaib Meenai [Tue, 28 Sep 2021 03:10:23 +0000 (20:10 -0700)]
[CodeGen] Fix wrapping personality symbol on ARM

The ARM backend was explicitly setting global binding on the personality
symbol. This was added without any comment in a7ec2dcefd954, which
introduced EHABI support (back in 2011). None of the other backends do
anything equivalent, as far as I can tell.

This causes problems when attempting to wrap the personality symbol.
Wrapped symbols are marked as weak inside LTO to inhibit IPO (see
https://reviews.llvm.org/D33621). When we wrap the personality symbol,
it initially gets weak binding, and then the ARM backend attempts to
change the binding to global, which causes an error in MC because of
attempting to change the binding of a symbol from non-global to global
(the error was added in https://reviews.llvm.org/D90108).

Simply drop the ARM backend's explicit global binding setting to fix
this. This matches all the other backends, and a large internal
application successfully linked and ran with this change, so it
shouldn't cause any problems. Test via LLD, since wrapping is required
to exhibit the issue.

Reviewed By: MaskRay

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

2 years agoFlang OpenMP Report Plugin
Stuart Ellis [Tue, 28 Sep 2021 21:17:27 +0000 (22:17 +0100)]
Flang OpenMP Report Plugin

This plugin parses Fortran files and creates a
YAML report with all the OpenMP constructs and
clauses seen in the file.

The following tests have been modified to be
compatible for testing the plugin, hence why
they are not reused from another directory:

- omp-atomic.f90
- omp-declarative-directive.f90
- omp-device-constructs.f90

The plugin outputs a single file in the same
directory as the source file in the following format:
`<source-file-name>.yaml`

Building the plugin:
`ninja flangOmpReport`

Running the plugin:
`./bin/flang-new -fc1 -load lib/flangOmpReport.so -plugin flang-omp-report -fopenmp <source_file.f90>`

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Co-authored-by: Stuart Ellis <stuart.ellis@arm.com>
Reviewed By: awarzynski, kiranchandramohan

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

2 years agoRemove unnecessary async group creates and awaits.
bakhtiyar [Tue, 28 Sep 2021 21:35:15 +0000 (14:35 -0700)]
Remove unnecessary async group creates and awaits.

Reviewed By: ezhulenev

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

2 years agoRename target block size to min task size for clarity.
bakhtiyar [Tue, 28 Sep 2021 21:34:53 +0000 (14:34 -0700)]
Rename target block size to min task size for clarity.

Reviewed By: ezhulenev

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

2 years agoRevert "[clang] Rework dontcall attributes"
Arthur Eubanks [Tue, 28 Sep 2021 21:49:27 +0000 (14:49 -0700)]
Revert "[clang] Rework dontcall attributes"

This reverts commit 2943071e2ee0c7f31f34062a44d12aeb0e3a66fd.

Breaks bots

2 years agoRevert "[test] Pin some RUN lines in optimization-remark.c to new PM"
Arthur Eubanks [Tue, 28 Sep 2021 21:42:23 +0000 (14:42 -0700)]
Revert "[test] Pin some RUN lines in optimization-remark.c to new PM"

This reverts commit 952f030fe6ade193ead8f23a7654cf8d2c7aa3df.

Causes bot failures.

2 years ago[mlir] Unroll-and-jam loops with iter_args.
Amy Zhuang [Tue, 28 Sep 2021 20:54:15 +0000 (13:54 -0700)]
[mlir] Unroll-and-jam loops with iter_args.

Unroll-and-jam currently doesn't work when the loop being unroll-and-jammed
or any of its inner loops has iter_args. This patch modifies the
unroll-and-jam utility to support loops with iter_args.

Reviewed By: bondhugula

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

2 years ago[libc++] Simplify std::ranges::subrange
Louis Dionne [Thu, 23 Sep 2021 22:09:17 +0000 (18:09 -0400)]
[libc++] Simplify std::ranges::subrange

Instead of using a base class to store the members and the optional
size, use [[no_unique_address]] to achieve the same thing without
needing a base class.

Also, as a fly-by:
- Change subrange from struct to class (per the standard)
- Improve the diagnostic for when one doesn't provide a size to the ctor of a sized subrange
- Replace this->member by just member since it's not in a dependent base anymore

This change would be an ABI break due to [[no_unique_address]], but we
haven't shipped ranges anywhere yet, so this shouldn't affect anyone.

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

2 years ago[test] Pin some RUN lines in optimization-remark.c to new PM
Arthur Eubanks [Tue, 28 Sep 2021 21:29:33 +0000 (14:29 -0700)]
[test] Pin some RUN lines in optimization-remark.c to new PM

Some people downstream are reporting that this test fails. I've been
unable to reproduce, but there is indeed something spooky going on.
Pinning to the new PM suppresses the failure. I'm continuing to
investigate this.

2 years ago[clang] Rework dontcall attributes
Arthur Eubanks [Thu, 23 Sep 2021 20:54:24 +0000 (13:54 -0700)]
[clang] Rework dontcall attributes

To avoid using the AST when emitting diagnostics, split the "dontcall"
attribute into "dontcall-warn" and "dontcall-error", and also add the
frontend attribute value as the LLVM attribute value. This gives us all
the information to report diagnostics we need from within the IR (aside
from access to the original source).

One downside is we directly use LLVM's demangler rather than using the
existing Clang diagnostic pretty printing of symbols.

Reviewed By: nickdesaulniers

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

2 years ago[libc] Add implementations of the C standard condition variable functions.
Siva Chandra Reddy [Wed, 25 Aug 2021 19:52:09 +0000 (19:52 +0000)]
[libc] Add implementations of the C standard condition variable functions.

Reviewed By: michaelrj

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

2 years ago[InstCombine] reduce redundant code for shl-binop folds
Sanjay Patel [Tue, 28 Sep 2021 20:59:18 +0000 (16:59 -0400)]
[InstCombine] reduce redundant code for shl-binop folds

This is NFCI (no-functional-change-intended), but there
are benign diffs possible with commutable ops as seen in
the test diffs.

The transforms were repeated for the commutative opcodes,
but that should not be necessary if we canonicalize the
patterns that we're matching. If both operands of the
binop match, that should get folded eventually.

The transform that starts with a mask op seems to
over-constrain the use checks, so that could be a
potential enhancement.

2 years ago[InstCombine] add multi-use tests for shl folds; NFC
Sanjay Patel [Tue, 28 Sep 2021 20:51:19 +0000 (16:51 -0400)]
[InstCombine] add multi-use tests for shl folds; NFC

2 years ago[LTO] Avoid repeated Triple construction. NFC
Fangrui Song [Tue, 28 Sep 2021 20:39:41 +0000 (13:39 -0700)]
[LTO] Avoid repeated Triple construction. NFC

2 years ago[mlir] Fix bug in FoldSubview with rank reducing subview
thomasraoux [Tue, 28 Sep 2021 16:26:41 +0000 (09:26 -0700)]
[mlir] Fix bug in FoldSubview with rank reducing subview

Fix how we calculate the new permutation map of the transfer ops.

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

2 years ago[llvm-jitlink] Add -slab-page-size to tests that need it.
Lang Hames [Tue, 28 Sep 2021 20:13:57 +0000 (13:13 -0700)]
[llvm-jitlink] Add -slab-page-size to tests that need it.

Also fixes 80-column rule violations.

2 years ago[libc++] Clarify the name of Lit features related to standard library selection
Louis Dionne [Tue, 28 Sep 2021 20:02:43 +0000 (16:02 -0400)]
[libc++] Clarify the name of Lit features related to standard library selection

Before this patch, we had features named 'libc++', 'libstdc++' and
'msvc' to describe the three implementations that use our test suite.
This patch renames them to 'stdlib=libc++', 'stdlib=libstdc++', etc
to avoid confusion between MSVC's STL and the MSVC compiler (or Clang
in MSVC mode).

Furthermore, this prepares the terrain for adding support for additional
"implementations" to the test suite. Basically, I'd like to be able to
treat Apple's libc++ differently from LLVM's libc++ for the purpose of
testing, because those effectively behave in different ways in some aspects.

2 years agoFix memcpy-nobuiltin.c test case
serge-sans-paille [Tue, 28 Sep 2021 19:54:27 +0000 (21:54 +0200)]
Fix memcpy-nobuiltin.c test case

Make it more generic by accepting weak_odr and dso_local specifiers.

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

2 years agoRevert "Improve the effectiveness of BDCE's debug info salvaging"
Nikita Popov [Tue, 28 Sep 2021 19:49:36 +0000 (21:49 +0200)]
Revert "Improve the effectiveness of BDCE's debug info salvaging"

This reverts commit f6954bf80472cbfc06e39dac75a4a72120c9bd15.

This breaks the test-suite O3 build:

/home/nikic/llvm-test-suite/build-O3/tools/timeit --summary Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o.time /home/nikic/llvm-project/build/bin/clang++  -DNDEBUG  -O3   -w -Werror=date-time -save-stats=obj -save-stats=obj -std=c++11 -MD -MT Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o -MF Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o.d -o Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o -c ../Bitcode/Benchmarks/Halide/local_laplacian/local_laplacian.bc
While deleting: i64 %
Use still stuck around after Def is destroyed:  %12620 = mul i64 %12619, <badref>
clang++: /home/nikic/llvm-project/llvm/lib/IR/Value.cpp:103: llvm::Value::~Value(): Assertion `materialized_use_empty() && "Uses remain when a value is destroyed!"' failed.

2 years agoAdd profile count. Regenerate check lines. NFC
Anna Thomas [Tue, 28 Sep 2021 19:32:49 +0000 (15:32 -0400)]
Add profile count. Regenerate check lines. NFC

Function profile counts added to test cases. Regenerated test lines for
loop predication test.

2 years ago[llvm-profgen] Strip context to support non-CS profile generation for hybrid sample
wlei [Fri, 24 Sep 2021 18:32:32 +0000 (11:32 -0700)]
[llvm-profgen] Strip context to support non-CS profile generation for hybrid sample

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

2 years agoSimplify handling of builtin with inline redefinition
serge-sans-paille [Thu, 16 Sep 2021 16:13:15 +0000 (18:13 +0200)]
Simplify handling of builtin with inline redefinition

(This is a recommit of 3d6f49a56995b845 that should no longer break validation since
bd379915de38a9af3d65e1).

It is a common practice in glibc header to provide an inline redefinition of an
existing function. It is especially the case for fortified function.

Clang currently has an imperfect approach to the problem, using a combination of
trivially recursive function detection and noinline attribute.

Simplify the logic by suffixing these functions by `.inline` during codegen, so
that they are not recognized as builtin by llvm.

After that patch, clang passes all tests from https://github.com/serge-sans-paille/fortify-test-suite

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