platform/upstream/llvm.git
22 months ago[DebugInfo] Convert most tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 15:06:46 +0000 (16:06 +0100)]
[DebugInfo] Convert most tests to opaque pointers (NFC)

22 months ago[BugPoint] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 15:05:27 +0000 (16:05 +0100)]
[BugPoint] Convert tests to opaque pointers (NFC)

22 months agoRevert "Delete sanitizer_common-based ('old') scudo: o7"
Krasimir Georgiev [Tue, 13 Dec 2022 15:03:11 +0000 (16:03 +0100)]
Revert "Delete sanitizer_common-based ('old') scudo: o7"

This reverts commit 512a98e7184e5d48cefbe39da049af3b08ad3919.
We'll need some time to migrate some internal usages off this.
Will sync up with @hctim and @vitalybuka directly.

22 months ago[RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V
Alexey Baturo [Wed, 10 Aug 2022 05:41:26 +0000 (08:41 +0300)]
[RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V

Reviewed by: vitalybuka

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

22 months agoInstCombine: Add baseline test for and/or/xor of is.fpclass
Matt Arsenault [Sat, 10 Dec 2022 17:24:53 +0000 (12:24 -0500)]
InstCombine: Add baseline test for and/or/xor of is.fpclass

22 months agoInstCombine: Add baseline tests for negated fpclass tests
Matt Arsenault [Thu, 17 Nov 2022 05:01:09 +0000 (21:01 -0800)]
InstCombine: Add baseline tests for negated fpclass tests

As suggested in https://reviews.llvm.org/D137811

22 months agoInstCombine: Add tests for is_fpclass with ninf sources
Matt Arsenault [Thu, 17 Nov 2022 04:46:08 +0000 (20:46 -0800)]
InstCombine: Add tests for is_fpclass with ninf sources

22 months agoInstCombine: Add a few tests for daz behavior with is_fpclass
Matt Arsenault [Wed, 30 Nov 2022 15:49:49 +0000 (10:49 -0500)]
InstCombine: Add a few tests for daz behavior with is_fpclass

22 months agoUpdate tests by update_test_checks.py
luxufan [Tue, 13 Dec 2022 14:53:22 +0000 (22:53 +0800)]
Update tests by update_test_checks.py

22 months ago[Tests] Convert Feature tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 14:45:54 +0000 (15:45 +0100)]
[Tests] Convert Feature tests to opaque pointers (NFC)

22 months ago[NFC] Fix duplicated `Src`
Phoebe Wang [Tue, 13 Dec 2022 14:43:50 +0000 (22:43 +0800)]
[NFC] Fix duplicated `Src`

22 months ago[GlobalOpt] Convert remaining tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 14:41:17 +0000 (15:41 +0100)]
[GlobalOpt] Convert remaining tests to opaque pointers (NFC)

22 months ago[GlobalOpt] Regenerate test checks (NFC)
Nikita Popov [Tue, 13 Dec 2022 14:35:26 +0000 (15:35 +0100)]
[GlobalOpt] Regenerate test checks (NFC)

22 months ago[GlobalOpts] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 14:23:47 +0000 (15:23 +0100)]
[GlobalOpts] Convert tests to opaque pointers (NFC)

22 months ago[NFC] Add checks for potential null returns
Phoebe Wang [Tue, 13 Dec 2022 14:28:47 +0000 (22:28 +0800)]
[NFC] Add checks for potential null returns

22 months ago[gn build] Port 7a85192166b5
Nico Weber [Tue, 13 Dec 2022 14:25:17 +0000 (09:25 -0500)]
[gn build] Port 7a85192166b5

22 months ago[IndVarSimplify] Convert last test to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 14:20:13 +0000 (15:20 +0100)]
[IndVarSimplify] Convert last test to opaque pointers (NFC)

After addressing the SCEVExpander issue that caused me pause.

Also delete a redundant test that is no longer needed.

22 months ago[SCEVExpander] Produce canonical constant GEP
Nikita Popov [Tue, 13 Dec 2022 14:05:54 +0000 (15:05 +0100)]
[SCEVExpander] Produce canonical constant GEP

Go through IRBuilder to enable DL-based folding, so that we produce
a canonical constant GEP. Noticed while converting tests to opaque
pointers.

22 months agoAPFloat: Add isPosInfinity and isNegInfinity helpers
Matt Arsenault [Sun, 11 Dec 2022 13:37:26 +0000 (08:37 -0500)]
APFloat: Add isPosInfinity and isNegInfinity helpers

22 months ago[X86] lowerShuffleAsVTRUNC - support offseted truncations
Simon Pilgrim [Tue, 13 Dec 2022 13:42:16 +0000 (13:42 +0000)]
[X86] lowerShuffleAsVTRUNC - support offseted truncations

Extend the <0,Scale,2*Scale,..> pattern to allow for a fixed offset <Offset,Offset+Scale,Offset+2*Scale,..> pattern, which will lower to a single additional bitshift/pshufd.

At the moment I've limited this to cases where the LHS/RHS operands are concatenated for free, but this is only to avoid a couple of regressions that should be easily addressable in followups.

22 months ago[flang] Handle type generation for unlimited polymorphic function result
Valentin Clement [Tue, 13 Dec 2022 13:59:39 +0000 (14:59 +0100)]
[flang] Handle type generation for unlimited polymorphic function result

An unlimited polymorphic entity is considered to have a derived category
in its dynamic type but no type descriptor. Avoid a nullptr dereference when
an unlimited polymorphic type needs to be generated.

Reviewed By: PeteSteinfeld

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

22 months ago[IndVarSimplify] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 13:44:27 +0000 (14:44 +0100)]
[IndVarSimplify] Convert tests to opaque pointers (NFC)

This leaves lftr.ll alone, because there is a suspicious test diff.

22 months ago[clang][dataflow] Change the diagnoser API to receive a correctly typed lattice element
Dani Ferreira Franco Moura [Tue, 13 Dec 2022 13:31:57 +0000 (14:31 +0100)]
[clang][dataflow] Change the diagnoser API to receive a correctly typed lattice element

Previously, the diagnoser could only receive the Environment at a given program point. Now, it receives the complete dataflow state: the environment and lattice element.

This change does not contain any tests because we modify the checkDataflow function to rely on the newly introduced lattice element in PostVisitCFG, and existing tests that verify lattice elements depend on this overload of checkDataflow.

Reviewed By: gribozavr2, ymandel

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

22 months agoConstantFolding: Ignore output denorm mode for canonicalize
Matt Arsenault [Tue, 13 Dec 2022 13:12:36 +0000 (08:12 -0500)]
ConstantFolding: Ignore output denorm mode for canonicalize

Alive2 opt plugin is now happy with the test. Fixes issue 59245

22 months agoConstantFolding: Fix handling of canonicalize for ppc_fp128 0s
Matt Arsenault [Fri, 18 Nov 2022 22:49:15 +0000 (14:49 -0800)]
ConstantFolding: Fix handling of canonicalize for ppc_fp128 0s

22 months ago[Assembler] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 13:12:34 +0000 (14:12 +0100)]
[Assembler] Convert tests to opaque pointers (NFC)

Some tests are removed because the error conditions can no longer
occur with opaque pointers.

22 months ago[NFC][CMake] Explicitly link to MC when needed
Roman Lebedev [Tue, 13 Dec 2022 13:13:34 +0000 (16:13 +0300)]
[NFC][CMake] Explicitly link to MC when needed

These targets use `MCInst`, but don't explicitly link
to the library providing it (MC), and just rely on it
being pulled transitively through e.g. MCDisassembler,
but that only pulls includes, and does not link to it.

Case in point, when i add explicit destructor to `MCInst`,
defined in `.cpp`, these targets were failing to link.

22 months agoInstCombine: Fold negations of is_fpclass intrinsics
Matt Arsenault [Thu, 17 Nov 2022 05:26:29 +0000 (21:26 -0800)]
InstCombine: Fold negations of is_fpclass intrinsics

Can invert the result by inverting the test mask.

22 months agoInstCombine: Regenerate checks
Matt Arsenault [Tue, 13 Dec 2022 13:01:48 +0000 (08:01 -0500)]
InstCombine: Regenerate checks

update_test_checks has changed what it emits for function labels,
so keep this noise out of a real output change.

22 months agoRemove sentinel argument from dispatchIndexOpFoldResults.
Aliia Khasanova [Tue, 13 Dec 2022 12:35:24 +0000 (13:35 +0100)]
Remove sentinel argument from dispatchIndexOpFoldResults.
Post clean-up after merger of kDynamicSize and kDynamicStrideOrOffset.

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

22 months ago[libc] Add compiler, builtin and feature detection
Guillaume Chatelet [Fri, 9 Dec 2022 14:30:40 +0000 (14:30 +0000)]
[libc] Add compiler, builtin and feature detection

This is a first step to support GCC. This patch adds support for builtin and feature detection.

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

22 months agoReapply [Assignment Tracking][13/*] Account for assignment tracking in SROA
OCHyams [Mon, 12 Dec 2022 09:18:59 +0000 (09:18 +0000)]
Reapply [Assignment Tracking][13/*] Account for assignment tracking in SROA

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Split dbg.assign intrinsics into fragments similarly to what SROA already does
for dbg.declares, except that there's many more intrinsics to split. The
function migrateDebugInfo generates new dbg.assigns intrinsic for each part of
a split store.

Reviewed By: jmorse

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

22 months agore-land [RISC-V][HWASAN] Support tagging global variables for RISC-V HWASAN
Alexey Baturo [Tue, 13 Dec 2022 12:43:49 +0000 (15:43 +0300)]
re-land [RISC-V][HWASAN] Support tagging global variables for RISC-V HWASAN

Now with fix to limit added tagged-globals.ll to risc-v platform
--
[RISC-V][HWASAN] Support tagging global variables for RISC-V HWASAN

Reviewed by: luismarques

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

22 months ago[exegesis] Benchmark: provide optional progress meter / ETA
Roman Lebedev [Tue, 13 Dec 2022 12:22:00 +0000 (15:22 +0300)]
[exegesis] Benchmark: provide optional progress meter / ETA

Now that `--opcode-index=-1` is mostly stable,
and i can migrate off of my custom tooling that emulated it,
there comes a bit of confusion as to the status of the run.

It is normal for the single all-opcode run to take ~3 minutes,
and it's a bit more than one can be comfortable with,
without having some sort of visual indication of the progress.

Thus, i present:
```
$ ./bin/llvm-exegesis -mode=inverse_throughput --opcode-index=-1 --benchmarks-file=/dev/null --dump-object-to-disk=0 --measurements-print-progress --skip-measurements
<...>
XAM_Fp80: unsupported opcode: pseudo instruction
XBEGIN: Unsupported opcode: isPseudo/usesCustomInserter
XBEGIN_2: Unsupported opcode: isBranch/isIndirectBranch
XBEGIN_4: Unsupported opcode: isBranch/isIndirectBranch
XCH_F: unsupported second-form X87 instruction
Processing...   1%, ETA 02:10
Processing...   2%, ETA 02:03
Processing...   3%, ETA 02:00
Processing...   4%, ETA 01:57
Processing...   5%, ETA 01:54
Processing...   6%, ETA 01:53
Processing...   7%, ETA 01:51
Processing...   8%, ETA 01:50
Processing...   9%, ETA 01:49
Processing...  10%, ETA 01:48
Processing...  11%, ETA 01:46
Processing...  12%, ETA 01:45
Processing...  13%, ETA 01:44
Processing...  14%, ETA 01:43
Processing...  15%, ETA 01:42
Processing...  16%, ETA 01:42
Processing...  17%, ETA 01:41
```

As usual, the ETA estimation is statically-insignificant,
and is a lie/does not converge at least until 50% through.
It would be nice to have an actual progress indicator like in LIT,
but i'm not sure we have such a luxury in C++ form in LLVM codebase already.

Reviewed By: courbet

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

22 months ago[rereland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignment...
Guillaume Chatelet [Tue, 13 Dec 2022 10:31:00 +0000 (10:31 +0000)]
[rereland][Alignment][NFC] Remove access to deprecated GlobalObject::getAlignment from llvm

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

22 months agoRevert "[RISC-V][HWASAN] Support tagging global variables for RISC-V HWASAN"
Alexey Baturo [Tue, 13 Dec 2022 12:17:27 +0000 (15:17 +0300)]
Revert "[RISC-V][HWASAN] Support tagging global variables for RISC-V HWASAN"

This reverts commit 11937ca5642216a67e021e69fc824f709267bada.

22 months ago[OpenMP] Skip extra blank line when parsing /proc/cpuinfo on LoongArch64
gonglingqin [Tue, 13 Dec 2022 11:44:06 +0000 (19:44 +0800)]
[OpenMP] Skip extra blank line when parsing /proc/cpuinfo on LoongArch64

This fixes the following test cases:

* affinity/kmp-affinity.c
* affinity/kmp-hw-subset.c
* affinity/omp-places.c

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

22 months ago[Tests] Convert Other tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 12:06:09 +0000 (13:06 +0100)]
[Tests] Convert Other tests to opaque pointers (NFC)

22 months ago[Bitcode] Convert test to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 11:36:48 +0000 (12:36 +0100)]
[Bitcode] Convert test to opaque pointers (NFC)

22 months ago[RISC-V][HWASAN] Support tagging global variables for RISC-V HWASAN
Alexey Baturo [Tue, 30 Aug 2022 18:05:24 +0000 (21:05 +0300)]
[RISC-V][HWASAN] Support tagging global variables for RISC-V HWASAN

Reviewed by: luismarques

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

22 months ago[AMDGPU][GFX1030][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 11:48:36 +0000 (14:48 +0300)]
[AMDGPU][GFX1030][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205).
- Enable abs and neg modifiers for v_cndmask_b32_dpp (https://reviews.llvm.org/D135900).
- Enable literal operands for permlane16/permlanex16 (https://reviews.llvm.org/D137332).
- Enable omod modifiers for v_max3_f16, v_min3_f16, etc. (https://reviews.llvm.org/D139469).
- Correct v_mov_b32_sdwa (it does not support abs and neg input modifiers yet).
- Enable tfe modifier for MUBUF loads (https://reviews.llvm.org/D137783).
- Enable image_gather4h (https://reviews.llvm.org/D130764).
- Minor corrections and improvements.

22 months ago[AsmWriter] Fix printing of atomicrmw xchg with pointer op
Nikita Popov [Tue, 13 Dec 2022 11:46:09 +0000 (12:46 +0100)]
[AsmWriter] Fix printing of atomicrmw xchg with pointer op

atomicrmw always needs to print all types, even if the xchg value
type happens to be the same as the pointer operand type. This
couldn't occur prior to opaque pointers.

22 months ago[AMDGPU][GFX1013][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 11:44:02 +0000 (14:44 +0300)]
[AMDGPU][GFX1013][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205).

22 months ago[AMDGPU][GFX10][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 11:36:43 +0000 (14:36 +0300)]
[AMDGPU][GFX10][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205).
- Enable abs and neg modifiers for v_cndmask_b32_dpp (https://reviews.llvm.org/D135900).
- Enable literal operands for permlane16/permlanex16 (https://reviews.llvm.org/D137332).
- Enable omod modifiers for v_max3_f16, v_min3_f16, etc. (https://reviews.llvm.org/D139469).
- Correct v_mov_b32_sdwa (it does not support abs and neg input modifiers yet).
- Enable tfe modifier for MUBUF loads (https://reviews.llvm.org/D137783).
- Enable image_gather4h (https://reviews.llvm.org/D130764).
- Minor corrections and improvements.

22 months ago[AMDGPU][GFX940][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 11:26:34 +0000 (14:26 +0300)]
[AMDGPU][GFX940][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable VOP3 variants of dot2c/dot4c/dot8c instructions (https://reviews.llvm.org/D138494).
- Enable abs and neg modifiers for v_cndmask_b32 (https://reviews.llvm.org/D135900).
- Enable omod modifiers for v_max3_f16, v_min3_f16, etc. (https://reviews.llvm.org/D139469).
- Correct v_mov_b32_sdwa (it does not support abs and neg input modifiers yet).
- Enable abs and neg modifiers for v_dot2c_f32_f16_dpp.
- Minor corrections and improvements.

22 months ago[Bitcode] Convert test to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 11:19:35 +0000 (12:19 +0100)]
[Bitcode] Convert test to opaque pointers (NFC)

22 months ago[AMDGPU][GFX90A][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 11:18:20 +0000 (14:18 +0300)]
[AMDGPU][GFX90A][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205).
- Enable VOP3 variants of dot2c/dot4c/dot8c instructions (https://reviews.llvm.org/D138494).
- Enable omod modifiers for v_max3_f16, v_min3_f16, etc. (https://reviews.llvm.org/D139469).
- Enable abs and neg modifiers for v_cndmask_b32 (https://reviews.llvm.org/D135900).
- Correct v_mov_b32_sdwa (it does not support abs and neg input modifiers yet).
- Enable abs and neg modifiers for v_dot2c_f32_f16_dpp.
- Minor corrections and improvements.

22 months ago[clangd] Fix a semantic highlighting crash on dependent code.
Haojian Wu [Tue, 13 Dec 2022 11:15:39 +0000 (12:15 +0100)]
[clangd] Fix a semantic highlighting crash on dependent code.

22 months ago[clang][ExtractAPI] Add support for single symbol SGF and libclang support
Daniel Grumberg [Wed, 26 Oct 2022 17:23:37 +0000 (18:23 +0100)]
[clang][ExtractAPI] Add support for single symbol SGF and libclang support

This is mainly adding an entry point to `SymbolGraphSerializer` at
`serializeSingleSymbolSGF` and exposing the necessary data to make this
possible.  Additionaly there are some changes to how symbol kinds and
path components are serialized to make the usage more ergonomic in
`serializeSingleSymbolSGF`.

On the libclang side this introduces APIs to:
- create an APISet from a TU
- dispose of an APISet
- query an APISet for a single symbol SGF for a given USR.
- generate a single symbol SGF for a given CXCursor, this only traverses
the necessary AST nodes to construct the result as oppposed as going
through the entire AST.

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

22 months ago[Bitcode] Update test to use opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 11:15:55 +0000 (12:15 +0100)]
[Bitcode] Update test to use opaque pointers (NFC)

22 months ago[AMDGPU][GFX908][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 11:12:09 +0000 (14:12 +0300)]
[AMDGPU][GFX908][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable VOP3 variants of dot2c/dot4c/dot8c instructions (https://reviews.llvm.org/D138494).
- Enable abs and neg modifiers for v_dot2c_f32_f16_dpp.
- Minor corrections and improvements.

22 months ago[AMDGPU][GFX9][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 11:01:17 +0000 (14:01 +0300)]
[AMDGPU][GFX9][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205).
- Enable omod modifiers for v_max3_f16, v_min3_f16, etc. (https://reviews.llvm.org/D139469).
- Enable abs and neg modifiers for v_cndmask_b32 (https://reviews.llvm.org/D135900).
- Correct v_mov_b32_sdwa (it does not support abs and neg input modifiers yet).
- Enable tfe modifier for MUBUF loads (https://reviews.llvm.org/D137783).
- Enable image_gather4h (https://reviews.llvm.org/D130764).
- Minor corrections and improvements.

22 months ago[AMDGPU][GFX8][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 10:54:28 +0000 (13:54 +0300)]
[AMDGPU][GFX8][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205).
- Enable abs and neg modifiers for v_cndmask_b32 (https://reviews.llvm.org/D135900).
- Correct v_mov_b32_sdwa (it does not support abs and neg input modifiers yet).
- Enable tfe modifier for MUBUF loads (https://reviews.llvm.org/D137783).
- Minor corrections and improvements.

22 months ago[AMDGPU][GFX7][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Tue, 13 Dec 2022 10:46:56 +0000 (13:46 +0300)]
[AMDGPU][GFX7][DOC][NFC] Update assembler syntax description

Summary of changes:
- Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205).
- Enable tfe modifier for MUBUF loads (https://reviews.llvm.org/D137783).
- Enable abs and neg modifiers for v_cndmask_b32_e64.
- Minor corrections and improvements.

22 months ago[Clang] Update some CUDA tests to opaque pointers (NFC)
Nikita Popov [Tue, 13 Dec 2022 10:48:14 +0000 (11:48 +0100)]
[Clang] Update some CUDA tests to opaque pointers (NFC)

22 months ago[RS4GC] Add few tests for derived pointer rematerialization. NFC.
Denis Antrushin [Mon, 28 Nov 2022 18:58:47 +0000 (01:58 +0700)]
[RS4GC] Add few tests for derived pointer rematerialization. NFC.

Precommit few tests for the upcoming 'rematerialize derived pointers
at uses' feature.

Reviewed By: skatkov

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

22 months ago[CVP] Eliminate urem when LHS < RHS
Joshua Cao [Sat, 19 Nov 2022 18:25:30 +0000 (13:25 -0500)]
[CVP] Eliminate urem when LHS < RHS

Fol `X % Y -> X` when we can determine `X < Y` based on constant
range information.

Fixes https://github.com/llvm/llvm-project/issues/58408.

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

22 months ago[IRBuilder] Fix CreateFDivFMF ignoring source FMF
Daniel Woodworth [Tue, 13 Dec 2022 10:35:17 +0000 (11:35 +0100)]
[IRBuilder] Fix CreateFDivFMF ignoring source FMF

This change fixes a small bug in IRBuilderBase::CreateFDivFMF introduced
by accident in rGf34dcf27637f which caused the builder's default fast math
flags to be used for the new fdiv instruction instead of the ones from
the source instruction. It also adds unit testing for the CreateF*FMF
family of functions to more easily catch similar bugs in the future.

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

22 months ago[InstCombine] Support logical ops in foldAndOrOfICmpsWithConstEq() (NFC)
Nikita Popov [Tue, 13 Dec 2022 10:28:20 +0000 (11:28 +0100)]
[InstCombine] Support logical ops in foldAndOrOfICmpsWithConstEq() (NFC)

This is largely just for the sake of completeness. For logical ops,
this is mostly subsumed by foldSelectValueEquivalence() in a more
generic way. The only exception is vector support, as select
value equivalence folding currently doesn't support this for the
case where the replacement does not simplify.

22 months ago[DWARFLinker] llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 10:14:09 +0000 (10:14 +0000)]
[DWARFLinker] llvm::Optional => std::optional

22 months ago[WindowsDriver] llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 10:06:57 +0000 (10:06 +0000)]
[WindowsDriver] llvm::Optional => std::optional

22 months agoLLParser: llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 10:04:35 +0000 (10:04 +0000)]
LLParser: llvm::Optional => std::optional

22 months agoReland "[compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests"
Rainer Orth [Tue, 13 Dec 2022 09:58:58 +0000 (10:58 +0100)]
Reland "[compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests"

When trying to debug some `compiler-rt` unittests, I initially had a hard
time because

- even in a `Debug` build one needs to set `COMPILER_RT_DEBUG` to get
  debugging info for some of the code and
- even so the unittests used a hardcoded `-O2` which often makes debugging
  impossible.

This patch addresses this by instead using `-O0` if `COMPILER_RT_DEBUG`.

Changes relative to the previous commit:

- Use `string(APPEND)` for `COMPILER_RT_TEST_COMPILER_CFLAGS`.
- Omit `-O3` from `COMPILER_RT_TEST_COMPILER_CFLAGS` in non-debug builds for now.
- Provide `__sanitizer::integral_constant<bool, true>::value` instantiation
  for `sanitizer_type_traits_test.cpp` in debug builds.
- Disable subtests of `tsan/tests/unit/tsan_trace_test.cpp` that deadlock
  in debug builds.
- `XFAIL` `tsan/Linux/check_memcpy.c` in debug builds.

Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

22 months ago[InstCombine] Add additional foldAndOrOfICmpsWithConstEq() tests (NFC)
Nikita Popov [Tue, 13 Dec 2022 09:56:00 +0000 (10:56 +0100)]
[InstCombine] Add additional foldAndOrOfICmpsWithConstEq() tests (NFC)

Add logical variants of vector tests.

22 months agoRevert "[Assignment Tracking][13/*] Account for assignment tracking in SROA"
Krasimir Georgiev [Tue, 13 Dec 2022 09:54:26 +0000 (09:54 +0000)]
Revert "[Assignment Tracking][13/*] Account for assignment tracking in SROA"

This reverts commit 3bfba672afd52dfd5bde54dc8b67ec96275f9e15.

Temporary revert since this potentially causes
https://github.com/llvm/llvm-project/issues/59490.

22 months ago[mlir][scf] Fixes IndexSwitchOp verifier crash
Mehdi Amini [Tue, 13 Dec 2022 09:41:13 +0000 (09:41 +0000)]
[mlir][scf] Fixes IndexSwitchOp verifier crash

Fixes #59460

22 months agoRevert "[AArch64][GlobalISel] Lower formal arguments of AAPCS & ms_abi variadic funct...
Martin Storsjö [Tue, 13 Dec 2022 09:36:12 +0000 (11:36 +0200)]
Revert "[AArch64][GlobalISel] Lower formal arguments of AAPCS & ms_abi variadic functions."

This reverts commit 56fd846f370adf16bea333b12637038ea2f3c225.

This commit regressed handling of functions with floats as arguments,
reproducible e.g. like this:

$ cat test.c
double func(double f) {
    return f;
}
$ clang -target aarch64-windows -S -o - test.c -fno-asynchronous-unwind-tables
func:
sub sp, sp, #16
str x0, [sp, #8]
ldr d0, [sp, #8]
add sp, sp, #16
ret

22 months ago[InstCombine] Support logical ops in foldAndOrOfICmpEqZeroAndICmp()
Nikita Popov [Tue, 13 Dec 2022 09:02:46 +0000 (10:02 +0100)]
[InstCombine] Support logical ops in foldAndOrOfICmpEqZeroAndICmp()

If the and/or is logical and one of the operands only occurs on the
RHS, we need to freeze it: https://alive2.llvm.org/ce/z/vuMuE_

22 months ago[RS4GC] Turn lambda into static function. NFC.
Denis Antrushin [Wed, 23 Nov 2022 15:31:41 +0000 (22:31 +0700)]
[RS4GC] Turn lambda into static function. NFC.

Extract `rematerializeChain()` lambda into static function.
We'll need it in upcoming patch to RS4GC pass.
There is small interface change: now reversal of `ChainToBase` is
performed within this function, not outside.
Still this is non-functional change.

Reviewed By: skatkov

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

22 months ago[InstCombine] Add additional tests for foldAndOrOfICmpEqZeroAndICmp (NFC)
Nikita Popov [Tue, 13 Dec 2022 09:07:54 +0000 (10:07 +0100)]
[InstCombine] Add additional tests for foldAndOrOfICmpEqZeroAndICmp (NFC)

Adds logical variants of the commuted tests.

22 months ago[CodeGen] llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 09:06:36 +0000 (09:06 +0000)]
[CodeGen] llvm::Optional => std::optional

22 months ago[clangd] Fix some header guard names, NFC
Haojian Wu [Tue, 13 Dec 2022 08:55:58 +0000 (09:55 +0100)]
[clangd] Fix some header guard names, NFC

Per the LLVM code style, there should be no trailing `_` on the header
guard name.

22 months agoImplement CWG2631
Corentin Jabot [Sun, 23 Oct 2022 15:32:58 +0000 (17:32 +0200)]
Implement CWG2631

Implement https://cplusplus.github.io/CWG/issues/2631.html.

Immediate calls in default arguments and defaults members
are not evaluated.

Instead, we evaluate them when constructing a
`CXXDefaultArgExpr`/`BuildCXXDefaultInitExpr`.

The immediate calls are executed by doing a
transform on the initializing expression.

Note that lambdas are not considering subexpressions so
we do not need to transform them.

As a result of this patch, unused default member
initializers are not considered odr-used, and
errors about members binding to local variables
in an outer scope only surface at the point
where a constructor is defined.

Reviewed By: aaron.ballman, #clang-language-wg

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

22 months agoFix APFloat::toString on Float8E5M2 values.
Reed [Tue, 13 Dec 2022 08:50:02 +0000 (09:50 +0100)]
Fix APFloat::toString on Float8E5M2 values.

Before, an APInt with value 10 was created, whose width was the significand width. But 10 cannot fit in Float8E5M2's significand.

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

22 months ago[InstCombine] Handle logical op in simplifyRangeCheck() (PR59484)
Nikita Popov [Tue, 13 Dec 2022 08:41:28 +0000 (09:41 +0100)]
[InstCombine] Handle logical op in simplifyRangeCheck() (PR59484)

We need to freeze to avoid propagating a potentially poison
upper bound (https://alive2.llvm.org/ce/z/MsD38k).

This resolves the existing TODO in the code.

Fixes https://github.com/llvm/llvm-project/issues/59484.

22 months agoAdd LLVMDialect as dependent for "llvm-legalize-for-export" pass
Mehdi Amini [Tue, 13 Dec 2022 08:48:32 +0000 (08:48 +0000)]
Add LLVMDialect as dependent for "llvm-legalize-for-export" pass

Fixes #59462

22 months ago[flang] Use input type when emboxing/reboxing polymorphic entities
Valentin Clement [Tue, 13 Dec 2022 08:44:01 +0000 (09:44 +0100)]
[flang] Use input type when emboxing/reboxing polymorphic entities

When emboxing an entity to a polymorphic box, use the input type to
compute the type code and element size as the box type is too generic.
When reboxing a polymorphic box, get this information from the input
box.

Reviewed By: jeanPerier

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

22 months ago[Transforms/Coroutines] llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 08:32:44 +0000 (08:32 +0000)]
[Transforms/Coroutines] llvm::Optional => std::optional

22 months ago[Transforms/InstCombine] llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 08:26:08 +0000 (08:26 +0000)]
[Transforms/InstCombine] llvm::Optional => std::optional

22 months ago[MemProf] llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 08:15:56 +0000 (08:15 +0000)]
[MemProf] llvm::Optional => std::optional

22 months agoRevert "[UpdateTestChecks] Match define for labels"
Nikita Popov [Tue, 13 Dec 2022 08:13:39 +0000 (09:13 +0100)]
Revert "[UpdateTestChecks] Match define for labels"

This reverts commit a888825aeef8d6592c6cf5f4e5854cc39af49633.

This changes the default output of UTC, and as such introduces
spurious changes whenever existing tests are regenerated.

I've indicated in https://reviews.llvm.org/D139006#3989954 how
this can be implemented without causing test churn.

22 months ago[Transforms/Scalar] llvm::Optional => std::optional
Fangrui Song [Tue, 13 Dec 2022 08:05:14 +0000 (08:05 +0000)]
[Transforms/Scalar] llvm::Optional => std::optional

22 months ago[Clang] Implement CWG2640 Allow more characters in an n-char sequence
Corentin Jabot [Mon, 28 Nov 2022 21:45:15 +0000 (22:45 +0100)]
[Clang] Implement CWG2640 Allow more characters in an n-char sequence

Reviewed By: #clang-language-wg, aaron.ballman, tahonermann

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

22 months ago[NFC][PowerPC] Add tests for 64-bit constants that require 5 instructions to materialize.
esmeyi [Tue, 13 Dec 2022 07:44:49 +0000 (02:44 -0500)]
[NFC][PowerPC] Add tests for 64-bit constants that require 5 instructions to materialize.

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

22 months agoApply clang-tidy fixes for readability-identifier-naming in AsyncToAsyncRuntime.cpp...
Mehdi Amini [Sat, 10 Dec 2022 10:28:26 +0000 (10:28 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in AsyncToAsyncRuntime.cpp (NFC)

22 months agoApply clang-tidy fixes for performance-unnecessary-value-param in AsyncToAsyncRuntime...
Mehdi Amini [Sat, 10 Dec 2022 10:27:47 +0000 (10:27 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in AsyncToAsyncRuntime.cpp (NFC)

22 months agoRevert "[OpenMP][NFCI] Remove effectively dead code in clang and the runtime"
Johannes Doerfert [Tue, 13 Dec 2022 06:08:28 +0000 (22:08 -0800)]
Revert "[OpenMP][NFCI] Remove effectively dead code in clang and the runtime"

This reverts commit c1c8cbbf5f29257d084a23a2f6c4236c40b7afb9. One of the
tests seems to be flaky/non-deterministic.

22 months ago[Clang][NFC] Prevent lit tests from matching substrings in current path
Sameer Sahasrabuddhe [Tue, 13 Dec 2022 05:45:15 +0000 (11:15 +0530)]
[Clang][NFC] Prevent lit tests from matching substrings in current path

22 months ago[libc] Use correct type for atol
Alex Brachet [Tue, 13 Dec 2022 05:38:09 +0000 (05:38 +0000)]
[libc] Use correct type for atol

22 months ago[OpenMP][FIX] Ensure combing accesses does not violate invariants
Johannes Doerfert [Tue, 13 Dec 2022 03:38:19 +0000 (19:38 -0800)]
[OpenMP][FIX] Ensure combing accesses does not violate invariants

22 months ago[OpenMP][NFCI] Remove effectively dead code in clang and the runtime
Johannes Doerfert [Thu, 27 Oct 2022 23:53:17 +0000 (16:53 -0700)]
[OpenMP][NFCI] Remove effectively dead code in clang and the runtime

22 months ago[Attributor] Make non-side-effect inline asm be "no-call"
Johannes Doerfert [Tue, 4 Oct 2022 14:39:45 +0000 (07:39 -0700)]
[Attributor] Make non-side-effect inline asm be "no-call"

If we have inline asm with side effects we assume any function might be
called. For non-side-effect asm we now assume no function is called.

22 months ago[Sanitizers][CFG][arm64e] Fix test because -fsanitize-coverage=control-flow does...
Blue Gaston [Thu, 8 Dec 2022 20:02:14 +0000 (12:02 -0800)]
[Sanitizers][CFG][arm64e] Fix test because -fsanitize-coverage=control-flow does not sign BB entry

-fsanitize-coverage=control-flow does not sign entries into basic blocks on arm64e. This test compares a local pointer to a function [signed] with the basic block pointer. Because the entry into the
basic block is unsigned the addresses being compared are signed and unsigned, causing the path never to be taken.
This is a "bandaid" to get this test passing. We strip the signed bits from the pointer to the local functions so that the comparisons pass.
Filed radar: rdar://103042879 to note the behavior.

context: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp#L1068
    // blockaddress can not be used on function's entry block.
    if (&BB == &F.getEntryBlock())
      CFs.push_back((Constant *)IRB.CreatePointerCast(&F, IntptrPtrTy));
    else
      CFs.push_back((Constant *)IRB.CreatePointerCast(BlockAddress::get(&BB),
                                                      IntptrPtrTy));
BlockAddress::get is responsible for signing the pointer.

Because of:
https://reviews.llvm.org/D133157

rdar://103042879

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

22 months ago[IR][NFC] Adds Function::insertBasicBlockAt() to replace things like F->getBasicBlock...
Vasileios Porpodas [Mon, 12 Dec 2022 22:57:47 +0000 (14:57 -0800)]
[IR][NFC] Adds Function::insertBasicBlockAt() to replace things like F->getBasicBlockList().insert()

This is part of a series of patches that aim at making Function::getBasicBlockList() private.

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

22 months agoInstCombine: Fix metadata arguments blocking freeze combining
Matt Arsenault [Sun, 4 Dec 2022 16:36:11 +0000 (11:36 -0500)]
InstCombine: Fix metadata arguments blocking freeze combining

These are used for special arguments to intrinsics and don't make any
sense to consider for poisonness. Fixes not pushing freeze through
llvm.fptrunc.round.

92106641ae297c24877085e0357e8095aa7b43c9 made
isGuaranteedNotToBeUndefOrPoison return false for metadata arguments,
which doesn't entirely make sense. An alternate patch could switch
that to true, and try to filter out adding some pointless noundefs on
metadata arguments (I tried that, attributor breaks one case with a
llvm.dbg.value in it).

22 months agoValueTracking: Teach canCreateUndefOrPoison about FP ops
Matt Arsenault [Mon, 5 Dec 2022 03:55:57 +0000 (22:55 -0500)]
ValueTracking: Teach canCreateUndefOrPoison about FP ops

Probably could replace the switch by marking the intrinsic definitions
with NoUndef<RetIndex>.

22 months agoInstCombine: Add baseline tests for freeze with some FP ops
Matt Arsenault [Sun, 4 Dec 2022 00:55:15 +0000 (19:55 -0500)]
InstCombine: Add baseline tests for freeze with some FP ops

22 months ago[LoongArch] Add custom parser for atomic instructions' memory operand
wanglei [Tue, 13 Dec 2022 03:32:10 +0000 (11:32 +0800)]
[LoongArch] Add custom parser for atomic instructions' memory operand

In order to be compatible with the form of the atomic instruction in
GAS that accepts the fourth operand as 0 (i.e. `am* $rd, $rk, $rj, 0`),
we need to treat `$rj, 0` as one operand, but only print `$rj`.

For this, the number of result operands of inline assembly memory
operand `ZB` constraint is modified to 2 (reg + 0).

Restrictions on register usage in `am*` instructions have also been
adjusted. When `$rd` is equal to `$r0`, the instruction must be
considered legal, because of some special usage like `PseudoUNIMP`.

Reviewed By: SixWeining, xen0n

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

22 months agoObjCARC: Update tests to use opaque pointers
Matt Arsenault [Sat, 26 Nov 2022 18:02:48 +0000 (13:02 -0500)]
ObjCARC: Update tests to use opaque pointers

escape.ll needed a simple manual check line update.

contract-storestrong.ll:test12 is kind of contrived now. The comment
says it's for testing bitcasts of pointers, which don't really matter
anymore. Leaves identity ptr to ptr bitcasts (which I thought were
illegal).

22 months agoObjCARC: Try to fix faulty tests
Matt Arsenault [Sat, 26 Nov 2022 19:07:43 +0000 (14:07 -0500)]
ObjCARC: Try to fix faulty tests

These were trying to check if there was not an llvm.objc call before a
closing "}", which presumably was intended to match the end of the
function. Really this was matching the closing } in "bitcast {}* %self
to i8*", which can't be what anyone intended. This broke after
converting the test to opaque pointer deleted this bitcast.

There are in fact @llvm.obj calls remaining in the function, so this
may indicate the transform this was intended to check is actually
broken. In @"\01-[A z]" (great test name), the first retain call seems
to move down to the printf. The second case, @"\01-[Top0 _getX]", has
no change.

Change the checks to what's produced and add FIXMES. Also change the }
checks to match only at the start of the line for the function end.